finetune observer start for easier debug

This commit is contained in:
zhjc1124
2024-02-10 04:25:01 +00:00
committed by ob-robot
parent 18caf7e0ab
commit bef3ebb26f
3 changed files with 68 additions and 28 deletions

View File

@ -584,8 +584,10 @@ int main(int argc, char *argv[])
ATOMIC_STORE(&palf::election::INIT_TS, palf::election::get_monotonic_ts());
if (OB_FAIL(observer.init(opts, log_cfg))) {
LOG_ERROR("observer init fail", K(ret));
raise(SIGKILL); // force stop when fail
} else if (OB_FAIL(observer.start())) {
LOG_ERROR("observer start fail", K(ret));
raise(SIGKILL); // force stop when fail
} else if (OB_FAIL(observer.wait())) {
LOG_ERROR("observer wait fail", K(ret));
}

View File

@ -1018,37 +1018,26 @@ int ObServer::start()
FLOG_INFO("success to refresh server configure");
}
bool synced = false;
while (OB_SUCC(ret) && !stop_ && !synced) {
synced = multi_tenant_.has_synced();
if (!synced) {
SLEEP(1);
}
}
FLOG_INFO("check if multi tenant synced", KR(ret), K(stop_), K(synced));
bool schema_ready = false;
while (OB_SUCC(ret) && !stop_ && !schema_ready) {
schema_ready = schema_service_.is_sys_full_schema();
if (!schema_ready) {
SLEEP(1);
}
}
FLOG_INFO("check if schema ready", KR(ret), K(stop_), K(schema_ready));
bool timezone_usable = false;
if (FAILEDx(tenant_timezone_mgr_.start())) {
LOG_ERROR("fail to start tenant timezone mgr", KR(ret));
// check if multi tenant synced
if (FAILEDx(check_if_multi_tenant_synced())) {
LOG_ERROR("fail to check if multi tenant synced", KR(ret));
} else {
FLOG_INFO("success to start tenant timezone mgr");
FLOG_INFO("success to check if multi tenant synced");
}
while (OB_SUCC(ret) && !stop_ && !timezone_usable) {
timezone_usable = tenant_timezone_mgr_.is_usable();
if (!timezone_usable) {
SLEEP(1);
}
// check if schema ready
if (FAILEDx(check_if_schema_ready())) {
LOG_ERROR("fail to check if schema ready", KR(ret));
} else {
FLOG_INFO("success to check if schema ready");
}
// check if timezone usable
if (FAILEDx(check_if_timezone_usable())) {
LOG_ERROR("fail to check if timezone usable", KR(ret));
} else {
FLOG_INFO("success to check if timezone usable");
}
FLOG_INFO("check if timezone usable", KR(ret), K(stop_), K(timezone_usable));
// check log replay and user tenant schema refresh status
if (OB_SUCC(ret)) {
@ -1123,6 +1112,52 @@ int ObServer::try_update_hidden_sys()
return ret;
}
int ObServer::check_if_multi_tenant_synced()
{
int ret = OB_SUCCESS;
bool synced = false;
while (OB_SUCC(ret) && !stop_ && !synced) {
synced = multi_tenant_.has_synced();
if (!synced) {
SLEEP(1);
}
}
FLOG_INFO("check if multi tenant synced", KR(ret), K(stop_), K(synced));
return ret;
}
int ObServer::check_if_schema_ready()
{
int ret = OB_SUCCESS;
bool schema_ready = false;
while (OB_SUCC(ret) && !stop_ && !schema_ready) {
schema_ready = schema_service_.is_sys_full_schema();
if (!schema_ready) {
SLEEP(1);
}
}
FLOG_INFO("check if schema ready", KR(ret), K(stop_), K(schema_ready));
return ret;
}
int ObServer::check_if_timezone_usable()
{
int ret = OB_SUCCESS;
bool timezone_usable = false;
if (FAILEDx(tenant_timezone_mgr_.start())) {
LOG_ERROR("fail to start tenant timezone mgr", KR(ret));
} else {
FLOG_INFO("success to start tenant timezone mgr");
}
while (OB_SUCC(ret) && !stop_ && !timezone_usable) {
timezone_usable = tenant_timezone_mgr_.is_usable();
if (!timezone_usable) {
SLEEP(1);
}
}
FLOG_INFO("check if timezone usable", KR(ret), K(stop_), K(timezone_usable));
return ret;
}
void ObServer::prepare_stop()
{
prepare_stop_ = true;

View File

@ -318,6 +318,9 @@ private:
void check_user_tenant_schema_refreshed(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
void check_log_replay_over(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
int try_update_hidden_sys();
int check_if_multi_tenant_synced();
int check_if_schema_ready();
int check_if_timezone_usable();
int parse_mode();
void deinit_zlib_lite_compressor();