Skip to content

Commit

Permalink
MDEV-27575 Remove thd from spider_db_done
Browse files Browse the repository at this point in the history
It is unused, and causing segfaults
  • Loading branch information
mariadb-YuchenPei committed Nov 20, 2023
1 parent d415f60 commit 9656573
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
16 changes: 16 additions & 0 deletions storage/spider/mysql-test/spider/bugfix/r/mdev_27575.result
@@ -0,0 +1,16 @@
#
# MDEV-27575 Spider: UBSAN member access within null pointer of type 'struct st_plugin_int and SIGSEGV in intern_plugin_lock on SHUTDOWN when setting Spider as default storage engine (temporary or global)
#
for master_1
for child2
for child3
SET GLOBAL default_tmp_storage_engine=spider;
# restart
SET GLOBAL default_storage_engine=Spider;
# restart
for master_1
for child2
for child3
#
# end of test mdev_27575
#
23 changes: 23 additions & 0 deletions storage/spider/mysql-test/spider/bugfix/t/mdev_27575.test
@@ -0,0 +1,23 @@
--echo #
--echo # MDEV-27575 Spider: UBSAN member access within null pointer of type 'struct st_plugin_int and SIGSEGV in intern_plugin_lock on SHUTDOWN when setting Spider as default storage engine (temporary or global)
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log

SET GLOBAL default_tmp_storage_engine=spider;
--source include/restart_mysqld.inc

SET GLOBAL default_storage_engine=Spider;
--source include/restart_mysqld.inc

--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
--echo #
--echo # end of test mdev_27575
--echo #
22 changes: 1 addition & 21 deletions storage/spider/spd_table.cc
Expand Up @@ -6451,26 +6451,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)
Expand Down Expand Up @@ -6687,13 +6674,6 @@ int spider_db_done(
));
}

/* End Spider plugin deinit */
if (do_delete_thd)
spider_destroy_thd(thd);

/*
DBUG_ASSERT(0);
*/
DBUG_RETURN(0);
}

Expand Down

0 comments on commit 9656573

Please sign in to comment.