Commit b75d8453 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-14868 MariaDB server crashes after using ROLLBACK TO when encrypt_tmp_files=ON

add a test that restores the data from a binlog
parent 60dfe12b
...@@ -28,6 +28,7 @@ h 10 ...@@ -28,6 +28,7 @@ h 10
i 10 i 10
j 10 j 10
drop table t1; drop table t1;
reset master;
set global binlog_cache_size=8192; set global binlog_cache_size=8192;
create table t1 (a text) engine=innodb; create table t1 (a text) engine=innodb;
start transaction; start transaction;
...@@ -36,14 +37,67 @@ commit; ...@@ -36,14 +37,67 @@ commit;
start transaction; start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_8; insert t1 select repeat(seq, 1000) from seq_1_to_8;
commit; commit;
drop table t1; create table t2 (a text) engine=innodb;
create table t1 (a text) engine=innodb;
start transaction; start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_15; insert t2 select repeat(seq, 1000) from seq_1_to_15;
savepoint foo; savepoint foo;
insert t1 select repeat(seq, 1000) from seq_16_to_30; insert t2 select repeat(seq, 1000) from seq_16_to_30;
rollback to savepoint foo; rollback to savepoint foo;
insert t1 select repeat(seq, 1000) from seq_31_to_40; insert t2 select repeat(seq, 1000) from seq_31_to_40;
commit; commit;
drop table t1; flush binary logs;
drop table t1, t2;
set global binlog_cache_size=default; set global binlog_cache_size=default;
select left(a, 10) from t1;
left(a, 10)
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
1010101010
1111111111
1212121212
1313131313
1414141414
1515151515
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
select left(a, 10) from t2;
left(a, 10)
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666
7777777777
8888888888
9999999999
1010101010
1111111111
1212121212
1313131313
1414141414
1515151515
3131313131
3232323232
3333333333
3434343434
3535353535
3636363636
3737373737
3838383838
3939393939
4040404040
drop table t1, t2;
...@@ -33,6 +33,7 @@ update t1 set c=v, t=v; ...@@ -33,6 +33,7 @@ update t1 set c=v, t=v;
select sql_big_result t,count(t) from t1 group by t limit 10; select sql_big_result t,count(t) from t1 group by t limit 10;
drop table t1; drop table t1;
reset master;
set global binlog_cache_size=8192; set global binlog_cache_size=8192;
connect con1, localhost, root; connect con1, localhost, root;
...@@ -50,7 +51,6 @@ commit; ...@@ -50,7 +51,6 @@ commit;
start transaction; start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_8; insert t1 select repeat(seq, 1000) from seq_1_to_8;
commit; commit;
drop table t1;
disconnect con1; disconnect con1;
connect con2, localhost, root; connect con2, localhost, root;
...@@ -60,17 +60,27 @@ connect con2, localhost, root; ...@@ -60,17 +60,27 @@ connect con2, localhost, root;
# Start a transaction, write until the cache goes to disk, # Start a transaction, write until the cache goes to disk,
# create a savepoint, write more blocks to disk, rollback to savepoint. # create a savepoint, write more blocks to disk, rollback to savepoint.
# #
create table t1 (a text) engine=innodb; create table t2 (a text) engine=innodb;
start transaction; start transaction;
insert t1 select repeat(seq, 1000) from seq_1_to_15; insert t2 select repeat(seq, 1000) from seq_1_to_15;
savepoint foo; savepoint foo;
insert t1 select repeat(seq, 1000) from seq_16_to_30; insert t2 select repeat(seq, 1000) from seq_16_to_30;
rollback to savepoint foo; rollback to savepoint foo;
insert t1 select repeat(seq, 1000) from seq_31_to_40; insert t2 select repeat(seq, 1000) from seq_31_to_40;
commit; commit;
drop table t1;
disconnect con2; disconnect con2;
connection default; connection default;
flush binary logs;
drop table t1, t2;
set global binlog_cache_size=default; set global binlog_cache_size=default;
let $MYSQLD_DATADIR= `select @@datadir`;
exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL;
select left(a, 10) from t1;
select left(a, 10) from t2;
drop table t1, 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