diff --git a/storage/tianchi/ctc_meta_data.cc b/storage/tianchi/ctc_meta_data.cc index 1c5d3755727b02aee5829d8074d11e5fa5e47f79..ec6ab12d8a72f42df211e2d028c7c0b0812e2a8a 100644 --- a/storage/tianchi/ctc_meta_data.cc +++ b/storage/tianchi/ctc_meta_data.cc @@ -397,13 +397,24 @@ static typename std::enable_if::type bool error = false; T *thd = nullptr; - uint64_t thd_key = tse_get_conn_key(tch->inst_id, tch->thd_id, true); - ctc_init_thd(&thd, thd_key); - + if (broadcast_req->is_dcl == true) { - reload_acl_caches(thd, false); + thd = new (std::nothrow) THD; + my_thread_init(); + thd->set_new_thread_id(); + thd->thread_stack = (char *)&thd; + thd->store_globals(); + thd->set_query("tse_mdl_thd_notify", 18); + error = reload_acl_caches(thd, false); tse_log_system("[TSE_INVALID_DD]: remote invalidate acl cache, mysql_inst_id=%u", broadcast_req->mysql_inst_id); + + Release_all_ctc_explicit_locks lock_visitor; + thd->mdl_context.release_locks(&lock_visitor); + thd->release_resources(); + delete thd; } else { + uint64_t thd_key = tse_get_conn_key(tch->inst_id, tch->thd_id, true); + ctc_init_thd(&thd, thd_key); invalidate_obj_entry_t *obj = NULL; uint32_t offset = 0; char *buff = broadcast_req->buff; @@ -445,9 +456,9 @@ static typename std::enable_if::type for (auto invalidate_it : invalidate_schema_list) { error = invalidate_schema(thd, invalidate_it->first); } + thd->restore_globals(); } - thd->restore_globals(); my_thread_end(); tse_log_system("[TSE_INVALID_DD]: remote invalidate dd cache success, mysql_inst_id=%u", broadcast_req->mysql_inst_id);