summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-06-20 20:05:32 +0900
committerNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-06-20 20:13:53 +0900
commit03935c9bd1f57f6d72b09be4f384bac8bffbe99a (patch)
treef061c815df2aa9aa4a2f7a3984b136876047353f
parentf299351e1c2aa00dcce3c6f58c58bb5e28469c61 (diff)
downloadmariadb-git-bb-10.3-MDEV-27575.tar.gz
MDEV-27575 SIGSEGV in intern_plugin_lock on SHUTDOWN when setting Spider as default storage engine (temporary or global)bb-10.3-MDEV-27575
When Spider is set as the default storage engine, it is unloaded later compared with other plugins. That is because Spider is referenced by @@global.default_storage_engine and cannot be unloaded before the variable is set to NULL. spider_db_done() creates a new THD but, in the above mentioned case, the new THD needs to lock its default_storage_engine and it does not expect that the server is almost shut down and the variable is NULL. Luckily, the newly created THD is used for nothing. Thus, we can just remove the THD creation.
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27575.result8
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27575.test16
-rw-r--r--storage/spider/spd_table.cc23
3 files changed, 25 insertions, 22 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27575.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27575.result
new file mode 100644
index 00000000000..6f9df39d25e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27575.result
@@ -0,0 +1,8 @@
+#
+# MDEV-27575 SIGSEGV in intern_plugin_lock on SHUTDOWN when setting Spider as default storage engine (temporary or global)
+#
+INSTALL PLUGIN spider SONAME 'ha_spider.so';
+SET GLOBAL storage_engine=Spider;
+UNINSTALL PLUGIN spider;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27575.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27575.test
new file mode 100644
index 00000000000..4b0a9dcfdac
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27575.test
@@ -0,0 +1,16 @@
+--echo #
+--echo # MDEV-27575 SIGSEGV in intern_plugin_lock on SHUTDOWN when setting Spider as default storage engine (temporary or global)
+--echo #
+
+INSTALL PLUGIN spider SONAME 'ha_spider.so';
+SET GLOBAL storage_engine=Spider;
+
+# A workaround for MDEV-27912
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
+--shutdown_server
+--source include/wait_until_disconnected.inc
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+UNINSTALL PLUGIN spider;
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 20347c4ebad..09e2e1e11a1 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -6614,26 +6614,13 @@ int spider_db_done(
void *p
) {
int roop_count;
- bool do_delete_thd;
- THD *thd = current_thd, *tmp_thd;
+ THD *tmp_thd;
SPIDER_CONN *conn;
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
SPIDER_TABLE_MON_LIST *table_mon_list;
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
DBUG_ENTER("spider_db_done");
- /* Begin Spider plugin deinit */
- if (thd)
- do_delete_thd = FALSE;
- else
- {
- /* Create a thread for Spider plugin deinit */
- thd = spider_create_thd();
- if (!thd)
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- do_delete_thd = TRUE;
- }
-
for (roop_count = SPIDER_DBTON_SIZE - 1; roop_count >= 0; roop_count--)
{
if (spider_dbton[roop_count].deinit)
@@ -6849,14 +6836,6 @@ int spider_db_done(
spider_current_alloc_mem[roop_count] ? "NG" : "OK"
));
}
-
- /* End Spider plugin deinit */
- if (do_delete_thd)
- spider_destroy_thd(thd);
-
-/*
-DBUG_ASSERT(0);
-*/
DBUG_RETURN(0);
}