MDEV-35808 Test case to handle undo tablespace truncation in Mariabackup
This is the test case from commit 46aaf328ce424aededdb61e59a48db05630563d5 (MDEV-35830) to cover backup_undo_trunc() in the regression tests of earlier major versions of mariadb-backup.
This commit is contained in:
parent
1327f40f96
commit
fe2f237768
4
mysql-test/suite/mariabackup/undo_truncate.combinations
Normal file
4
mysql-test/suite/mariabackup/undo_truncate.combinations
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[clear]
|
||||||
|
--innodb-encrypt-log=OFF
|
||||||
|
[crypt]
|
||||||
|
--innodb-encrypt-log=ON
|
6
mysql-test/suite/mariabackup/undo_truncate.opt
Normal file
6
mysql-test/suite/mariabackup/undo_truncate.opt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--innodb-undo-tablespaces=2
|
||||||
|
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||||
|
--loose-file-key-management
|
||||||
|
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
|
||||||
|
--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc
|
||||||
|
--loose-file-key-management-encryption-algorithm=aes_cbc
|
39
mysql-test/suite/mariabackup/undo_truncate.result
Normal file
39
mysql-test/suite/mariabackup/undo_truncate.result
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
SET GLOBAL innodb_undo_log_truncate = 0;
|
||||||
|
create table t1 (keyc int primary key default 0, c char(6)) engine=innodb;
|
||||||
|
create table t2 (keyc int primary key default 0, c char(6)) engine=innodb;
|
||||||
|
CREATE PROCEDURE p(t VARCHAR(64))
|
||||||
|
BEGIN
|
||||||
|
DECLARE i TEXT DEFAULT 'insert into t1 select seq,repeat(chr(48),6)
|
||||||
|
from seq_1_to_20000';
|
||||||
|
DECLARE u1 TEXT DEFAULT 'update t1 set c=repeat(chr(32),6)';
|
||||||
|
DECLARE u2 TEXT DEFAULT 'update t1 set c=repeat(chr(64),6)';
|
||||||
|
EXECUTE IMMEDIATE REPLACE(i,'t1', t);
|
||||||
|
EXECUTE IMMEDIATE REPLACE(u1,'t1', t);
|
||||||
|
EXECUTE IMMEDIATE REPLACE(u2,'t1', t);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
connect con1,localhost,root,,;
|
||||||
|
begin;
|
||||||
|
call p('t1');
|
||||||
|
connection default;
|
||||||
|
call p('t2');
|
||||||
|
connection con1;
|
||||||
|
commit;
|
||||||
|
disconnect con1;
|
||||||
|
connection default;
|
||||||
|
DROP PROCEDURE p;
|
||||||
|
SET GLOBAL innodb_undo_log_truncate = 1;
|
||||||
|
SET GLOBAL innodb_max_undo_log_size=DEFAULT;
|
||||||
|
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||||
|
# Prepare full backup
|
||||||
|
# shutdown server
|
||||||
|
# remove datadir
|
||||||
|
# xtrabackup move back
|
||||||
|
# restart
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
20000
|
||||||
|
select count(*) from t2;
|
||||||
|
count(*)
|
||||||
|
20000
|
||||||
|
DROP TABLE t1,t2;
|
59
mysql-test/suite/mariabackup/undo_truncate.test
Normal file
59
mysql-test/suite/mariabackup/undo_truncate.test
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
--source include/have_sequence.inc
|
||||||
|
--source include/have_file_key_management.inc
|
||||||
|
|
||||||
|
SET GLOBAL innodb_undo_log_truncate = 0;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Perform DML action using multiple clients and multiple undo tablespace.
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (keyc int primary key default 0, c char(6)) engine=innodb;
|
||||||
|
create table t2 (keyc int primary key default 0, c char(6)) engine=innodb;
|
||||||
|
|
||||||
|
DELIMITER $$;
|
||||||
|
CREATE PROCEDURE p(t VARCHAR(64))
|
||||||
|
BEGIN
|
||||||
|
DECLARE i TEXT DEFAULT 'insert into t1 select seq,repeat(chr(48),6)
|
||||||
|
from seq_1_to_20000';
|
||||||
|
DECLARE u1 TEXT DEFAULT 'update t1 set c=repeat(chr(32),6)';
|
||||||
|
DECLARE u2 TEXT DEFAULT 'update t1 set c=repeat(chr(64),6)';
|
||||||
|
EXECUTE IMMEDIATE REPLACE(i,'t1', t);
|
||||||
|
EXECUTE IMMEDIATE REPLACE(u1,'t1', t);
|
||||||
|
EXECUTE IMMEDIATE REPLACE(u2,'t1', t);
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
DELIMITER ;$$
|
||||||
|
|
||||||
|
connect (con1,localhost,root,,);
|
||||||
|
begin;
|
||||||
|
send call p('t1');
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
call p('t2');
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
reap;
|
||||||
|
commit;
|
||||||
|
disconnect con1;
|
||||||
|
connection default;
|
||||||
|
DROP PROCEDURE p;
|
||||||
|
|
||||||
|
SET GLOBAL innodb_undo_log_truncate = 1;
|
||||||
|
SET GLOBAL innodb_max_undo_log_size=DEFAULT;
|
||||||
|
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||||
|
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||||
|
|
||||||
|
--disable_result_log
|
||||||
|
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$targetdir --throttle=1000;
|
||||||
|
--echo # Prepare full backup
|
||||||
|
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
source include/restart_and_restore.inc;
|
||||||
|
select count(*) from t1;
|
||||||
|
select count(*) from t2;
|
||||||
|
# Cleanup
|
||||||
|
rmdir $targetdir;
|
||||||
|
DROP TABLE t1,t2;
|
Loading…
x
Reference in New Issue
Block a user