Commit beec9c0e authored by Vlad Lesin's avatar Vlad Lesin

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.
parent 808036a6
......@@ -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 @@ static bool xtrabackup_backup_func()
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);
......
--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2
CREATE TABLE t(i INT) ENGINE=INNODB;
DROP TABLE t;
--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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment