diff options
author | Yuchen Pei <yuchen.pei@mariadb.com> | 2023-01-19 18:28:14 +1100 |
---|---|---|
committer | Yuchen Pei <yuchen.pei@mariadb.com> | 2023-01-20 15:59:41 +1100 |
commit | 116911a84c7043d664f97edc921c77b6bbb9b142 (patch) | |
tree | 80ec8695a4756842eba7248060cb83eb316fcd9d | |
parent | eeb8ebb15201c69787ea632df0cd3bc9d1bfed46 (diff) | |
download | mariadb-git-bb-10.5-mdev-30370-22979-29904-27912.tar.gz |
MDEV-30370 MDEV-22979 MDEV-29904 MDEV-27912 Spider hang when abortbb-10.5-mdev-30370-22979-29904-27912
This is Kentoku's fix for MDEV-22979 (e6e41f04f4e + 22a0097727f),
which also fixes 30370. Adding a test for MDEV-29904 to avoid
regression, given MDEV-27233 is a similar problem.
Also update restart_spider.inc to allow passing restart_parameters, so
that the test of MDEV-29904 works (MDEV-27912).
6 files changed, 30 insertions, 5 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc b/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc index a5446a6188d..884fb28ce13 100644 --- a/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc +++ b/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc @@ -1,8 +1,12 @@ --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect +# shutdown_mysqld --exec echo "wait" > $_expect_file_name --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart" > $_expect_file_name + +# start_mysqld +--exec echo "restart: $restart_parameters" > $_expect_file_name --enable_reconnect --source include/wait_until_connected_again.inc +--disable_reconnect diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result new file mode 100644 index 00000000000..88482bdf151 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result @@ -0,0 +1,3 @@ +# +# MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE +# diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result new file mode 100644 index 00000000000..df0f6949280 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result @@ -0,0 +1,3 @@ +# +# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +# diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test new file mode 100644 index 00000000000..d05a9f4dce8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test @@ -0,0 +1,6 @@ +--echo # +--echo # MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE +--echo # + +--let $restart_parameters=--plugin-load-add=ha_spider +--source include/restart_spider.inc diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test new file mode 100644 index 00000000000..788ea2323f7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test @@ -0,0 +1,5 @@ +--echo # +--echo # MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +--echo # + +--exec $MYSQLD_BOOTSTRAP_CMD --wsrep-recover --plugin-load-add=ha_spider.so diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 7b07e84cd1f..349e34f6632 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -10102,6 +10102,7 @@ void spider_free_sts_threads( ) { bool thread_killed; DBUG_ENTER("spider_free_sts_threads"); + spider_thread->init_command = FALSE; pthread_mutex_lock(&spider_thread->mutex); thread_killed = spider_thread->killed; spider_thread->killed = TRUE; @@ -10258,12 +10259,13 @@ void *spider_table_bg_sts_action( tmp_disable_binlog(thd); thd->security_ctx->skip_grants(); thd->client_capabilities |= CLIENT_MULTI_RESULTS; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed) { pthread_mutex_lock(spd_LOCK_server_started); thd->mysys_var->current_cond = spd_COND_server_started; thd->mysys_var->current_mutex = spd_LOCK_server_started; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command) { do { @@ -10273,14 +10275,16 @@ void *spider_table_bg_sts_action( spd_LOCK_server_started, &abstime); } while ( (error_num == ETIMEDOUT || error_num == ETIME) && - !(*spd_mysqld_server_started) && !thd->killed && !thread->killed + !(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command ); } pthread_mutex_unlock(spd_LOCK_server_started); thd->mysys_var->current_cond = &thread->cond; thd->mysys_var->current_mutex = &thread->mutex; } - while (spider_init_queries[i].length && !thd->killed && !thread->killed) + while (spider_init_queries[i].length && !thd->killed && !thread->killed && + thread->init_command) { dispatch_command(COM_QUERY, thd, spider_init_queries[i].str, (uint) spider_init_queries[i].length, FALSE, FALSE); |