Skip to content

Commit d2ffafe

Browse files
committed
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.
1 parent 0fdb0bd commit d2ffafe

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

mysql-test/suite/mariabackup/incremental_backup.result

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
call mtr.add_suppression("InnoDB: New log files created");
2-
CREATE TABLE t(i INT) ENGINE INNODB;
2+
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
3+
BEGIN;
4+
INSERT INTO t VALUES(2);
5+
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
36
INSERT INTO t VALUES(1);
47
# Create full backup , modify table, then create incremental/differential backup
5-
INSERT INTO t VALUES(2);
8+
BEGIN;
9+
INSERT INTO t VALUES(0);
10+
DELETE FROM t WHERE i=0;
11+
COMMIT;
612
SELECT * FROM t;
713
i
814
1

mysql-test/suite/mariabackup/incremental_backup.test

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@ call mtr.add_suppression("InnoDB: New log files created");
44
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
55
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
66

7-
8-
CREATE TABLE t(i INT) ENGINE INNODB;
7+
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
8+
BEGIN;
9+
INSERT INTO t VALUES(2);
10+
connect (con1,localhost,root,,);
11+
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
912
INSERT INTO t VALUES(1);
1013

1114
echo # Create full backup , modify table, then create incremental/differential backup;
1215
--disable_result_log
1316
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
1417
--enable_result_log
15-
INSERT INTO t VALUES(2);
18+
BEGIN;
19+
INSERT INTO t VALUES(0);
20+
DELETE FROM t WHERE i=0;
21+
connection default;
22+
COMMIT;
1623
SELECT * FROM t;
1724
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
1825

1926
--disable_result_log
2027
echo # Prepare full backup, apply incremental one;
2128
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir;
22-
exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
29+
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ;
2330

31+
disconnect con1;
2432
echo # Restore and check results;
2533
let $targetdir=$basedir;
2634
-- source include/restart_and_restore.inc

storage/xtradb/trx/trx0undo.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,7 @@ trx_undo_free_prepared(
20252025
/* lock_trx_release_locks() assigns
20262026
trx->is_recovered=false */
20272027
ut_a(srv_read_only_mode
2028+
|| srv_apply_log_only
20282029
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
20292030
break;
20302031
default:

0 commit comments

Comments
 (0)