[Occam] add init function to ObOccamTimeGuard
This commit is contained in:
@ -412,7 +412,8 @@ int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
|
|||||||
LOG_ERROR("init server startup task handler failed", KR(ret));
|
LOG_ERROR("init server startup task handler failed", KR(ret));
|
||||||
} else if (OB_FAIL(ObServerCheckpointSlogHandler::get_instance().init())) {
|
} else if (OB_FAIL(ObServerCheckpointSlogHandler::get_instance().init())) {
|
||||||
LOG_ERROR("init server checkpoint slog handler failed", KR(ret));
|
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())) {
|
} else if (OB_FAIL(palf::election::GLOBAL_INIT_ELECTION_MODULE())) {
|
||||||
LOG_ERROR("init election module failed", KR(ret));
|
LOG_ERROR("init election module failed", KR(ret));
|
||||||
} else if (OB_FAIL(init_multi_tenant())) {
|
} else if (OB_FAIL(init_multi_tenant())) {
|
||||||
|
|||||||
@ -68,8 +68,13 @@ public:
|
|||||||
static constexpr int64_t MAX_THREAD_NUM = 1LL << POW_OF_2;// 4096
|
static constexpr int64_t MAX_THREAD_NUM = 1LL << POW_OF_2;// 4096
|
||||||
static constexpr int64_t MAX_THREAD_NUM_MASK = MAX_THREAD_NUM - 1;
|
static constexpr int64_t MAX_THREAD_NUM_MASK = MAX_THREAD_NUM - 1;
|
||||||
private:
|
private:
|
||||||
ObThreadHungDetector() : back_thread_(nullptr)
|
ObThreadHungDetector() : back_thread_(nullptr) {}
|
||||||
|
~ObThreadHungDetector()
|
||||||
{
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
int init() {
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
back_thread_ = (occam::ObOccamThread*)ob_malloc(sizeof(occam::ObOccamThread), "OccamTimeGuard");
|
back_thread_ = (occam::ObOccamThread*)ob_malloc(sizeof(occam::ObOccamThread), "OccamTimeGuard");
|
||||||
if (back_thread_ == nullptr) {
|
if (back_thread_ == nullptr) {
|
||||||
@ -108,12 +113,8 @@ private:
|
|||||||
OCCAM_LOG(ERROR, "init back thread failed");
|
OCCAM_LOG(ERROR, "init back thread failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
~ObThreadHungDetector()
|
|
||||||
{
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
void stop()
|
void stop()
|
||||||
{
|
{
|
||||||
if (back_thread_ != nullptr) {
|
if (back_thread_ != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user