diff options
author | Eugene Kosov <claprix@yandex.ru> | 2020-04-30 20:06:26 +0300 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2020-05-05 18:13:31 +0300 |
commit | 89ff4176c125f5993aba0732e52102227577ed96 (patch) | |
tree | 42980e30d3f4f02b09b0fda80790f7241fd699f4 | |
parent | 90aad47dd9f28101b1d2c4a01c2a10db5ad5f426 (diff) | |
download | mariadb-git-89ff4176c125f5993aba0732e52102227577ed96.tar.gz |
MDEV-22437 make THR_THD* variable thread_local
Now all access goes through _current_thd() and set_current_thd()
functions.
Some functions like THD::store_globals() can not fail now.
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 6 | ||||
-rw-r--r-- | include/my_pthread.h | 16 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 11 | ||||
-rw-r--r-- | plugin/feedback/sender_thread.cc | 3 | ||||
-rw-r--r-- | plugin/handler_socket/handlersocket/database.cpp | 4 | ||||
-rw-r--r-- | sql/event_scheduler.cc | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 18 | ||||
-rw-r--r-- | sql/mysqld.h | 8 | ||||
-rw-r--r-- | sql/slave.cc | 11 | ||||
-rw-r--r-- | sql/sql_class.cc | 12 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_connect.cc | 18 | ||||
-rw-r--r-- | sql/sql_connect.h | 2 | ||||
-rw-r--r-- | sql/sql_insert.cc | 5 | ||||
-rw-r--r-- | sql/threadpool_common.cc | 5 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 12 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 2 | ||||
-rw-r--r-- | sql/wsrep_thd.cc | 4 | ||||
-rw-r--r-- | sql/wsrep_thd.h | 2 | ||||
-rw-r--r-- | sql/wsrep_utils.cc | 2 | ||||
-rw-r--r-- | storage/spider/spd_conn.cc | 20 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 8 | ||||
-rw-r--r-- | storage/spider/spd_trx.cc | 3 |
23 files changed, 56 insertions, 121 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 1cc13d89036..04b47c12e0a 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6021,9 +6021,6 @@ int main(int argc, char **argv) init_signals(); MY_INIT(argv[0]); - pthread_key_create(&THR_THD, NULL); - my_pthread_setspecific_ptr(THR_THD, NULL); - xb_regex_init(); capture_tool_command(argc, argv); @@ -6070,9 +6067,6 @@ int main(int argc, char **argv) } #endif - if (THR_THD) - (void) pthread_key_delete(THR_THD); - logger.cleanup_base(); cleanup_errmsgs(); free_error_messages(); diff --git a/include/my_pthread.h b/include/my_pthread.h index 0cb830fc9c6..4888bfcc2c8 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -360,22 +360,8 @@ size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize); #ifdef MYSQL_CLIENT #define _current_thd() NULL -#elif defined(_WIN32) -#ifdef __cplusplus -extern "C" -#endif -MYSQL_THD _current_thd_noinline(); -#define _current_thd() _current_thd_noinline() #else -/* - THR_THD is a key which will be used to set/get THD* for a thread, - using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr(). -*/ -extern pthread_key(MYSQL_THD, THR_THD); -static inline MYSQL_THD _current_thd(void) -{ - return my_pthread_getspecific_ptr(MYSQL_THD,THR_THD); -} +MYSQL_THD _current_thd(); #endif /* safe_mutex adds checking to mutex for easier debugging */ diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index d5810f5e48e..b93cd85bfe8 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -437,7 +437,7 @@ static void emb_free_embedded_thd(MYSQL *mysql) thd->clear_data_list(); thd->store_globals(); delete thd; - my_pthread_setspecific_ptr(THR_THD, 0); + set_current_thd(nullptr); mysql->thd=0; } @@ -683,11 +683,7 @@ void *create_embedded_thd(int client_flag) THD * thd= new THD(next_thread_id()); thd->thread_stack= (char*) &thd; - if (thd->store_globals()) - { - fprintf(stderr,"store_globals failed.\n"); - goto err; - } + thd->store_globals(); lex_start(thd); /* TODO - add init_connect command execution */ @@ -714,9 +710,6 @@ void *create_embedded_thd(int client_flag) thd->mysys_var= 0; thd->reset_globals(); return thd; -err: - delete(thd); - return NULL; } diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 36db4e44cc0..fd9ab65c0fa 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -92,8 +92,7 @@ static int prepare_for_fill(TABLE_LIST *tables) thd->variables.pseudo_thread_id= thd->thread_id; server_threads.insert(thd); thd->thread_stack= (char*) &tables; - if (thd->store_globals()) - return 1; + thd->store_globals(); thd->mysys_var->current_cond= &sleep_condition; thd->mysys_var->current_mutex= &sleep_mutex; diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 001981e3baa..91b095cb655 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -302,7 +302,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag) thd->db.length= sizeof("handlersocket")-1; } thd->variables.option_bits |= OPTION_TABLE_LOCK; - my_pthread_setspecific_ptr(THR_THD, thd); + set_current_thd(thd); DBG_THR(fprintf(stderr, "HNDSOCK x0 %p\n", thd)); } { @@ -339,7 +339,7 @@ dbcontext::term_thread() { DBG_THR(fprintf(stderr, "HNDSOCK thread end %p\n", thd)); close_tables_if(); - my_pthread_setspecific_ptr(THR_THD, 0); + set_current_thd(nullptr); { delete thd; thd = 0; diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 0e8e4826939..e842d95e3b0 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -128,11 +128,12 @@ bool post_init_event_thread(THD *thd) { (void) init_new_connection_handler_thread(); - if (init_thr_lock() || thd->store_globals()) + if (init_thr_lock()) { thd->cleanup(); return TRUE; } + thd->store_globals(); return FALSE; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1c3af7349b9..faf7a244647 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -666,7 +666,10 @@ static std::atomic<char*> shutdown_user; /* Thread specific variables */ -pthread_key(THD*, THR_THD); +static thread_local THD *THR_THD; + +MYSQL_THD _current_thd() { return THR_THD; } +void set_current_thd(THD *thd) { THR_THD= thd; } /* LOCK_start_thread is used to syncronize thread start and stop with @@ -1917,13 +1920,6 @@ extern "C" void unireg_abort(int exit_code) } -static void cleanup_tls() -{ - if (THR_THD) - (void)pthread_key_delete(THR_THD); -} - - static void mysqld_exit(int exit_code) { DBUG_ENTER("mysqld_exit"); @@ -1952,7 +1948,6 @@ static void mysqld_exit(int exit_code) if (exit_code == 0) SAFEMALLOC_REPORT_MEMORY(0); } - cleanup_tls(); DBUG_LEAVE; sd_notify(0, "STATUS=MariaDB server is down"); exit(exit_code); /* purecov: inspected */ @@ -3691,11 +3686,6 @@ static const char *rpl_make_log_name(PSI_memory_key key, const char *opt, static int init_early_variables() { - if (pthread_key_create(&THR_THD, NULL)) - { - fprintf(stderr, "Fatal error: Can't create thread-keys\n"); - return 1; - } set_current_thd(0); set_malloc_size_cb(my_malloc_size_cb_func); global_status_var.global_memory_used= 0; diff --git a/sql/mysqld.h b/sql/mysqld.h index 8adfda0dfec..9cd0fe0a7fe 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -769,8 +769,6 @@ extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher, *opt_ssl_key, *opt_ssl_crl, *opt_ssl_crlpath; extern ulonglong tls_version; -extern MYSQL_PLUGIN_IMPORT pthread_key(THD*, THR_THD); - #ifdef MYSQL_SERVER /** @@ -928,11 +926,7 @@ inline void table_case_convert(char * name, uint length) extern void set_server_version(char *buf, size_t size); #define current_thd _current_thd() -inline int set_current_thd(THD *thd) -{ - return my_pthread_setspecific_ptr(THR_THD, thd); -} - +void set_current_thd(THD *thd); /* @todo remove, make it static in ha_maria.cc diff --git a/sql/slave.cc b/sql/slave.cc index 381417c353b..fb26856f811 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3628,9 +3628,16 @@ static int init_slave_thread(THD* thd, Master_info *mi, thd->system_thread = (thd_type == SLAVE_THD_SQL) ? SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO; + if (init_thr_lock()) + { + thd->cleanup(); + DBUG_RETURN(-1); + } + /* We must call store_globals() before doing my_net_init() */ - if (init_thr_lock() || thd->store_globals() || - my_net_init(&thd->net, 0, thd, MYF(MY_THREAD_SPECIFIC)) || + thd->store_globals(); + + if (my_net_init(&thd->net, 0, thd, MYF(MY_THREAD_SPECIFIC)) || IF_DBUG(simulate_error & (1<< thd_type), 0)) { thd->cleanup(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 03383a744fc..591828b4306 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1214,11 +1214,6 @@ void thd_gmt_sec_to_TIME(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t) #ifdef _WIN32 -extern "C" THD *_current_thd_noinline(void) -{ - return my_pthread_getspecific_ptr(THD*,THR_THD); -} - extern "C" my_thread_id next_thread_id_noinline() { #undef next_thread_id @@ -2152,7 +2147,7 @@ void THD::reset_killed() the structure for the net buffer */ -bool THD::store_globals() +void THD::store_globals() { /* Assert that thread_stack is initialized: it's necessary to be able @@ -2160,8 +2155,7 @@ bool THD::store_globals() */ DBUG_ASSERT(thread_stack); - if (set_current_thd(this)) - return 1; + set_current_thd(this); /* mysys_var is concurrently readable by a killer thread. It is protected by LOCK_thd_kill, it is not needed to lock while the @@ -2203,8 +2197,6 @@ bool THD::store_globals() created in another thread */ thr_lock_info_init(&lock_info, mysys_var); - - return 0; } /** diff --git a/sql/sql_class.h b/sql/sql_class.h index 96ebfca3723..1069b49790a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3390,7 +3390,7 @@ public: void cleanup_after_query(); void free_connection(); void reset_for_reuse(); - bool store_globals(); + void store_globals(); void reset_globals(); bool trace_started() { diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index aa9e561a717..dbe66650476 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1105,16 +1105,9 @@ static int check_connection(THD *thd) In this case we will close the connection and increment status */ -bool setup_connection_thread_globals(THD *thd) +void setup_connection_thread_globals(THD *thd) { - if (thd->store_globals()) - { - close_connection(thd, ER_OUT_OF_RESOURCES); - statistic_increment(aborted_connects,&LOCK_status); - statistic_increment(connection_errors_internal, &LOCK_status); - return 1; // Error - } - return 0; + thd->store_globals(); } @@ -1397,12 +1390,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) stack overruns. */ thd->thread_stack= (char*) &thd; - if (setup_connection_thread_globals(thd)) - { - unlink_thd(thd); - delete thd; - return; - } + setup_connection_thread_globals(thd); for (;;) { diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 4d62834a6f9..152bd71afd7 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -82,7 +82,7 @@ void decrease_user_connections(USER_CONN *uc); #define decrease_user_connections(X) do { } while(0) /* nothing */ #endif bool thd_init_client_charset(THD *thd, uint cs_number); -bool setup_connection_thread_globals(THD *thd); +void setup_connection_thread_globals(THD *thd); bool thd_prepare_connection(THD *thd); bool thd_is_connection_alive(THD *thd); int thd_set_peer_addr(THD *thd, sockaddr_storage *addr, diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2a2b74405f3..0914b4ac497 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3087,15 +3087,16 @@ pthread_handler_t handle_delayed_insert(void *arg) { DBUG_ENTER("handle_delayed_insert"); thd->thread_stack= (char*) &thd; - if (init_thr_lock() || thd->store_globals()) + if (init_thr_lock()) { - /* Can't use my_error since store_globals has perhaps failed */ thd->get_stmt_da()->set_error_status(ER_OUT_OF_RESOURCES); di->handler_thread_initialized= TRUE; thd->fatal_error(); goto err; } + thd->store_globals(); + thd->lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock() /* diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 213b1baf5ab..50cc9aa43f2 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -96,7 +96,7 @@ struct Worker_thread_context { PSI_CALL_set_thread(psi_thread); set_mysys_var(mysys_var); - pthread_setspecific(THR_THD, 0); + set_current_thd(nullptr); } }; @@ -255,8 +255,7 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) thd->start_utime= now; thd->thr_create_utime= now; - if (setup_connection_thread_globals(thd)) - goto end; + setup_connection_thread_globals(thd); if (thd_prepare_connection(thd)) goto end; diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 49880b2e827..7d54aab3ac0 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1103,7 +1103,7 @@ void wsrep_shutdown_replication() node_uuid= WSREP_UUID_UNDEFINED; /* Undocking the thread specific data. */ - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); } bool wsrep_start_replication() @@ -2926,15 +2926,7 @@ void* start_wsrep_THD(void *arg) thd->thread_stack= (char*) &thd; wsrep_assign_from_threadvars(thd); - if (wsrep_store_threadvars(thd)) - { - close_connection(thd, ER_OUT_OF_RESOURCES); - statistic_increment(aborted_connects,&LOCK_status); - unlink_thd(thd); - delete thd; - delete thd_args; - goto error; - } + wsrep_store_threadvars(thd); thd->system_thread= SYSTEM_THREAD_SLAVE_SQL; thd->security_ctx->skip_grants(); diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 8ffcb32e10a..93b7bc74489 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -364,7 +364,7 @@ void wsrep_sst_received (THD* thd, wsrep_store_threadvars(thd); } else { - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); } /* During sst WSREP(thd) is not yet set for joiner. */ diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 0f72c132d84..21a1c03d33e 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -454,13 +454,13 @@ void wsrep_restore_threadvars(const Wsrep_threadvars& globals) pthread_setspecific(THR_KEY_mysys, globals.mysys_var); } -int wsrep_store_threadvars(THD *thd) +void wsrep_store_threadvars(THD *thd) { if (thread_handling == SCHEDULER_TYPES_COUNT) { pthread_setspecific(THR_KEY_mysys, thd->mysys_var); } - return thd->store_globals(); + thd->store_globals(); } void wsrep_reset_threadvars(THD *thd) diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index d24d8e6358f..c7350c79ee7 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -162,7 +162,7 @@ void wsrep_restore_threadvars(const Wsrep_threadvars&); /** Store variables into thread local storage. */ -int wsrep_store_threadvars(THD *); +void wsrep_store_threadvars(THD *); /** Reset thread local storage. diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index 59fa68db6c0..148def54aaf 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -436,7 +436,7 @@ thd::~thd () if (ptr) { delete ptr; - my_pthread_setspecific_ptr (THR_THD, 0); + set_current_thd(nullptr); } } diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 9d530ca1adb..3164356ddf6 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2519,7 +2519,7 @@ void *spider_bg_conn_action( pthread_cond_signal(&conn->bg_conn_sync_cond); pthread_mutex_unlock(&conn->bg_conn_sync_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -2583,7 +2583,7 @@ void *spider_bg_conn_action( pthread_mutex_unlock(&conn->bg_conn_mutex); pthread_mutex_unlock(&conn->bg_conn_sync_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -3035,7 +3035,7 @@ void *spider_bg_sts_action( share->bg_sts_init = FALSE; pthread_mutex_unlock(&share->sts_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3095,7 +3095,7 @@ void *spider_bg_sts_action( share->bg_sts_init = FALSE; pthread_mutex_unlock(&share->sts_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3124,7 +3124,7 @@ void *spider_bg_sts_action( pthread_cond_signal(&share->bg_sts_sync_cond); pthread_mutex_unlock(&share->sts_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3401,7 +3401,7 @@ void *spider_bg_crd_action( share->bg_crd_init = FALSE; pthread_mutex_unlock(&share->crd_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3465,7 +3465,7 @@ void *spider_bg_crd_action( share->bg_crd_init = FALSE; pthread_mutex_unlock(&share->crd_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3494,7 +3494,7 @@ void *spider_bg_crd_action( pthread_cond_signal(&share->bg_crd_sync_cond); pthread_mutex_unlock(&share->crd_mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); my_afree(need_mons); @@ -3893,7 +3893,7 @@ void *spider_bg_mon_action( pthread_cond_signal(&share->bg_mon_conds[link_idx]); pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -3932,7 +3932,7 @@ void *spider_bg_mon_action( spider_free_trx(trx, TRUE); delete thd; #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index ea679c00582..be542eab004 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -9967,7 +9967,7 @@ void *spider_table_bg_sts_action( thread->killed = FALSE; pthread_mutex_unlock(&thread->mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -10034,7 +10034,7 @@ void *spider_table_bg_sts_action( pthread_cond_signal(&thread->sync_cond); pthread_mutex_unlock(&thread->mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -10166,7 +10166,7 @@ void *spider_table_bg_crd_action( thread->killed = FALSE; pthread_mutex_unlock(&thread->mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); @@ -10186,7 +10186,7 @@ void *spider_table_bg_crd_action( pthread_cond_signal(&thread->sync_cond); pthread_mutex_unlock(&thread->mutex); #if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32) - my_pthread_setspecific_ptr(THR_THD, NULL); + set_current_thd(nullptr); #endif my_thread_end(); DBUG_RETURN(NULL); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 8062ea68646..f7565eda2c9 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -4173,8 +4173,7 @@ THD *spider_create_tmp_thd() thd->thread_id = thd->variables.pseudo_thread_id = 0; #endif thd->thread_stack = (char*) &thd; - if (thd->store_globals()) - DBUG_RETURN(NULL); + thd->store_globals(); lex_start(thd); DBUG_RETURN(thd); } |