Browse Source

MDEV-21255: Deadlock of parallel slave and mariabackup (with failed log

copy thread)

mariabackup hangs waiting until innodb redo log thread read log till certain
LSN, and it waits under FTWRL. If there is redo log read error in the thread,
it is finished, and main thread knows nothing about it, what leads to hanging.
As it hangs under FTWRL, slave threads on server side can be blocked due
to MDL lock conflict.

The fix is to finish mariabackup with error message on innodb redo log read
failure.
bb-10.2-MDEV-21335
Vlad Lesin 6 years ago
parent
commit
beec9c0e19
  1. 4
      extra/mariabackup/xtrabackup.cc
  2. 1
      mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
  3. 2
      mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
  4. 20
      mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test

4
extra/mariabackup/xtrabackup.cc

@ -2759,7 +2759,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
msg(recv_sys->found_corrupt_log
die(recv_sys->found_corrupt_log
? "xtrabackup_copy_logfile() failed: corrupt log."
: "xtrabackup_copy_logfile() failed.");
return true;
@ -4281,6 +4281,8 @@ fail_before_log_copying_thread_start:
if (xtrabackup_copy_logfile())
goto fail_before_log_copying_thread_start;
DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started",0);
log_copying_stop = os_event_create(0);
os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);

1
mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt

@ -0,0 +1 @@
--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2

2
mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result

@ -0,0 +1,2 @@
CREATE TABLE t(i INT) ENGINE=INNODB;
DROP TABLE t;

20
mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test

@ -0,0 +1,20 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_sequence.inc
CREATE TABLE t(i INT) ENGINE=INNODB;
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
# Generate enough redo log records to make at least one loop in log group
--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * from test.seq_1_to_102400
--disable_result_log
# mariabackup must exit with error instead of hanging
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log
DROP TABLE t;
--rmdir $targetdir
Loading…
Cancel
Save