diff --git a/src/observer/ob_server.cpp b/src/observer/ob_server.cpp index f05f1cad10..d5804b30e8 100644 --- a/src/observer/ob_server.cpp +++ b/src/observer/ob_server.cpp @@ -475,6 +475,26 @@ void ObServer::destroy() FLOG_INFO("[OBSERVER_NOTICE] destroy observer begin"); if (is_arbitration_mode()) { } else if (!has_destroy_ && has_stopped_) { + FLOG_INFO("begin destroy signal worker"); + sig_worker_->destroy(); + FLOG_INFO("signal worker destroyed"); + + FLOG_INFO("begin destroy signal handle"); + signal_handle_->destroy(); + FLOG_INFO("signal handle destroyed"); + + FLOG_INFO("begin to destroy ObLogger"); + OB_LOGGER.destroy(); + FLOG_INFO("ObLogger destroyed"); + + FLOG_INFO("active session history task destroyed"); + ObClockGenerator::destroy(); + FLOG_INFO("clock generator destroyed"); + + FLOG_INFO("opt stat manager destroyed"); + ObOptStatManager::get_instance().destroy(); + FLOG_INFO("opt stat manager destroyed"); + FLOG_INFO("begin to destroy active session history task"); ObActiveSessHistTask::get_instance().destroy(); FLOG_INFO("active session history task destroyed"); @@ -985,6 +1005,14 @@ int ObServer::stop() FLOG_INFO("end to stop imc tasks", KR(ret)); #endif + FLOG_INFO("begin stop signal worker"); + sig_worker_->stop(); + FLOG_INFO("stop signal worker success"); + + FLOG_INFO("begin stop signal handle"); + signal_handle_->stop(); + FLOG_INFO("stop signal handle success"); + FLOG_INFO("begin to stop server blacklist"); TG_STOP(lib::TGDefIDs::Blacklist); FLOG_INFO("server blacklist stopped"); @@ -1121,10 +1149,17 @@ int ObServer::stop() bl_service_.stop(); FLOG_INFO("blacklist service stopped"); + FLOG_INFO("begin to stop tenant timezone manager"); + tenant_timezone_mgr_.stop(); + FLOG_INFO("tenant timezone manager stopped"); //FLOG_INFO("begin stop partition scheduler"); //ObPartitionScheduler::get_instance().stop_merge(); //FLOG_INFO("partition scheduler stopped", KR(ret)); + FLOG_INFO("begin to stop opt stat manager "); + ObOptStatManager::get_instance().stop(); + FLOG_INFO("opt stat manager stopped"); + FLOG_INFO("begin to stop server checkpoint slog handler"); ObServerCheckpointSlogHandler::get_instance().stop(); FLOG_INFO("server checkpoint slog handler stopped"); @@ -1234,6 +1269,15 @@ int ObServer::wait() if (is_arbitration_mode()) { } else { + + FLOG_INFO("begin wait signal worker"); + sig_worker_->wait(); + FLOG_INFO("wait signal worker success"); + + FLOG_INFO("begin wait signal handle"); + signal_handle_->wait(); + FLOG_INFO("wait signal handle success"); + FLOG_INFO("begin to wait active session hist task"); ObActiveSessHistTask::get_instance().wait(); FLOG_INFO("wait active session hist task success"); @@ -1376,6 +1420,14 @@ int ObServer::wait() bl_service_.wait(); FLOG_INFO("wait blacklist service success"); + FLOG_INFO("begin to wait tenant timezone manager"); + tenant_timezone_mgr_.wait(); + FLOG_INFO("wait tenant timezone manager success"); + + FLOG_INFO("begin to wait opt stat manager"); + ObOptStatManager::get_instance().wait(); + FLOG_INFO("wait opt stat manager success"); + FLOG_INFO("begin to wait server checkpoint slog handler"); ObServerCheckpointSlogHandler::get_instance().wait(); FLOG_INFO("wait server checkpoint slog handler success"); diff --git a/src/observer/omt/ob_tenant_timezone_mgr.cpp b/src/observer/omt/ob_tenant_timezone_mgr.cpp index 24d4e4958a..499748fb98 100644 --- a/src/observer/omt/ob_tenant_timezone_mgr.cpp +++ b/src/observer/omt/ob_tenant_timezone_mgr.cpp @@ -105,7 +105,6 @@ ObTenantTimezoneMgr::ObTenantTimezoneMgr() ObTenantTimezoneMgr::~ObTenantTimezoneMgr() { - TG_DESTROY(lib::TGDefIDs::TIMEZONE_MGR); } ObTenantTimezoneMgr &ObTenantTimezoneMgr::get_instance() @@ -149,8 +148,19 @@ void ObTenantTimezoneMgr::init(tenant_timezone_map_getter tz_map_getter) is_inited_ = true; } +void ObTenantTimezoneMgr::stop() +{ + TG_STOP(lib::TGDefIDs::TIMEZONE_MGR); +} + +void ObTenantTimezoneMgr::wait() +{ + TG_WAIT(lib::TGDefIDs::TIMEZONE_MGR); +} + void ObTenantTimezoneMgr::destroy() { + TG_DESTROY(lib::TGDefIDs::TIMEZONE_MGR); timezone_map_.destroy(); } diff --git a/src/observer/omt/ob_tenant_timezone_mgr.h b/src/observer/omt/ob_tenant_timezone_mgr.h index 7b10a3661e..f678e3897c 100644 --- a/src/observer/omt/ob_tenant_timezone_mgr.h +++ b/src/observer/omt/ob_tenant_timezone_mgr.h @@ -137,6 +137,9 @@ public: void set_start_refresh(bool start) { start_refresh_ = start; } bool is_usable() { return usable_; } void set_usable() { usable_ = true; } + + void stop(); + void wait(); void destroy(); private: diff --git a/src/share/config/ob_config_manager.cpp b/src/share/config/ob_config_manager.cpp index b07de8f9fa..192f2965d1 100644 --- a/src/share/config/ob_config_manager.cpp +++ b/src/share/config/ob_config_manager.cpp @@ -73,6 +73,21 @@ int ObConfigManager::init(ObMySQLProxy &sql_proxy, const ObAddr &server) return ret; } +void ObConfigManager::stop() +{ + TG_STOP(lib::TGDefIDs::CONFIG_MGR); +} + +void ObConfigManager::wait() +{ + TG_WAIT(lib::TGDefIDs::CONFIG_MGR); +} + +void ObConfigManager::destroy() +{ + TG_DESTROY(lib::TGDefIDs::CONFIG_MGR); +} + int ObConfigManager::reload_config() { int ret = OB_SUCCESS; diff --git a/src/share/config/ob_config_manager.h b/src/share/config/ob_config_manager.h index fbe99effca..3156f88f43 100644 --- a/src/share/config/ob_config_manager.h +++ b/src/share/config/ob_config_manager.h @@ -44,6 +44,9 @@ public: int init(const ObAddr &server); int init(ObMySQLProxy &sql_proxy, const ObAddr &server); + void stop(); + void wait(); + void destroy(); int check_header_change(const char* path, const char* buf) const; // manual dump to file named by path diff --git a/src/share/location_cache/ob_location_service.cpp b/src/share/location_cache/ob_location_service.cpp index 18f7c19024..a095c67e01 100644 --- a/src/share/location_cache/ob_location_service.cpp +++ b/src/share/location_cache/ob_location_service.cpp @@ -319,12 +319,14 @@ void ObLocationService::stop() { ls_location_service_.stop(); tablet_ls_service_.stop(); + vtable_location_service_.stop(); } void ObLocationService::wait() { ls_location_service_.wait(); tablet_ls_service_.wait(); + vtable_location_service_.wait(); } int ObLocationService::destroy() @@ -334,6 +336,8 @@ int ObLocationService::destroy() LOG_WARN("destroy ls_location_service failed", KR(ret)); } else if (OB_FAIL(tablet_ls_service_.destroy())) { LOG_WARN("destroy tablet_ls_service failed", KR(ret)); + } else if(OB_FAIL(vtable_location_service_.destroy())){ + LOG_WARN("destroy vtable_location_service failed", KR(ret)); } else { stopped_ = true; inited_ = false; diff --git a/src/share/location_cache/ob_vtable_location_service.cpp b/src/share/location_cache/ob_vtable_location_service.cpp index dfa76df54f..e6a9dc71de 100644 --- a/src/share/location_cache/ob_vtable_location_service.cpp +++ b/src/share/location_cache/ob_vtable_location_service.cpp @@ -90,6 +90,23 @@ int ObVTableLocationService::init( return ret; } +void ObVTableLocationService::stop() +{ + update_queue_.stop(); +} + +void ObVTableLocationService::wait() +{ + update_queue_.wait(); +} + +int ObVTableLocationService::destroy() +{ + int ret = OB_SUCCESS; + update_queue_.destroy(); + vtable_cache_.destroy(); + return ret; +} //TODO: 1.remove ObPartitionLocation 2.add auto renew 3.cached by tenant_id int ObVTableLocationService::vtable_get( const uint64_t tenant_id, diff --git a/src/share/location_cache/ob_vtable_location_service.h b/src/share/location_cache/ob_vtable_location_service.h index 0c649abe4d..d140196c8b 100644 --- a/src/share/location_cache/ob_vtable_location_service.h +++ b/src/share/location_cache/ob_vtable_location_service.h @@ -77,6 +77,9 @@ public: ObIAliveServerTracer &server_tracer, ObRsMgr &rs_mgr, obrpc::ObCommonRpcProxy &rpc_proxy); + void stop(); + void wait(); + int destroy(); int vtable_get( const uint64_t tenant_id, const uint64_t table_id, diff --git a/src/share/stat/ob_opt_stat_manager.cpp b/src/share/stat/ob_opt_stat_manager.cpp index 4521a2d145..74527cf374 100644 --- a/src/share/stat/ob_opt_stat_manager.cpp +++ b/src/share/stat/ob_opt_stat_manager.cpp @@ -91,6 +91,21 @@ int ObOptStatManager::init(ObMySQLProxy *proxy, return ret; } +void ObOptStatManager::stop() +{ + refresh_stat_task_queue_.stop(); +} + +void ObOptStatManager::wait() +{ + refresh_stat_task_queue_.wait(); +} + +void ObOptStatManager::destroy() +{ + refresh_stat_task_queue_.destroy(); +} + int ObOptStatManager::add_refresh_stat_task(const obrpc::ObUpdateStatCacheArg &analyze_arg) { int ret = OB_SUCCESS; diff --git a/src/share/stat/ob_opt_stat_manager.h b/src/share/stat/ob_opt_stat_manager.h index 5af7164417..639b385879 100644 --- a/src/share/stat/ob_opt_stat_manager.h +++ b/src/share/stat/ob_opt_stat_manager.h @@ -35,7 +35,9 @@ public: virtual ~ObOptStatManager() {} virtual int init(ObMySQLProxy *proxy, ObServerConfig *config); - + virtual void stop(); + virtual void wait(); + virtual void destroy(); static int64_t get_default_data_size(); static int64_t get_default_avg_row_size(); diff --git a/src/storage/ob_locality_manager.cpp b/src/storage/ob_locality_manager.cpp index 12938d920f..cdf777bb87 100644 --- a/src/storage/ob_locality_manager.cpp +++ b/src/storage/ob_locality_manager.cpp @@ -53,6 +53,7 @@ void ObLocalityManager::destroy() TG_DESTROY(lib::TGDefIDs::LocalityReload); locality_info_.destroy(); server_locality_cache_.destroy(); + refresh_locality_task_queue_.destroy(); STORAGE_LOG(INFO, "ObLocalityManager destroy finished"); } }