提交 f6d7fbde 编写于 作者: L ly0 提交者: wangzelin.wzl

fix tenant thread name issue

上级 bb004431
...@@ -117,6 +117,7 @@ void ObThWorker::activate() ...@@ -117,6 +117,7 @@ void ObThWorker::activate()
run_cond_.signal(); run_cond_.signal();
} }
static __thread uint64_t serving_tenant_id = 0;
void ObThWorker::wait_active() void ObThWorker::wait_active()
{ {
bool has_reset_pm = false; bool has_reset_pm = false;
...@@ -132,6 +133,8 @@ void ObThWorker::wait_active() ...@@ -132,6 +133,8 @@ void ObThWorker::wait_active()
has_reset_pm = true; has_reset_pm = true;
} }
waiting_active_ = true; waiting_active_ = true;
lib::set_thread_name("OMT_FREE_", NULL == tenant_ ? 0 : tenant_->id());
serving_tenant_id = 0;
IGNORE_RETURN run_cond_.wait(); IGNORE_RETURN run_cond_.wait();
waiting_active_ = false; waiting_active_ = false;
} }
...@@ -342,19 +345,17 @@ void ObThWorker::set_th_worker_thread_name(uint64_t tenant_id) ...@@ -342,19 +345,17 @@ void ObThWorker::set_th_worker_thread_name(uint64_t tenant_id)
// fix compile issue // fix compile issue
UNUSED(tenant_id); UNUSED(tenant_id);
static __thread uint64_t serving_tenant_id = 0;
char buf[32]; char buf[32];
if (serving_tenant_id != tenant_->id()) { if (serving_tenant_id != tenant_->id()) {
serving_tenant_id = tenant_->id();
snprintf(buf, 32, "TNT_L%d_", get_worker_level()); snprintf(buf, 32, "TNT_L%d_", get_worker_level());
lib::set_thread_name(buf, tenant_->id()); 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) void ObThWorker::worker(int64_t& tenant_id, int64_t& req_recv_timestamp, int32_t& worker_level)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
lib::set_thread_name("OMT_FREE", ObWorker::get_tidx());
Worker::self_ = this; Worker::self_ = this;
ObWorker::self_ = this; ObWorker::self_ = this;
int64_t wait_start_time = 0; int64_t wait_start_time = 0;
......
...@@ -185,7 +185,6 @@ inline void ObThWorker::reset() ...@@ -185,7 +185,6 @@ inline void ObThWorker::reset()
ws_ = WStatus::STOPPED; ws_ = WStatus::STOPPED;
active_ = false; active_ = false;
unset_tidx(); unset_tidx();
lib::set_thread_name("OMT_FREE", ObWorker::get_tidx());
} }
inline void ObThWorker::set_tenant(ObTenant* tenant) inline void ObThWorker::set_tenant(ObTenant* tenant)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册