Skip to content

Commit

Permalink
Versioning tests stability improvement
Browse files Browse the repository at this point in the history
Fix SELECT resultset order.
  • Loading branch information
midenok authored and vuvova committed Mar 29, 2019
1 parent 8df04fb commit f6ee132
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 93 deletions.
54 changes: 27 additions & 27 deletions mysql-test/suite/versioning/r/rpl.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@ connection slave;
connection master;
CREATE TABLE t1 (x int) with system versioning;
insert into t1 values (1);
SELECT * FROM t1;
select * from t1 order by x;
x
1
delete from t1;
select * from t1;
select * from t1 order by x;
x
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
connection slave;
select * from t1;
select * from t1 order by x;
x
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
connection master;
insert into t1 values (2);
connection slave;
select * from t1;
select * from t1 order by x;
x
2
connection master;
update t1 set x = 3;
connection slave;
select * from t1;
select * from t1 order by x;
x
3
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
3
2
3
# check unversioned -> versioned replication
connection master;
create or replace table t1 (x int primary key);
Expand All @@ -44,28 +44,28 @@ alter table t1 with system versioning;
connection master;
insert into t1 values (1);
connection slave;
select * from t1;
select * from t1 order by x;
x
1
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
connection master;
update t1 set x= 2 where x = 1;
connection slave;
select * from t1;
select * from t1 order by x;
x
2
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
2
connection master;
delete from t1;
connection slave;
select * from t1;
select * from t1 order by x;
x
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
1
2
Expand All @@ -78,22 +78,22 @@ connection master;
insert into t1 values (1);
update t1 set x= 2 where x = 1;
connection slave;
select * from t1;
select * from t1 order by x;
x
2
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
2
1
2
connection master;
delete from t1;
connection slave;
select * from t1;
select * from t1 order by x;
x
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
2
1
2
# multi-update
connection master;
create or replace table t1 (x int) with system versioning;
Expand All @@ -102,20 +102,20 @@ insert into t1 values (1);
insert into t2 values (2);
update t1, t2 set t1.x=11, t2.x=22;
connection slave;
select * from t1;
select * from t1 order by x;
x
11
select * from t2;
select * from t2 order by x;
x
22
select * from t1 for system_time all;
select * from t1 for system_time all order by row_end, x;
x
11
1
select * from t2 for system_time all;
11
select * from t2 for system_time all order by row_end, x;
x
22
2
22
# MDEV-14767 system_versioning_alter_history breaks ALTER replication
## Case 1: KEEP on the master, ALTER will work on the slave
connection master;
Expand Down
19 changes: 11 additions & 8 deletions mysql-test/suite/versioning/r/update,trx_id.rdiff
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
--- suite/versioning/r/update.result
+++ suite/versioning/r/update.reject
@@ -88,10 +88,8 @@
5 3 1
3 1 0
--- update.result 2018-12-19 13:55:35.873917389 +0300
+++ update,trx_id.reject 2018-12-19 13:55:35.533917399 +0300
@@ -81,12 +81,10 @@
commit;
select x, y, sys_trx_end = MAXVAL as current from t1 for system_time all order by sys_trx_end, x, y;
x y current
-3 1 0
2 1 0
-3 2 0
+3 1 0
4 1 0
5 1 0
-5 2 0
drop table t1;
create table t1 (
id int primary key auto_increment,
1 1 1
2 2 1
3 3 1
52 changes: 26 additions & 26 deletions mysql-test/suite/versioning/r/update.result
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sys_trx_end SYS_DATATYPE as row end invisible,
period for system_time (sys_trx_start, sys_trx_end))
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;
x y
1 1000
2 2000
Expand All @@ -18,7 +18,7 @@ x y
8 8000
9 9000
update t1 set y = y + 1 where x > 7;
select x, y from t1;
select x, y from t1 order by x, y;
x y
1 1000
2 2000
Expand All @@ -29,8 +29,10 @@ x y
7 7000
8 8001
9 9001
select x, y from t1 for system_time all;
select x, y from t1 for system_time all order by sys_trx_end, x, y;
x y
8 8000
9 9000
1 1000
2 2000
3 3000
Expand All @@ -40,8 +42,6 @@ x y
7 7000
8 8001
9 9001
8 8000
9 9000
drop table t1;
create table t1 (
id bigint primary key,
Expand Down Expand Up @@ -79,19 +79,19 @@ update t1 set y= y + 1 where x = 3;
update t1 set y= y + 1 where x > 3;
update t1 set y= y + 1 where x > 4;
commit;
select x, y, sys_trx_end = MAXVAL as current from t1 for system_time all;
select x, y, sys_trx_end = MAXVAL as current from t1 for system_time all order by sys_trx_end, x, y;
x y current
1 1 1
2 2 1
3 3 1
4 2 1
5 3 1
3 1 0
2 1 0
3 2 0
4 1 0
5 1 0
5 2 0
1 1 1
2 2 1
3 3 1
4 2 1
5 3 1
drop table t1;
create table t1 (
id int primary key auto_increment,
Expand Down Expand Up @@ -129,15 +129,15 @@ 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 for system_time all order by sys_trx_end, x, y;
x y
1 1000
3 3000
1 1000
3 3001
4 4000
4 4444
5 5000
select x, y from t1;
select x, y from t1 order by x, y;
x y
1 1000
3 3001
Expand All @@ -156,8 +156,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 for system_time all order by sys_trx_end, x, y;
x y
8 8000
9 9000
1 1000
2 2000
3 3000
Expand All @@ -167,9 +169,7 @@ x y
7 7000
8 8008
9 9009
8 8000
9 9000
select x, y from t1;
select x, y from t1 order by x, y;
x y
1 1000
2 2000
Expand All @@ -180,8 +180,14 @@ x y
7 7000
8 8008
9 9009
select x, y from t2 for system_time all;
select x, y from t2 for system_time all order by sys_trx_end, x, y;
x y
1 1010
2 2010
3 3010
4 4010
5 5010
6 6010
1 1011
2 2012
3 3013
Expand All @@ -191,13 +197,7 @@ x y
7 7010
8 8010
9 9010
1 1010
2 2010
3 3010
4 4010
5 5010
6 6010
select x, y from t2;
select x, y from t2 order by x, y;
x y
1 1011
2 2012
Expand Down
44 changes: 22 additions & 22 deletions mysql-test/suite/versioning/t/rpl.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down
Loading

0 comments on commit f6ee132

Please sign in to comment.