Commit f6ee1324 authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Sergei Golubchik

Versioning tests stability improvement

Fix SELECT resultset order.
parent 8df04fb8
......@@ -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);
......@@ -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
......@@ -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;
......@@ -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;
......
--- 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
......@@ -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
......@@ -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
......@@ -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
......@@ -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,
......@@ -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,
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment