diff options
author | Vlad Lesin <vlad_lesin@mail.ru> | 2019-10-02 21:11:59 +0300 |
---|---|---|
committer | Vlad Lesin <vlad_lesin@mail.ru> | 2019-12-12 13:28:30 +0300 |
commit | beec9c0e19284a0e50d3629f4cb2486007b0333b (patch) | |
tree | f8dcfed990a0e273a3f38f927f540d1dba73a184 | |
parent | 808036a61d13d4392b6e0d9e7e9eca87a0c20495 (diff) | |
download | mariadb-git-beec9c0e19284a0e50d3629f4cb2486007b0333b.tar.gz |
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.
4 files changed, 26 insertions, 1 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 2ccd59ff13b..e497ba5a972 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/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); diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt new file mode 100644 index 00000000000..7111d384b40 --- /dev/null +++ b/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 diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result new file mode 100644 index 00000000000..29abe038afe --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result @@ -0,0 +1,2 @@ +CREATE TABLE t(i INT) ENGINE=INNODB; +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test new file mode 100644 index 00000000000..22165ff29be --- /dev/null +++ b/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 + |