finetune observer start for easier debug
This commit is contained in:
		@ -584,8 +584,10 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
      ATOMIC_STORE(&palf::election::INIT_TS, palf::election::get_monotonic_ts());
 | 
					      ATOMIC_STORE(&palf::election::INIT_TS, palf::election::get_monotonic_ts());
 | 
				
			||||||
      if (OB_FAIL(observer.init(opts, log_cfg))) {
 | 
					      if (OB_FAIL(observer.init(opts, log_cfg))) {
 | 
				
			||||||
        LOG_ERROR("observer init fail", K(ret));
 | 
					        LOG_ERROR("observer init fail", K(ret));
 | 
				
			||||||
 | 
					        raise(SIGKILL); // force stop when fail
 | 
				
			||||||
      } else if (OB_FAIL(observer.start())) {
 | 
					      } else if (OB_FAIL(observer.start())) {
 | 
				
			||||||
        LOG_ERROR("observer start fail", K(ret));
 | 
					        LOG_ERROR("observer start fail", K(ret));
 | 
				
			||||||
 | 
					        raise(SIGKILL); // force stop when fail
 | 
				
			||||||
      } else if (OB_FAIL(observer.wait())) {
 | 
					      } else if (OB_FAIL(observer.wait())) {
 | 
				
			||||||
        LOG_ERROR("observer wait fail", K(ret));
 | 
					        LOG_ERROR("observer wait fail", K(ret));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -1018,37 +1018,26 @@ int ObServer::start()
 | 
				
			|||||||
      FLOG_INFO("success to refresh server configure");
 | 
					      FLOG_INFO("success to refresh server configure");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool synced = false;
 | 
					    // check if multi tenant synced
 | 
				
			||||||
    while (OB_SUCC(ret) && !stop_ && !synced) {
 | 
					    if (FAILEDx(check_if_multi_tenant_synced())) {
 | 
				
			||||||
      synced = multi_tenant_.has_synced();
 | 
					      LOG_ERROR("fail to check if multi tenant synced", KR(ret));
 | 
				
			||||||
      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));
 | 
					 | 
				
			||||||
    } else {
 | 
					    } 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();
 | 
					    // check if schema ready
 | 
				
			||||||
      if (!timezone_usable) {
 | 
					    if (FAILEDx(check_if_schema_ready())) {
 | 
				
			||||||
        SLEEP(1);
 | 
					      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
 | 
					    // check log replay and user tenant schema refresh status
 | 
				
			||||||
    if (OB_SUCC(ret)) {
 | 
					    if (OB_SUCC(ret)) {
 | 
				
			||||||
@ -1123,6 +1112,52 @@ int ObServer::try_update_hidden_sys()
 | 
				
			|||||||
  return ret;
 | 
					  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()
 | 
					void ObServer::prepare_stop()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  prepare_stop_ = true;
 | 
					  prepare_stop_ = true;
 | 
				
			||||||
 | 
				
			|||||||
@ -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_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);
 | 
					  void check_log_replay_over(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
 | 
				
			||||||
  int try_update_hidden_sys();
 | 
					  int try_update_hidden_sys();
 | 
				
			||||||
 | 
					  int check_if_multi_tenant_synced();
 | 
				
			||||||
 | 
					  int check_if_schema_ready();
 | 
				
			||||||
 | 
					  int check_if_timezone_usable();
 | 
				
			||||||
  int parse_mode();
 | 
					  int parse_mode();
 | 
				
			||||||
  void deinit_zlib_lite_compressor();
 | 
					  void deinit_zlib_lite_compressor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user