diff --git a/src/observer/omt/ob_th_worker.cpp b/src/observer/omt/ob_th_worker.cpp index f9d6c09abee1deebc0cb9ef4c088765bb6218c2d..652b1d38a9cbb9d22d580b44545185cfd8e86010 100644 --- a/src/observer/omt/ob_th_worker.cpp +++ b/src/observer/omt/ob_th_worker.cpp @@ -117,6 +117,7 @@ void ObThWorker::activate() run_cond_.signal(); } +static __thread uint64_t serving_tenant_id = 0; void ObThWorker::wait_active() { bool has_reset_pm = false; @@ -132,6 +133,8 @@ void ObThWorker::wait_active() has_reset_pm = true; } waiting_active_ = true; + lib::set_thread_name("OMT_FREE_", NULL == tenant_ ? 0 : tenant_->id()); + serving_tenant_id = 0; IGNORE_RETURN run_cond_.wait(); waiting_active_ = false; } @@ -342,19 +345,17 @@ void ObThWorker::set_th_worker_thread_name(uint64_t tenant_id) // fix compile issue UNUSED(tenant_id); - static __thread uint64_t serving_tenant_id = 0; char buf[32]; if (serving_tenant_id != tenant_->id()) { + serving_tenant_id = tenant_->id(); snprintf(buf, 32, "TNT_L%d_", get_worker_level()); lib::set_thread_name(buf, tenant_->id()); - serving_tenant_id = tenant_->id(); } } void ObThWorker::worker(int64_t& tenant_id, int64_t& req_recv_timestamp, int32_t& worker_level) { int ret = OB_SUCCESS; - lib::set_thread_name("OMT_FREE", ObWorker::get_tidx()); Worker::self_ = this; ObWorker::self_ = this; int64_t wait_start_time = 0; diff --git a/src/observer/omt/ob_th_worker.h b/src/observer/omt/ob_th_worker.h index 6b77c558b0088c005a3fd7d2953a436a3ccde9d5..6ef0a4f433f255e88de7d31afa1195f2f46cfd65 100644 --- a/src/observer/omt/ob_th_worker.h +++ b/src/observer/omt/ob_th_worker.h @@ -185,7 +185,6 @@ inline void ObThWorker::reset() ws_ = WStatus::STOPPED; active_ = false; unset_tidx(); - lib::set_thread_name("OMT_FREE", ObWorker::get_tidx()); } inline void ObThWorker::set_tenant(ObTenant* tenant)