From 646db2175f019e8d7279086d4593e94a6df95cf7 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 13 Oct 2022 16:43:02 -0400 Subject: [PATCH] rgw: RGWRealmReloader reloads rgw::SiteConfig Signed-off-by: Casey Bodley --- src/rgw/rgw_realm_reloader.cc | 44 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc index a9c314ed149..a691d4db3ea 100644 --- a/src/rgw/rgw_realm_reloader.cc +++ b/src/rgw/rgw_realm_reloader.cc @@ -109,22 +109,24 @@ void RGWRealmReloader::reload() while (!env.driver) { - // recreate and initialize a new driver - DriverManager::Config cfg; - cfg.store_name = "rados"; - cfg.filter_name = "none"; - env.driver = - DriverManager::get_storage(&dp, cct, - cfg, - cct->_conf->rgw_enable_gc_threads, - cct->_conf->rgw_enable_lc_threads, - cct->_conf->rgw_enable_quota_threads, - cct->_conf->rgw_run_sync_thread, - cct->_conf.get_val("rgw_dynamic_resharding"), - true, // run notification thread - cct->_conf->rgw_cache_enabled); - - ldpp_dout(&dp, 1) << "Creating new driver" << dendl; + // reload the new configuration from ConfigStore + int r = env.site->load(&dp, null_yield, env.cfgstore); + if (r == 0) { + ldpp_dout(&dp, 1) << "Creating new driver" << dendl; + + // recreate and initialize a new driver + DriverManager::Config cfg; + cfg.store_name = "rados"; + cfg.filter_name = "none"; + env.driver = DriverManager::get_storage(&dp, cct, cfg, + cct->_conf->rgw_enable_gc_threads, + cct->_conf->rgw_enable_lc_threads, + cct->_conf->rgw_enable_quota_threads, + cct->_conf->rgw_run_sync_thread, + cct->_conf.get_val("rgw_dynamic_resharding"), + true, // run notification thread + cct->_conf->rgw_cache_enabled); + } rgw::sal::Driver* store_cleanup = nullptr; { @@ -135,13 +137,13 @@ void RGWRealmReloader::reload() // sleep until we get another notification, and retry until we get // a working configuration if (env.driver == nullptr) { - ldpp_dout(&dp, -1) << "Failed to reinitialize RGWRados after a realm " + ldpp_dout(&dp, -1) << "Failed to reload realm after a period " "configuration update. Waiting for a new update." << dendl; // sleep until another event is scheduled cond.wait(lock, [this] { return reload_scheduled; }); - ldout(cct, 1) << "Woke up with a new configuration, retrying " - "RGWRados initialization." << dendl; + ldpp_dout(&dp, 1) << "Woke up with a new configuration, retrying " + "realm reload." << dendl; } if (reload_scheduled) { @@ -156,8 +158,8 @@ void RGWRealmReloader::reload() } if (store_cleanup) { - ldpp_dout(&dp, 4) << "Got another notification, restarting RGWRados " - "initialization." << dendl; + ldpp_dout(&dp, 4) << "Got another notification, restarting realm " + "reload." << dendl; DriverManager::close_storage(store_cleanup); } -- 2.39.5