summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-09 14:37:03 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-09 14:37:03 +0200
commitd2ffafe00f7e4c2246bb0b45bd407ff179163c5e (patch)
treeff195ef25f616dd5f8262721e05db6b058bbbfae
parent0fdb0bdf2769dc4e69d46b342200d3fd333fa3a5 (diff)
downloadmariadb-git-d2ffafe00f7e4c2246bb0b45bd407ff179163c5e.tar.gz
MDEV-14333 Mariabackup --apply-log-only crashes if incomplete transactions with update_undo logs are present
trx_undo_free_prepared(): Relax the assertion for mariabackup --apply-log-only.
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.result10
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test16
-rw-r--r--storage/xtradb/trx/trx0undo.cc1
3 files changed, 21 insertions, 6 deletions
diff --git a/mysql-test/suite/mariabackup/incremental_backup.result b/mysql-test/suite/mariabackup/incremental_backup.result
index eeedc751d83..20d8cefbefb 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_backup.result
@@ -1,8 +1,14 @@
call mtr.add_suppression("InnoDB: New log files created");
-CREATE TABLE t(i INT) ENGINE INNODB;
+CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
+BEGIN;
+INSERT INTO t VALUES(2);
+SET GLOBAL innodb_flush_log_at_trx_commit = 1;
INSERT INTO t VALUES(1);
# Create full backup , modify table, then create incremental/differential backup
-INSERT INTO t VALUES(2);
+BEGIN;
+INSERT INTO t VALUES(0);
+DELETE FROM t WHERE i=0;
+COMMIT;
SELECT * FROM t;
i
1
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index b92d7b323ac..93582f047a7 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -4,23 +4,31 @@ call mtr.add_suppression("InnoDB: New log files created");
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
-
-CREATE TABLE t(i INT) ENGINE INNODB;
+CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
+BEGIN;
+INSERT INTO t VALUES(2);
+connect (con1,localhost,root,,);
+SET GLOBAL innodb_flush_log_at_trx_commit = 1;
INSERT INTO t VALUES(1);
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
--enable_result_log
-INSERT INTO t VALUES(2);
+BEGIN;
+INSERT INTO t VALUES(0);
+DELETE FROM t WHERE i=0;
+connection default;
+COMMIT;
SELECT * FROM t;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
--disable_result_log
echo # Prepare full backup, apply incremental one;
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir;
-exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
+exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ;
+disconnect con1;
echo # Restore and check results;
let $targetdir=$basedir;
-- source include/restart_and_restore.inc
diff --git a/storage/xtradb/trx/trx0undo.cc b/storage/xtradb/trx/trx0undo.cc
index 0cc3048e624..3259bcb70b1 100644
--- a/storage/xtradb/trx/trx0undo.cc
+++ b/storage/xtradb/trx/trx0undo.cc
@@ -2025,6 +2025,7 @@ trx_undo_free_prepared(
/* lock_trx_release_locks() assigns
trx->is_recovered=false */
ut_a(srv_read_only_mode
+ || srv_apply_log_only
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
break;
default: