diff options
author | Vlad Lesin <vlad_lesin@mail.ru> | 2020-04-03 00:43:09 +0300 |
---|---|---|
committer | Vlad Lesin <vlad_lesin@mail.ru> | 2020-04-07 15:05:38 +0300 |
commit | 5836191c8f0658d5d75484766fdcc3d838b0a5c1 (patch) | |
tree | f55ca1a7ea0d0dbdf0757bb18bd9fd6d1f651081 /mysql-test/suite/mariabackup | |
parent | cd88a606f5c50db2c6ffe79c8a1a2fa00c06d4c4 (diff) | |
download | mariadb-git-5836191c8f0658d5d75484766fdcc3d838b0a5c1.tar.gz |
MDEV-21168: Active XA transactions stop slave from working after backup
was restored.
Optionally rollback prepared XA's on "mariabackup --prepare".
The fix MUST NOT be ported on 10.5+, as MDEV-742 fix solves the issue for
slaves.
Diffstat (limited to 'mysql-test/suite/mariabackup')
-rw-r--r-- | mysql-test/suite/mariabackup/innodb_xa_rollback.result | 45 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/innodb_xa_rollback.test | 77 |
2 files changed, 122 insertions, 0 deletions
diff --git a/mysql-test/suite/mariabackup/innodb_xa_rollback.result b/mysql-test/suite/mariabackup/innodb_xa_rollback.result new file mode 100644 index 00000000000..cd5e2cd39a9 --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_xa_rollback.result @@ -0,0 +1,45 @@ +CALL mtr.add_suppression("Found 1 prepared XA transactions"); +RESET MASTER; +CREATE TABLE t1 (a INT) ENGINE=INNODB; +XA START 'test1'; +INSERT t1 VALUES (10); +XA END 'test1'; +XA PREPARE 'test1'; +XA RECOVER; +formatID gtrid_length bqual_length data +1 5 0 test1 +# xtrabackup backup +XA ROLLBACK 'test1'; +# xtrabackup prepare and rollback prepared XA +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +XA RECOVER; +formatID gtrid_length bqual_length data +# xtrabackup prepare and DO NOT rollback prepared XA +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +XA RECOVER; +formatID gtrid_length bqual_length data +1 5 0 test1 +XA ROLLBACK 'test1'; +# xtrabackup prepare for export and rollback prepared XA +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +XA RECOVER; +formatID gtrid_length bqual_length data +# xtrabackup prepare for export and DO NOT rollback prepared XA +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +XA RECOVER; +formatID gtrid_length bqual_length data +1 5 0 test1 +XA ROLLBACK 'test1'; +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/innodb_xa_rollback.test b/mysql-test/suite/mariabackup/innodb_xa_rollback.test new file mode 100644 index 00000000000..f8ba5ea8cfa --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_xa_rollback.test @@ -0,0 +1,77 @@ +# +# Optionally rollback prepared XA when backup is prepared +# +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc + +CALL mtr.add_suppression("Found 1 prepared XA transactions"); + +RESET MASTER; + +let targetdir1=$MYSQLTEST_VARDIR/tmp/backup1; +let targetdir2=$MYSQLTEST_VARDIR/tmp/backup2; +let targetdir3=$MYSQLTEST_VARDIR/tmp/backup3; +let targetdir4=$MYSQLTEST_VARDIR/tmp/backup4; + +CREATE TABLE t1 (a INT) ENGINE=INNODB; +XA START 'test1'; +INSERT t1 VALUES (10); +XA END 'test1'; +XA PREPARE 'test1'; +XA RECOVER; + +--echo # xtrabackup backup +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir1; +--enable_result_log + +perl; +use lib "lib"; +use My::Handles { suppress_init_messages => 1 }; +use My::File::Path; +copytree($ENV{'targetdir1'}, $ENV{'targetdir2'}); +copytree($ENV{'targetdir1'}, $ENV{'targetdir3'}); +copytree($ENV{'targetdir1'}, $ENV{'targetdir4'}); +EOF + +XA ROLLBACK 'test1'; + +--echo # xtrabackup prepare and rollback prepared XA +--disable_result_log +exec $XTRABACKUP --prepare --rollback_xa --target-dir=$targetdir1; +--let $targetdir = $targetdir1 +--source include/restart_and_restore.inc +--enable_result_log +XA RECOVER; + +--echo # xtrabackup prepare and DO NOT rollback prepared XA +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir2; +--let $targetdir = $targetdir2 +--source include/restart_and_restore.inc +--enable_result_log +XA RECOVER; +XA ROLLBACK 'test1'; + +--echo # xtrabackup prepare for export and rollback prepared XA +--disable_result_log +exec $XTRABACKUP --prepare --rollback_xa --export --target-dir=$targetdir3; +--let $targetdir = $targetdir3 +--source include/restart_and_restore.inc +--enable_result_log +XA RECOVER; + +--echo # xtrabackup prepare for export and DO NOT rollback prepared XA +--disable_result_log +exec $XTRABACKUP --prepare --export --target-dir=$targetdir4; +--let $targetdir = $targetdir4 +--source include/restart_and_restore.inc +--enable_result_log +XA RECOVER; +XA ROLLBACK 'test1'; + +DROP TABLE t1; +rmdir $targetdir1; +rmdir $targetdir2; +rmdir $targetdir3; +rmdir $targetdir4; |