Finally, I figured it out. The io_watching_thread() was being created before the condition variable log_copying_stop had been initialized in the main thread. So, the first mysql_cond_timedwait() could be executed concurrently with the initialization of the condition variable.
I would clean up also some other race conditions around this.
The following test seems to run about as fast with my fix, and rather reliably reproduce the hang (5 of 10 tests would complete in 6 seconds, and 5 would hang when I tried it):
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
|
index fed2d5e60a9..62e4f9c6875 100644
|
--- a/mysql-test/suite/mariabackup/incremental_backup.test
|
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
|
@@ -34,7 +34,7 @@ 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 --parallel=10 --target-dir=$basedir;
|
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir --throttle=1000;
|
--enable_result_log
|
BEGIN;
|
INSERT INTO t VALUES(0);
|
This race condition was caused by MDEV-21452, which made io_watching_thread() depend on the condition variable log_copying_stop.
added log for `--throttle=10000000`