diff options
Diffstat (limited to 'mysql-test/suite/versioning/t')
-rw-r--r-- | mysql-test/suite/versioning/t/partition.combinations | 5 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/partition.test | 40 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/partition_innodb.test | 80 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/rpl.test | 44 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/rpl_row.test | 18 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/trx_id.test | 10 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/update.test | 20 |
7 files changed, 169 insertions, 48 deletions
diff --git a/mysql-test/suite/versioning/t/partition.combinations b/mysql-test/suite/versioning/t/partition.combinations deleted file mode 100644 index 4d73ef5a5ea..00000000000 --- a/mysql-test/suite/versioning/t/partition.combinations +++ /dev/null @@ -1,5 +0,0 @@ -[timestamp] -default-storage-engine=innodb - -[myisam] -default-storage-engine=myisam diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index d9e784b082b..88411468516 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1,10 +1,16 @@ -- source include/have_partition.inc -- source suite/versioning/common.inc +-- source suite/versioning/engines.inc set system_versioning_alter_history=keep; --echo # Check conventional partitioning on temporal tables -create table t1 (x int) +--replace_result $sys_datatype_expl SYS_DATATYPE +eval create or replace table t1 ( + x int, + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time(row_start, row_end)) with system versioning partition by range columns (x) ( partition p0 values less than (100), @@ -24,8 +30,14 @@ select * from t1 partition (p0) for system_time all; select * from t1 partition (p1) for system_time all; --echo # Engine change native <-> non-native versioning prohibited ---replace_result $default_engine DEFAULT_ENGINE -eval create or replace table t1 (i int) engine=$default_engine with system versioning partition by hash(i); +--replace_result $sys_datatype_expl SYS_DATATYPE $default_engine DEFAULT_ENGINE +eval create or replace table t1 ( + i int, + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time(row_start, row_end)) +engine=$default_engine +with system versioning partition by hash(i); --replace_result $non_default_engine NON_DEFAULT_ENGINE --error ER_VERS_ALTER_ENGINE_PROHIBITED eval alter table t1 engine=$non_default_engine; @@ -273,15 +285,24 @@ select * from t1 partition (p0sp1); select * from t1 partition (p1sp0); select * from t1 partition (p1sp1); -create or replace table t1 (a bigint) +--replace_result $sys_datatype_expl SYS_DATATYPE +eval create or replace table t1 ( + a bigint, + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time(row_start, row_end)) with system versioning partition by range (a) (partition p0 values less than (20) engine innodb, partition p1 values less than maxvalue engine innodb); insert into t1 values (1); -create or replace table t1 ( - f_int1 integer default 0 +--replace_result $sys_datatype_expl SYS_DATATYPE +eval create or replace table t1 ( + f_int1 integer default 0, + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time(row_start, row_end) ) with system versioning partition by range(f_int1) subpartition by hash(f_int1) @@ -291,7 +312,12 @@ subpartition subpart12 storage engine = 'innodb')); insert into t1 values (1); create or replace table t1 (i int) engine=innodb partition by key(i); -alter table t1 add system versioning; +--replace_result $sys_datatype_expl SYS_DATATYPE +eval alter table t1 + add column row_start $sys_datatype_expl as row start invisible, + add column row_end $sys_datatype_expl as row end invisible, + add period for system_time(row_start, row_end), + add system versioning; insert into t1 values(); --echo # MDEV-14722 Assertion in ha_commit_trans for sub-statement diff --git a/mysql-test/suite/versioning/t/partition_innodb.test b/mysql-test/suite/versioning/t/partition_innodb.test new file mode 100644 index 00000000000..bb4fe50ce91 --- /dev/null +++ b/mysql-test/suite/versioning/t/partition_innodb.test @@ -0,0 +1,80 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning +--echo # currently trx_id does not support partitioning by system_time +--error ER_VERS_FIELD_WRONG_TYPE +create or replace table t1( + i int, + row_start bigint unsigned generated always as row start, + row_end bigint unsigned generated always as row end, + period for system_time(row_start, row_end) +) engine=InnoDB with system versioning partition by system_time ( + partition p0 history, + partition pn current +); + +create or replace table t1( + i int, + row_start bigint unsigned generated always as row start, + row_end bigint unsigned generated always as row end, + period for system_time(row_start, row_end) +) engine=InnoDB with system versioning; + +--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ +--error ER_VERS_FIELD_WRONG_TYPE +alter table t1 partition by system_time ( + partition p0 history, + partition pn current +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key() ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by key(a, row_start) ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by hash(a + row_end * 2) ( + partition p1, + partition p2 +); + +--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED +create or replace table t ( + a int primary key, + row_start bigint unsigned as row start invisible, + row_end bigint unsigned as row end invisible, + period for system_time(row_start, row_end) +) engine=innodb with system versioning +partition by range columns (a, row_start) ( + partition p1 values less than (100, 100) +); + +--echo # Test cleanup +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index a9e3af45af8..e59d41c38a3 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -14,24 +14,24 @@ let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_updat connection master; CREATE TABLE t1 (x int) with system versioning; insert into t1 values (1); -SELECT * FROM t1; +select * from t1 order by x; delete from t1; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; connection master; insert into t1 values (2); sync_slave_with_master; -select * from t1; +select * from t1 order by x; connection master; update t1 set x = 3; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; --echo # check unversioned -> versioned replication connection master; @@ -42,20 +42,20 @@ alter table t1 with system versioning; connection master; insert into t1 values (1); sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; connection master; update t1 set x= 2 where x = 1; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; connection master; delete from t1; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; --echo # same thing (UPDATE, DELETE), but without PK connection master; @@ -67,14 +67,14 @@ connection master; insert into t1 values (1); update t1 set x= 2 where x = 1; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; connection master; delete from t1; sync_slave_with_master; -select * from t1; -select * from t1 for system_time all; +select * from t1 order by x; +select * from t1 for system_time all order by row_end, x; --echo # multi-update connection master; @@ -84,10 +84,10 @@ insert into t1 values (1); insert into t2 values (2); update t1, t2 set t1.x=11, t2.x=22; sync_slave_with_master; -select * from t1; -select * from t2; -select * from t1 for system_time all; -select * from t2 for system_time all; +select * from t1 order by x; +select * from t2 order by x; +select * from t1 for system_time all order by row_end, x; +select * from t2 for system_time all order by row_end, x; --echo # MDEV-14767 system_versioning_alter_history breaks ALTER replication --echo ## Case 1: KEEP on the master, ALTER will work on the slave diff --git a/mysql-test/suite/versioning/t/rpl_row.test b/mysql-test/suite/versioning/t/rpl_row.test new file mode 100644 index 00000000000..17ce2dfdcf8 --- /dev/null +++ b/mysql-test/suite/versioning/t/rpl_row.test @@ -0,0 +1,18 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo # MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables +set @old_row_image= @@binlog_row_image; +set binlog_row_image= minimal; + +create or replace table t1 (pk int, i int, primary key(pk)) +with system versioning; +insert into t1 values (1,10),(2,20); +update t1 set i = 0; + +--sync_slave_with_master +--connection master +drop table t1; +set binlog_row_image= @old_row_image; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index 885455a6977..b0691e4580c 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -361,18 +361,20 @@ SELECT * FROM t2 FOR SYSTEM_TIME AS OF '2038-12-30 00:00:00'; --echo # HEX hybrids resolve to TRANSACTION --echo # -SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0x60); +--error ER_VERS_NO_TRX_ID +SELECT * FROM t1 FOR SYSTEM_TIME AS OF (0xFFFFFFFF); --error ER_VERS_ENGINE_UNSUPPORTED -SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0x60); +SELECT * FROM t2 FOR SYSTEM_TIME AS OF (0xFFFFFFFF); --echo # --echo # BIT literals resolve to TRANSACTION --echo # -SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'1100000'); +--error ER_VERS_NO_TRX_ID +SELECT * FROM t1 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111'); --error ER_VERS_ENGINE_UNSUPPORTED -SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'1100000'); +SELECT * FROM t2 FOR SYSTEM_TIME AS OF (b'11111111111111111111111111111111'); DROP TABLE t1, t2; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 67d7db952ae..95c844c88a2 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -11,10 +11,10 @@ eval create table t1( with system versioning; insert into t1(x, y) values (1, 1000), (2, 2000), (3, 3000), (4, 4000), (5, 5000), (6, 6000), (7, 7000), (8, 8000), (9, 9000); -select x, y from t1; +select x, y from t1 order by x, y; update t1 set y = y + 1 where x > 7; -select x, y from t1; -select x, y from t1 for system_time all; +select x, y from t1 order by x, y; +select x, y from t1 for system_time all order by sys_trx_end, x, y; drop table t1; replace_result $sys_datatype_expl SYS_DATATYPE; @@ -56,7 +56,7 @@ update t1 set y= y + 1 where x > 4; commit; replace_result $sys_datatype_max MAXVAL; -eval select x, y, sys_trx_end = $sys_datatype_max as current from t1 for system_time all; +eval select x, y, sys_trx_end = $sys_datatype_max as current from t1 for system_time all order by sys_trx_end, x, y; drop table t1; @@ -95,8 +95,8 @@ with system versioning; insert into t1(x, y) values (1, 1000), (3, 3000), (4, 4000), (5, 5000); insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1; insert into t1(x, y) values(4, 4444) on duplicate key update y = y+1; -select x, y from t1 for system_time all; -select x, y from t1; +select x, y from t1 for system_time all order by sys_trx_end, x, y; +select x, y from t1 order by x, y; drop table t1; replace_result $sys_datatype_expl SYS_DATATYPE; @@ -111,10 +111,10 @@ create table t2 like t1; insert into t1(x, y) values (1, 1000), (2, 2000), (3, 3000), (4, 4000), (5, 5000), (6, 6000), (7, 7000), (8, 8000), (9, 9000); insert into t2(x, y) values (1, 1010), (2, 2010), (3, 3010), (4, 4010), (5, 5010), (6, 6010), (7, 7010), (8, 8010), (9, 9010); update t1, t2 set t1.y = t1.x + t1.y, t2.y = t2.x + t2.y where t1.x > 7 and t2.x < 7; -select x, y from t1 for system_time all; -select x, y from t1; -select x, y from t2 for system_time all; -select x, y from t2; +select x, y from t1 for system_time all order by sys_trx_end, x, y; +select x, y from t1 order by x, y; +select x, y from t2 for system_time all order by sys_trx_end, x, y; +select x, y from t2 order by x, y; drop table t1; drop table t2; |