diff --git a/src/observer/main.cpp b/src/observer/main.cpp index 6b7c4224e2..36c4b9e875 100644 --- a/src/observer/main.cpp +++ b/src/observer/main.cpp @@ -587,6 +587,7 @@ int main(int argc, char *argv[]) } print_all_thread("BEFORE_DESTROY"); observer.destroy(); + ObTaskController::get().destroy(); ObKVGlobalCache::get_instance().destroy(); ObVirtualTenantManager::get_instance().destroy(); } @@ -595,8 +596,6 @@ int main(int argc, char *argv[]) } LOG_INFO("observer exits", "observer_version", PACKAGE_STRING); - OB_LOGGER.stop(); - OB_LOGGER.wait(); OB_LOGGER.destroy(); print_all_thread("AFTER_DESTROY"); return ret; diff --git a/src/observer/ob_server.cpp b/src/observer/ob_server.cpp index d0e6d7a9f3..d631ecf225 100644 --- a/src/observer/ob_server.cpp +++ b/src/observer/ob_server.cpp @@ -605,10 +605,6 @@ void ObServer::destroy() TG_DESTROY(lib::TGDefIDs::DiskUseReport); FLOG_INFO("disk usage report task destroyed"); - FLOG_INFO("begin destroy task controller"); - ObTaskController::get().destroy(); - FLOG_INFO("task controller destroyed"); - FLOG_INFO("begin to destroy ob server block mgr"); OB_SERVER_BLOCK_MGR.destroy(); FLOG_INFO("ob server block mgr destroyed"); @@ -697,6 +693,10 @@ void ObServer::destroy() OB_PRIMARY_STANDBY_SERVICE.destroy(); FLOG_INFO("OB_PRIMARY_STANDBY_SERVICE destroyed"); + FLOG_INFO("begin to destroy rootservice event history"); + ROOTSERVICE_EVENT_INSTANCE.destroy(); + FLOG_INFO("rootservice event history destroyed"); + has_destroy_ = true; FLOG_INFO("[OBSERVER_NOTICE] destroy observer end"); @@ -1112,10 +1112,6 @@ int ObServer::stop() schema_service_.stop(); FLOG_INFO("schema service stopped"); - FLOG_INFO("begin to stop ob_service"); - ob_service_.stop(); - FLOG_INFO("ob_service stopped"); - FLOG_INFO("begin to stop disk usage report task"); TG_STOP(lib::TGDefIDs::DiskUseReport); FLOG_INFO("disk usage report task stopped"); @@ -1223,10 +1219,6 @@ int ObServer::stop() tenant_srs_mgr_.stop(); FLOG_INFO("tenant srs manager stopped"); - FLOG_INFO("begin stop task controller"); - ObTaskController::get().stop(); - FLOG_INFO("task controller stopped"); - FLOG_INFO("begin to stop opt stat manager "); ObOptStatManager::get_instance().stop(); FLOG_INFO("opt stat manager stopped"); @@ -1240,6 +1232,10 @@ int ObServer::stop() multi_tenant_.stop(); FLOG_INFO("multi tenant stopped"); + FLOG_INFO("begin to stop ob_service"); + ob_service_.stop(); + FLOG_INFO("ob_service stopped"); + // safe destroy instance should stop after multi_tenant_ FLOG_INFO("begin to stop safe destroy instance"); SAFE_DESTROY_INSTANCE.stop(); @@ -1300,12 +1296,18 @@ int ObServer::stop() } else { FLOG_INFO("net frame stopped"); } + + FLOG_INFO("begin to stop global_poc_server"); + obrpc::global_poc_server.stop(); + FLOG_INFO("stop global_poc_server success"); + + FLOG_INFO("begin to stop rootservice event history"); + ROOTSERVICE_EVENT_INSTANCE.stop(); + FLOG_INFO("rootservice event history stopped"); + } - FLOG_INFO("begin to stop global_poc_server"); - obrpc::global_poc_server.stop(); - FLOG_INFO("stop global_poc_server success"); has_stopped_ = true; FLOG_INFO("[OBSERVER_NOTICE] stop observer end", KR(ret)); @@ -1496,10 +1498,6 @@ int ObServer::wait() tenant_srs_mgr_.wait(); FLOG_INFO("wait tenant srs manager success"); - FLOG_INFO("begin wait task controller"); - ObTaskController::get().wait(); - FLOG_INFO("wait task controller success"); - FLOG_INFO("begin to wait ob_server_block_mgr"); OB_SERVER_BLOCK_MGR.wait(); FLOG_INFO("wait ob_server_block_mgr success"); @@ -1545,6 +1543,14 @@ int ObServer::wait() FLOG_INFO("wait global election report timer stopped done"); + FLOG_INFO("begin to wait global_poc_server"); + obrpc::global_poc_server.wait(); + FLOG_INFO("wait global_poc_server success"); + + FLOG_INFO("begin to wait rootservice event history"); + ROOTSERVICE_EVENT_INSTANCE.wait(); + FLOG_INFO("wait rootservice event history success"); + gctx_.status_ = SS_STOPPED; FLOG_INFO("[OBSERVER_NOTICE] wait observer end", KR(ret)); if (OB_SUCCESS != fail_ret) { @@ -1552,10 +1558,6 @@ int ObServer::wait() } } - FLOG_INFO("begin to wait global_poc_server"); - obrpc::global_poc_server.wait(); - FLOG_INFO("wait global_poc_server success"); - return ret; } diff --git a/src/observer/ob_service.cpp b/src/observer/ob_service.cpp index f7a5b2468a..02459cf5b2 100644 --- a/src/observer/ob_service.cpp +++ b/src/observer/ob_service.cpp @@ -328,6 +328,10 @@ void ObService::stop() FLOG_INFO("begin to stop server event instance"); SERVER_EVENT_INSTANCE.stop(); FLOG_INFO("server event instance stopped"); + + FLOG_INFO("begin to stop cluster event instance"); + CLUSTER_EVENT_INSTANCE.stop(); + FLOG_INFO("cluster event instance stopped"); } FLOG_INFO("[OBSERVICE_NOTICE] observice finish stop", K_(stopped)); } @@ -365,6 +369,10 @@ void ObService::wait() FLOG_INFO("begin to wait server event instance"); SERVER_EVENT_INSTANCE.wait(); FLOG_INFO("wait server event instance success"); + + FLOG_INFO("begin to wait cluster event instance"); + CLUSTER_EVENT_INSTANCE.wait(); + FLOG_INFO("wait cluster event instance success"); } FLOG_INFO("[OBSERVICE_NOTICE] wait ob_service end"); } diff --git a/src/rootserver/ob_root_service.cpp b/src/rootserver/ob_root_service.cpp index c2bf713386..2073c45d22 100644 --- a/src/rootserver/ob_root_service.cpp +++ b/src/rootserver/ob_root_service.cpp @@ -1018,10 +1018,6 @@ void ObRootService::destroy() FLOG_INFO("heartbeat checker destroy"); } - ROOTSERVICE_EVENT_INSTANCE.destroy(); - FLOG_INFO("event table operator destroy"); - - if (OB_FAIL(backup_task_scheduler_.destroy())) { FLOG_WARN("root backup task scheduler destroy failed", KR(ret)); fail_ret = OB_SUCCESS == fail_ret ? ret : fail_ret; @@ -1268,8 +1264,6 @@ int ObRootService::stop() FLOG_INFO("backup_task_scheduler_ stop"); backup_service_.stop(); FLOG_INFO("backup_mgr stop"); - ROOTSERVICE_EVENT_INSTANCE.stop(); - FLOG_INFO("event table operator stop"); disaster_recovery_task_mgr_.stop(); FLOG_INFO("disaster_recovery_task_mgr stop"); dbms_scheduler::ObDBMSSchedJobMaster::get_instance().stop(); @@ -1316,8 +1310,6 @@ void ObRootService::wait() FLOG_INFO("root backup task scheduler exit success"); backup_service_.wait(); FLOG_INFO("root backup mgr exit success"); - ROOTSERVICE_EVENT_INSTANCE.wait(); - FLOG_INFO("event table operator exit success"); disaster_recovery_task_mgr_.wait(); FLOG_INFO("rebalance task mgr exit success"); TG_WAIT(lib::TGDefIDs::GlobalCtxTimer);