[kill -15][BEFORE_DESTROY]add stop and wait thread
This commit is contained in:
16
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
16
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
@ -165,11 +165,25 @@ int ObMemoryDump::init()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObMemoryDump::destroy()
|
void ObMemoryDump::stop()
|
||||||
{
|
{
|
||||||
if (is_inited_) {
|
if (is_inited_) {
|
||||||
TG_STOP(TGDefIDs::MEMORY_DUMP);
|
TG_STOP(TGDefIDs::MEMORY_DUMP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObMemoryDump::wait()
|
||||||
|
{
|
||||||
|
if (is_inited_) {
|
||||||
TG_WAIT(TGDefIDs::MEMORY_DUMP);
|
TG_WAIT(TGDefIDs::MEMORY_DUMP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObMemoryDump::destroy()
|
||||||
|
{
|
||||||
|
if (is_inited_) {
|
||||||
|
stop();
|
||||||
|
wait();
|
||||||
queue_.destroy();
|
queue_.destroy();
|
||||||
is_inited_ = false;
|
is_inited_ = false;
|
||||||
}
|
}
|
||||||
|
|||||||
2
deps/oblib/src/lib/alloc/memory_dump.h
vendored
2
deps/oblib/src/lib/alloc/memory_dump.h
vendored
@ -163,6 +163,8 @@ public:
|
|||||||
~ObMemoryDump();
|
~ObMemoryDump();
|
||||||
static ObMemoryDump &get_instance();
|
static ObMemoryDump &get_instance();
|
||||||
int init();
|
int init();
|
||||||
|
void stop();
|
||||||
|
void wait();
|
||||||
void destroy();
|
void destroy();
|
||||||
bool is_inited() const { return is_inited_; }
|
bool is_inited() const { return is_inited_; }
|
||||||
int push(void *task);
|
int push(void *task);
|
||||||
|
|||||||
2
deps/oblib/src/lib/thread/ob_work_queue.cpp
vendored
2
deps/oblib/src/lib/thread/ob_work_queue.cpp
vendored
@ -42,7 +42,7 @@ int ObWorkQueue::init(const int64_t thread_count, const int64_t queue_size,
|
|||||||
if (inited_) {
|
if (inited_) {
|
||||||
ret = OB_INIT_TWICE;
|
ret = OB_INIT_TWICE;
|
||||||
LOG_WARN("rs task queue already inited", K(ret));
|
LOG_WARN("rs task queue already inited", K(ret));
|
||||||
} else if (OB_FAIL(timer_.init())) {
|
} else if (OB_FAIL(timer_.init(thread_name))) {
|
||||||
LOG_WARN("failed to init timer", K(ret));
|
LOG_WARN("failed to init timer", K(ret));
|
||||||
} else if (OB_FAIL(task_queue_.init(thread_count, queue_size, thread_name))) {
|
} else if (OB_FAIL(task_queue_.init(thread_count, queue_size, thread_name))) {
|
||||||
LOG_WARN("failed to init work queue", K(ret), K(thread_count), K(queue_size));
|
LOG_WARN("failed to init work queue", K(ret), K(thread_count), K(queue_size));
|
||||||
|
|||||||
@ -661,6 +661,14 @@ void ObServer::destroy()
|
|||||||
ObMdsEventBuffer::destroy();
|
ObMdsEventBuffer::destroy();
|
||||||
FLOG_INFO("ObMdsEventBuffer destroyed");
|
FLOG_INFO("ObMdsEventBuffer destroyed");
|
||||||
|
|
||||||
|
FLOG_INFO("begin to wait destroy multi tenant");
|
||||||
|
multi_tenant_.destroy();
|
||||||
|
FLOG_INFO("wait destroy multi tenant success");
|
||||||
|
|
||||||
|
FLOG_INFO("begin to destroy safe destroy instance");
|
||||||
|
SAFE_DESTROY_INSTANCE.destroy();
|
||||||
|
FLOG_INFO("wait destroy safe destroy instance success");
|
||||||
|
|
||||||
FLOG_INFO("begin to destroy query retry ctrl");
|
FLOG_INFO("begin to destroy query retry ctrl");
|
||||||
ObQueryRetryCtrl::destroy();
|
ObQueryRetryCtrl::destroy();
|
||||||
FLOG_INFO("query retry ctrl destroy");
|
FLOG_INFO("query retry ctrl destroy");
|
||||||
@ -1228,6 +1236,10 @@ int ObServer::stop()
|
|||||||
bl_service_.stop();
|
bl_service_.stop();
|
||||||
FLOG_INFO("blacklist service stopped");
|
FLOG_INFO("blacklist service stopped");
|
||||||
|
|
||||||
|
FLOG_INFO("begin to stop memory dump");
|
||||||
|
ObMemoryDump::get_instance().stop();
|
||||||
|
FLOG_INFO("memory dump stopped");
|
||||||
|
|
||||||
FLOG_INFO("begin to stop tenant timezone manager");
|
FLOG_INFO("begin to stop tenant timezone manager");
|
||||||
tenant_timezone_mgr_.stop();
|
tenant_timezone_mgr_.stop();
|
||||||
FLOG_INFO("tenant timezone manager stopped");
|
FLOG_INFO("tenant timezone manager stopped");
|
||||||
@ -1474,18 +1486,11 @@ int ObServer::wait()
|
|||||||
multi_tenant_.wait();
|
multi_tenant_.wait();
|
||||||
FLOG_INFO("wait multi tenant success");
|
FLOG_INFO("wait multi tenant success");
|
||||||
|
|
||||||
FLOG_INFO("begin to wait destroy multi tenant");
|
|
||||||
multi_tenant_.destroy();
|
|
||||||
FLOG_INFO("wait destroy multi tenant success");
|
|
||||||
|
|
||||||
// safe to destroy
|
// safe to destroy
|
||||||
FLOG_INFO("begin to wait for safe destroy instance");
|
FLOG_INFO("begin to wait for safe destroy instance");
|
||||||
SAFE_DESTROY_INSTANCE.wait();
|
SAFE_DESTROY_INSTANCE.wait();
|
||||||
FLOG_INFO("wait for safe destroy instance success");
|
FLOG_INFO("wait for safe destroy instance success");
|
||||||
|
|
||||||
FLOG_INFO("begin to destroy safe destroy instance");
|
|
||||||
SAFE_DESTROY_INSTANCE.destroy();
|
|
||||||
FLOG_INFO("wait destroy safe destroy instance success");
|
|
||||||
|
|
||||||
FLOG_INFO("begin to wait ratelimit manager");
|
FLOG_INFO("begin to wait ratelimit manager");
|
||||||
rl_mgr_.wait();
|
rl_mgr_.wait();
|
||||||
@ -1560,6 +1565,10 @@ int ObServer::wait()
|
|||||||
bl_service_.wait();
|
bl_service_.wait();
|
||||||
FLOG_INFO("wait blacklist service success");
|
FLOG_INFO("wait blacklist service success");
|
||||||
|
|
||||||
|
FLOG_INFO("begin to wait memory dump");
|
||||||
|
ObMemoryDump::get_instance().wait();
|
||||||
|
FLOG_INFO("wait memory dump success");
|
||||||
|
|
||||||
FLOG_INFO("begin to wait tenant timezone manager");
|
FLOG_INFO("begin to wait tenant timezone manager");
|
||||||
tenant_timezone_mgr_.wait();
|
tenant_timezone_mgr_.wait();
|
||||||
FLOG_INFO("wait tenant timezone manager success");
|
FLOG_INFO("wait tenant timezone manager success");
|
||||||
|
|||||||
@ -111,6 +111,7 @@ int ObLocalityManager::stop()
|
|||||||
STORAGE_LOG(ERROR, "locality manager not inited, cannot stop.", K(ret));
|
STORAGE_LOG(ERROR, "locality manager not inited, cannot stop.", K(ret));
|
||||||
} else {
|
} else {
|
||||||
TG_STOP(lib::TGDefIDs::LocalityReload);
|
TG_STOP(lib::TGDefIDs::LocalityReload);
|
||||||
|
refresh_locality_task_queue_.stop();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -119,6 +120,7 @@ int ObLocalityManager::wait()
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
TG_WAIT(lib::TGDefIDs::LocalityReload);
|
TG_WAIT(lib::TGDefIDs::LocalityReload);
|
||||||
|
refresh_locality_task_queue_.wait();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user