1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge branch '10.8' into 10.9

This commit is contained in:
Sergei Golubchik
2022-05-18 15:04:50 +02:00
365 changed files with 10200 additions and 2464 deletions

View File

@@ -62,8 +62,10 @@ partition by system_time limit 1 partitions 3;
insert into t values (1);
update t set a= 2;
update t set a= 3;
Warnings:
Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
delete history from t;
# The above warning is one command late (MDEV-20345) ^^^
select * from t for system_time all;
a
3

View File

@@ -1,6 +1,6 @@
--- partition.result
+++ partition,heap.reject
@@ -1582,85 +1582,6 @@
@@ -2120,85 +2120,6 @@
(PARTITION `p0` HISTORY ENGINE = X,
PARTITION `pn` CURRENT ENGINE = X)
drop tables t1, tp1;
@@ -84,9 +84,9 @@
- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
-drop tables t1, tp1;
#
# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
# End of 10.7 tests
#
@@ -2193,134 +2114,6 @@
@@ -2753,134 +2674,6 @@
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
drop prepare s;
affected rows: 0

View File

@@ -1,5 +1,5 @@
SET @save_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
set @save_persistent=@@global.innodb_stats_persistent;
set global innodb_stats_persistent= 0;
call mtr.add_suppression("need more HISTORY partitions");
set system_versioning_alter_history=keep;
# Check conventional partitioning on temporal tables
@@ -267,6 +267,9 @@ x
6
delete from t1 where x < 4;
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select * from t1 partition (p0);
x
1
@@ -282,6 +285,7 @@ insert into t1 values (7), (8);
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select * from t1 partition (p1) order by x;
x
4
@@ -670,10 +674,13 @@ x
4
delete from t1 where x < 3;
delete from t1;
### warn about full partition
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^ (no matter if nothing was deleted)
select * from t1 partition (p0sp0);
x
1
@@ -849,7 +856,11 @@ partition p1 history,
partition p2 history,
partition pn current);
delete from t1 where x = 1;
# You see warning above ^
delete from t1 where x = 2;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
#
# MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
#
@@ -972,9 +983,13 @@ create or replace table t1 (x int) with system versioning partition by system_ti
lock tables t1 write;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
unlock tables;
#
# MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
@@ -1098,6 +1113,7 @@ create or replace table t1 (f char(6)) engine innodb with system versioning;
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
# You see warning above ^
create or replace view v1 as select * from t1 for system_time all;
update v1 set f = '';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -1107,6 +1123,8 @@ partition by system_time limit 1
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
create or replace view v1 as select * from t1 for system_time all;
update v1 set f= '';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -1235,8 +1253,335 @@ delete from t1;
unlock tables;
drop table t1;
set timestamp= default;
#
# MDEV-25546 LIMIT partitioning does not respect ROLLBACK
#
create or replace table t1 (pk int primary key)
with system versioning engine innodb
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_1_to_90;
start transaction;
replace into t1 select seq from seq_1_to_80;
replace into t1 select seq from seq_1_to_70;
replace into t1 select seq from seq_1_to_60;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 150
p1 60
pn 90
rollback;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 0
p1 0
pn 90
replace into t1 select seq from seq_1_to_10;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
partition_name table_rows
p0 10
p1 0
pn 90
drop table t1;
#
# MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
#
create table t1 (x int) with system versioning
partition by system_time limit 1 (
partition p0 history,
partition p1 history,
partition p2 history, # p2 just disables warning about p1 partition full
partition pn current);
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
select * from t1 partition (p0);
x
0
select * from t1 partition (p1);
x
1
select * from t1 partition (pn);
x
2
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
delete history from t1;
select * from t1 partition (p0);
x
select * from t1 partition (p1);
x
select * from t1 partition (pn);
x
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
# TRUNCATE PARTITION ALL does the same
alter table t1 truncate partition all;
select * from t1 partition (p0);
x
select * from t1 partition (p1);
x
select * from t1 partition (pn);
x
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
# TRUNCATE PARTITION deletes data from HISTORY partition
alter table t1 truncate partition p1;
select * from t1 partition (p0);
x
0
select * from t1 partition (p1);
x
select * from t1 partition (pn);
x
2
# or from CURRENT partition
alter table t1 truncate partition pn;
select * from t1 partition (p0);
x
0
select * from t1 partition (p1);
x
select * from t1 partition (pn);
x
drop table t1;
#
# MDEV-20077 Warning on full history partition is delayed until next DML statement
#
# DELETE
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_200;
# p0 is filled with 100 records (no warnings):
delete from t1 where x <= 99;
# p1 is filled with 1 + 100 records (warning is printed):
delete from t1 where x <= 100;
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
101
drop table t1;
# DELETE under LOCK TABLES
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_200;
lock tables t1 write;
# (LOCK TABLES) p0 is filled with 100 records (no warnings):
delete from t1 where x <= 99;
# (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed):
delete from t1 where x <= 100;
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
unlock tables;
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
101
drop table t1;
# DELETE multitable
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t1 select seq from seq_0_to_200;
insert into t2 select seq from seq_0_to_3;
delete t1, t2 from t1 join t2 where x < 50 and y = 0;
delete t1, t2 from t1 join t2 where x < 100 and y = 1;
delete t1, t2 from t1 join t2 where x < 150 and y = 2;
delete t1, t2 from t1 join t2;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
101
drop table t1;
# UDPATE
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
100
drop tables t1, t2;
# UPDATE multitable
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t1 select seq from seq_0_to_49;
insert into t2 values (5);
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
100
drop tables t1, t2;
# INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x <= 99;
insert into t1 values (100) on duplicate key update x= 400;
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
1
drop table t1;
# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU)
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t2 values (100);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x <= 99;
insert into t1 select * from t2 on duplicate key update x= 500;
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
1
drop tables t1, t2;
# REPLACE
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x < 99;
replace t1 values (100);
replace t1 values (100);
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
1
drop table t1;
# LOAD DATA .. REPLACE
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
select x into outfile 'MDEV-20077.data' from t1;
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
100
drop table t1;
# REPLACE .. SELECT
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
replace t1 select * from t1;
replace t1 select * from t1;
replace t1 select * from t1;
replace t1 select * from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select count(*) from t1 partition (p0);
count(*)
100
select count(*) from t1 partition (p1);
count(*)
100
drop table t1;
#
# MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
#
create table tcount (c int unsigned);
insert into tcount values (0);
create table t (f int) with system versioning
partition by system_time limit 1000
(partition p1 history, partition pn current);
insert into t values (1),(2);
create trigger tr before insert on t for each row update tcount set c = c + 1;
insert into t select * from t;
drop table tcount, t;
#
# End of 10.3 tests
#
#
# MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
#
create table t1 (a int primary key) engine=aria page_checksum=0
@@ -1268,8 +1613,10 @@ select * from t1 where i > 0 or pk = 1000 limit 1;
pk i c
1 1 a
drop table t1;
#
# End of 10.4 tests
#
#
# MDEV-22153 ALTER add default history partitions makes table inaccessible
#
create or replace table t1 (x int) with system versioning partition by system_time;
@@ -1474,6 +1821,9 @@ t1 CREATE TABLE `t1` (
PARTITIONS 6
update t1 set x= x + 1;
update t1 set x= x + 1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p4`) is out of LIMIT, need more HISTORY partitions
# You see warning above ^
select * from t1 partition (p0);
x
0
@@ -1638,6 +1988,8 @@ insert into t1 values (2), (12), (22);
update t1 set x= x + 1 where x = 2;
update t1 set x= x + 1 where x = 12;
update t1 set x= x + 1 where x = 22;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
select * from t1 partition (p1);
x
12
@@ -1860,6 +2212,9 @@ t1 CREATE TABLE `t1` (
PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
drop tables t1, tp1;
#
# End of 10.7 tests
#
#
# MDEV-17554 Auto-create new partition for system versioned tables
# with history partitioned by INTERVAL/LIMIT
#
@@ -2105,10 +2460,10 @@ affected rows: 1
update t1 set x= x + 1;
affected rows: 1
info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
update t1 set x= x + 1;
update t1 set x= x + 2;
affected rows: 1
info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
update t1 set x= x + 1;
update t1 set x= x + 3;
affected rows: 1
info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
show create table t1;
@@ -2902,4 +3257,4 @@ delete from t partition (px);
ERROR HY000: Unknown partition 'px' in table 't'
unlock tables;
drop table t;
SET GLOBAL innodb_stats_persistent=@save_persistent;
set global innodb_stats_persistent= @save_persistent;

View File

@@ -12,6 +12,44 @@ connection master;
drop table t1;
set binlog_row_image= @old_row_image;
#
# MDEV-28254 Wrong position for row_start, row_end after adding column
# to implicit versioned table
#
set @@system_versioning_alter_history= keep;
set @@session.time_zone='+00:00';
create table t1 (x int) with system versioning engine innodb;
alter table t1 add column y int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
connection slave;
drop table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
connection master;
set timestamp= 12345;
insert t1 values (1, 1);
select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
x y row_start row_end
1 1 12345.000000 2147483647.999999
set timestamp= default;
### INSERT INTO `test`.`t1`
### SET
### @1=1
### @2=1
### @3=12345.000000
### @4=2147483647.999999
connection slave;
select * from t1;
x y
1 1
connection master;
drop table t1;
#
# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
#
flush binary logs;

View File

@@ -63,8 +63,8 @@ partition by system_time limit 1 partitions 3;
insert into t values (1);
update t set a= 2;
update t set a= 3;
--echo # You see warning above ^
delete history from t;
--echo # The above warning is one command late (MDEV-20345) ^^^
select * from t for system_time all;
--echo # VIEW

View File

@@ -1,9 +1,10 @@
-- source include/have_partition.inc
-- source suite/versioning/common.inc
-- source suite/versioning/engines.inc
-- source include/have_sequence.inc
SET @save_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
set @save_persistent=@@global.innodb_stats_persistent;
set global innodb_stats_persistent= 0;
call mtr.add_suppression("need more HISTORY partitions");
@@ -241,12 +242,14 @@ insert into t1 values (1), (2), (3), (4), (5), (6);
select * from t1 partition (pn);
delete from t1 where x < 4;
delete from t1;
--echo # You see warning above ^
select * from t1 partition (p0);
select * from t1 partition (p1);
insert into t1 values (7), (8);
--echo ### warn about full partition
delete from t1;
--echo # You see warning above ^
select * from t1 partition (p1) order by x;
--echo #
@@ -509,8 +512,9 @@ select * from t1 partition (pnsp1);
delete from t1 where x < 3;
delete from t1;
--echo ### warn about full partition
--echo # You see warning above ^
delete from t1;
--echo # You see warning above ^ (no matter if nothing was deleted)
select * from t1 partition (p0sp0);
select * from t1 partition (p0sp1);
select * from t1 partition (p1sp0);
@@ -686,7 +690,9 @@ alter table t1 partition by system_time limit 1 (
partition p2 history,
partition pn current);
delete from t1 where x = 1;
--echo # You see warning above ^
delete from t1 where x = 2;
--echo # You see warning above ^
--echo #
--echo # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
@@ -814,7 +820,9 @@ create or replace table t1 (x int) with system versioning partition by system_ti
lock tables t1 write;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
--echo # You see warning above ^
delete from t1;
--echo # You see warning above ^
unlock tables;
--echo #
@@ -929,6 +937,7 @@ create or replace table t1 (f char(6)) engine innodb with system versioning;
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
--echo # You see warning above ^
create or replace view v1 as select * from t1 for system_time all;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
@@ -1089,7 +1098,312 @@ delete from t1;
unlock tables;
drop table t1;
set timestamp= default;
--echo #
--echo # MDEV-25546 LIMIT partitioning does not respect ROLLBACK
--echo #
create or replace table t1 (pk int primary key)
with system versioning engine innodb
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_1_to_90;
start transaction;
# Puts 80 rows into p0
replace into t1 select seq from seq_1_to_80;
# Puts another 70 rows into p0
replace into t1 select seq from seq_1_to_70;
# Puts 60 rows into p1
replace into t1 select seq from seq_1_to_60;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
rollback;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
# Should put 10 rows into the empty partition p0
replace into t1 select seq from seq_1_to_10;
select partition_name, table_rows
from information_schema.partitions
where table_name = 't1';
# Cleanup
drop table t1;
--echo #
--echo # MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
--echo #
create table t1 (x int) with system versioning
partition by system_time limit 1 (
partition p0 history,
partition p1 history,
partition p2 history, # p2 just disables warning about p1 partition full
partition pn current);
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (pn);
delete from t1;
delete history from t1;
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (pn);
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
--echo # TRUNCATE PARTITION ALL does the same
alter table t1 truncate partition all;
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (pn);
insert into t1 values (0);
update t1 set x= x + 1;
update t1 set x= x + 1;
--echo # TRUNCATE PARTITION deletes data from HISTORY partition
alter table t1 truncate partition p1;
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (pn);
--echo # or from CURRENT partition
alter table t1 truncate partition pn;
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (pn);
drop table t1;
--echo #
--echo # MDEV-20077 Warning on full history partition is delayed until next DML statement
--echo #
--echo # DELETE
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_200;
--echo # p0 is filled with 100 records (no warnings):
delete from t1 where x <= 99;
--echo # p1 is filled with 1 + 100 records (warning is printed):
delete from t1 where x <= 100;
delete from t1;
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo # DELETE under LOCK TABLES
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_200;
lock tables t1 write;
--echo # (LOCK TABLES) p0 is filled with 100 records (no warnings):
delete from t1 where x <= 99;
--echo # (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed):
delete from t1 where x <= 100;
delete from t1;
--echo # You see warning above ^
unlock tables;
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo # DELETE multitable
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t1 select seq from seq_0_to_200;
insert into t2 select seq from seq_0_to_3;
delete t1, t2 from t1 join t2 where x < 50 and y = 0;
delete t1, t2 from t1 join t2 where x < 100 and y = 1;
delete t1, t2 from t1 join t2 where x < 150 and y = 2;
delete t1, t2 from t1 join t2;
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo # UDPATE
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 1;
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop tables t1, t2;
--echo # UPDATE multitable
create table t1 (x int) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t1 select seq from seq_0_to_49;
insert into t2 values (5);
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
update t1, t2 set x= x + 1;
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop tables t1, t2;
--echo # INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x <= 99;
insert into t1 values (100) on duplicate key update x= 400;
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo # INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU)
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
create table t2 (y int);
insert into t2 values (100);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x <= 99;
insert into t1 select * from t2 on duplicate key update x= 500;
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop tables t1, t2;
--echo # REPLACE
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_100;
delete from t1 where x < 99;
replace t1 values (100);
replace t1 values (100);
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo # LOAD DATA .. REPLACE
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
select x into outfile 'MDEV-20077.data' from t1;
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
load data infile 'MDEV-20077.data' replace into table t1 (x);
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--remove_file $datadir/test/MDEV-20077.data
--echo # REPLACE .. SELECT
create table t1 (x int primary key) with system versioning
partition by system_time limit 100 (
partition p0 history,
partition p1 history,
partition pn current);
insert into t1 select seq from seq_0_to_49;
replace t1 select * from t1;
replace t1 select * from t1;
replace t1 select * from t1;
replace t1 select * from t1;
--echo # You see warning above ^
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
--echo #
--echo # MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
--echo #
create table tcount (c int unsigned);
insert into tcount values (0);
create table t (f int) with system versioning
partition by system_time limit 1000
(partition p1 history, partition pn current);
insert into t values (1),(2);
create trigger tr before insert on t for each row update tcount set c = c + 1;
insert into t select * from t;
# cleanup
drop table tcount, t;
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
@@ -1121,7 +1435,9 @@ replace into t1 select * from t1;
select * from t1 where i > 0 or pk = 1000 limit 1;
drop table t1;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # MDEV-22153 ALTER add default history partitions makes table inaccessible
@@ -1232,6 +1548,7 @@ alter table t1 partition by system_time limit 1;
show create table t1;
update t1 set x= x + 1;
update t1 set x= x + 1;
--echo # You see warning above ^
select * from t1 partition (p0);
select * from t1 partition (p1);
select * from t1 partition (p2);
@@ -1442,6 +1759,10 @@ show create table t1;
drop tables t1, tp1;
}
--echo #
--echo # End of 10.7 tests
--echo #
--echo #
--echo # MDEV-17554 Auto-create new partition for system versioned tables
--echo # with history partitioned by INTERVAL/LIMIT
@@ -1592,8 +1913,8 @@ partition by system_time limit 1 auto;
lock tables t1 write;
insert into t1 values (1);
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 1;
update t1 set x= x + 2;
update t1 set x= x + 3;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
unlock tables;
@@ -2177,5 +2498,6 @@ unlock tables;
drop table t;
--disable_prepare_warnings
SET GLOBAL innodb_stats_persistent=@save_persistent;
set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc

View File

@@ -1,5 +1,6 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc
--echo # MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables
set @old_row_image= @@binlog_row_image;
@@ -15,4 +16,44 @@ update t1 set i = 0;
drop table t1;
set binlog_row_image= @old_row_image;
--echo #
--echo # MDEV-28254 Wrong position for row_start, row_end after adding column
--echo # to implicit versioned table
--echo #
--let TMP= $MYSQLTEST_VARDIR/tmp
--let $MYSQLD_DATADIR= `select @@datadir`
set @@system_versioning_alter_history= keep;
set @@session.time_zone='+00:00';
create table t1 (x int) with system versioning engine innodb;
alter table t1 add column y int, algorithm=inplace;
check table t1;
--exec $MYSQL_DUMP --databases test > $TMP/dump.sql
--sync_slave_with_master
drop table t1;
--exec $MYSQL_SLAVE test < $TMP/dump.sql
show create table t1;
--connection master
set timestamp= 12345;
--let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
insert t1 values (1, 1);
select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
--let $stop_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
set timestamp= default;
# NOTE: pipe grep is not Windows-compatible
--let grep_file= $TMP/out.txt
--let grep_regex= ^###
--exec $MYSQL_BINLOG -v -j $start_pos --stop-position=$stop_pos -o 3 $MYSQLD_DATADIR/master-bin.000001 > $grep_file
--source include/grep.inc
--sync_slave_with_master
select * from t1;
--connection master
drop table t1;
--remove_files_wildcard $TMP *.txt
--remove_files_wildcard $TMP *.sql
--source rpl_common.inc