From ff1f68e4a467e8c0152f23656e16e6f0e46ff834 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Mon, 6 Mar 2023 19:44:41 +0200 Subject: [PATCH] rgw: don't start the bucket notification thread in radosgw-admin Signed-off-by: Yuval Lifshitz --- src/rgw/driver/rados/rgw_rados.cc | 13 +++++++++---- src/rgw/driver/rados/rgw_rados.h | 8 +++++++- src/rgw/rgw_admin.cc | 1 + src/rgw/rgw_appmain.cc | 1 + src/rgw/rgw_object_expirer.cc | 2 +- src/rgw/rgw_realm_reloader.cc | 1 + src/rgw/rgw_sal.cc | 3 +++ src/rgw/rgw_sal.h | 3 +++ 8 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 0c82be3f0f4d3..3f2332db482ef 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -1065,7 +1065,9 @@ void RGWRados::finalize() delete reshard; delete index_completion_manager; - rgw::notify::shutdown(); + if (run_notification_thread) { + rgw::notify::shutdown(); + } } /** @@ -1314,9 +1316,12 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp) } index_completion_manager = new RGWIndexCompletionManager(this); - ret = rgw::notify::init(cct, driver, dpp); - if (ret < 0 ) { - ldpp_dout(dpp, 1) << "ERROR: failed to initialize notification manager" << dendl; + + if (run_notification_thread) { + ret = rgw::notify::init(cct, driver, dpp); + if (ret < 0 ) { + ldpp_dout(dpp, 1) << "ERROR: failed to initialize notification manager" << dendl; + } } return ret; diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index 869742922964d..87f7981287643 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -367,6 +367,7 @@ class RGWRados bool quota_threads; bool run_sync_thread; bool run_reshard_thread; + bool run_notification_thread; RGWMetaNotifier *meta_notifier; RGWDataNotifier *data_notifier; @@ -450,7 +451,7 @@ protected: public: RGWRados(): timer(NULL), gc(NULL), lc(NULL), obj_expirer(NULL), use_gc_thread(false), use_lc_thread(false), quota_threads(false), - run_sync_thread(false), run_reshard_thread(false), meta_notifier(NULL), + run_sync_thread(false), run_reshard_thread(false), run_notification_thread(false), meta_notifier(NULL), data_notifier(NULL), meta_sync_processor_thread(NULL), bucket_index_max_shards(0), max_bucket_id(0), cct(NULL), @@ -512,6 +513,11 @@ public: run_reshard_thread = _run_reshard_thread; return *this; } + + RGWRados& set_run_notification_thread(bool _run_notification_thread) { + run_notification_thread = _run_notification_thread; + return *this; + } librados::IoCtx* get_lc_pool_ctx() { return &lc_pool_ctx; diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 8745b5b3dd4b3..32eb80b19d1ba 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -4242,6 +4242,7 @@ int main(int argc, const char **argv) false, false, false, + false, need_cache && g_conf()->rgw_cache_enabled, need_gc); } diff --git a/src/rgw/rgw_appmain.cc b/src/rgw/rgw_appmain.cc index 361f622b992a7..64c3258a54b38 100644 --- a/src/rgw/rgw_appmain.cc +++ b/src/rgw/rgw_appmain.cc @@ -222,6 +222,7 @@ void rgw::AppMain::init_storage() run_quota, run_sync, g_conf().get_val("rgw_dynamic_resharding"), + true, // run notification thread g_conf()->rgw_cache_enabled); } /* init_storage */ diff --git a/src/rgw/rgw_object_expirer.cc b/src/rgw/rgw_object_expirer.cc index fd36a49c6fb22..c0a13e435135a 100644 --- a/src/rgw/rgw_object_expirer.cc +++ b/src/rgw/rgw_object_expirer.cc @@ -83,7 +83,7 @@ int main(const int argc, const char **argv) DriverManager::Config cfg; cfg.store_name = "rados"; cfg.filter_name = "none"; - driver = DriverManager::get_storage(&dp, g_ceph_context, cfg, false, false, false, false, false); + driver = DriverManager::get_storage(&dp, g_ceph_context, cfg, false, false, false, false, false, false); if (!driver) { std::cerr << "couldn't init storage provider" << std::endl; return EIO; diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc index 182cf16392f23..a9c314ed149b2 100644 --- a/src/rgw/rgw_realm_reloader.cc +++ b/src/rgw/rgw_realm_reloader.cc @@ -121,6 +121,7 @@ void RGWRealmReloader::reload() 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; diff --git a/src/rgw/rgw_sal.cc b/src/rgw/rgw_sal.cc index 58a21f707f58e..714b10abf1919 100644 --- a/src/rgw/rgw_sal.cc +++ b/src/rgw/rgw_sal.cc @@ -100,6 +100,7 @@ rgw::sal::Driver* DriverManager::init_storage_provider(const DoutPrefixProvider* bool quota_threads, bool run_sync_thread, bool run_reshard_thread, + bool run_notification_thread, bool use_cache, bool use_gc) { @@ -117,6 +118,7 @@ rgw::sal::Driver* DriverManager::init_storage_provider(const DoutPrefixProvider* .set_run_quota_threads(quota_threads) .set_run_sync_thread(run_sync_thread) .set_run_reshard_thread(run_reshard_thread) + .set_run_notification_thread(run_notification_thread) .init_begin(cct, dpp) < 0) { delete driver; return nullptr; @@ -143,6 +145,7 @@ rgw::sal::Driver* DriverManager::init_storage_provider(const DoutPrefixProvider* .set_run_quota_threads(quota_threads) .set_run_sync_thread(run_sync_thread) .set_run_reshard_thread(run_reshard_thread) + .set_run_notification_thread(run_notification_thread) .init_begin(cct, dpp) < 0) { delete driver; return nullptr; diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 037806d6854a9..0d756758cc4c7 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1576,6 +1576,7 @@ public: bool quota_threads, bool run_sync_thread, bool run_reshard_thread, + bool run_notification_thread, bool use_cache = true, bool use_gc = true) { rgw::sal::Driver* driver = init_storage_provider(dpp, cct, cfg, use_gc_thread, @@ -1583,6 +1584,7 @@ public: quota_threads, run_sync_thread, run_reshard_thread, + run_notification_thread, use_cache, use_gc); return driver; } @@ -1601,6 +1603,7 @@ public: bool quota_threads, bool run_sync_thread, bool run_reshard_thread, + bool run_notification_thread, bool use_metadata_cache, bool use_gc); /** Initialize a new raw Driver */ -- 2.39.5