[Occam] add init function to ObOccamTimeGuard

This commit is contained in:
fengdeyiji
2023-09-20 13:23:31 +00:00
committed by ob-robot
parent 284626c49d
commit f80153a84e
2 changed files with 9 additions and 7 deletions

View File

@ -412,7 +412,8 @@ int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
LOG_ERROR("init server startup task handler failed", KR(ret));
} else if (OB_FAIL(ObServerCheckpointSlogHandler::get_instance().init())) {
LOG_ERROR("init server checkpoint slog handler failed", KR(ret));
} else if (FALSE_IT(common::occam::ObThreadHungDetector::get_instance())) {
} else if (OB_FAIL(common::occam::ObThreadHungDetector::get_instance().init())) {
LOG_ERROR("init sObThreadHungDetector failed", KR(ret));
} else if (OB_FAIL(palf::election::GLOBAL_INIT_ELECTION_MODULE())) {
LOG_ERROR("init election module failed", KR(ret));
} else if (OB_FAIL(init_multi_tenant())) {

View File

@ -68,8 +68,13 @@ public:
static constexpr int64_t MAX_THREAD_NUM = 1LL << POW_OF_2;// 4096
static constexpr int64_t MAX_THREAD_NUM_MASK = MAX_THREAD_NUM - 1;
private:
ObThreadHungDetector() : back_thread_(nullptr)
ObThreadHungDetector() : back_thread_(nullptr) {}
~ObThreadHungDetector()
{
destroy();
}
public:
int init() {
int ret = OB_SUCCESS;
back_thread_ = (occam::ObOccamThread*)ob_malloc(sizeof(occam::ObOccamThread), "OccamTimeGuard");
if (back_thread_ == nullptr) {
@ -108,12 +113,8 @@ private:
OCCAM_LOG(ERROR, "init back thread failed");
}
}
return ret;
}
~ObThreadHungDetector()
{
destroy();
}
public:
void stop()
{
if (back_thread_ != nullptr) {