From: Yuval Lifshitz Date: Tue, 14 Apr 2026 14:28:52 +0000 (+0000) Subject: rgw/s3vectors: support realm reload for background X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=98ffbe3a85b305465c35c6cd7501bce1c8cc2fb8;p=ceph.git rgw/s3vectors: support realm reload for background Signed-off-by: Yuval Lifshitz --- diff --git a/src/rgw/rgw_appmain.cc b/src/rgw/rgw_appmain.cc index a7858fa471b..a5f8c26cf30 100644 --- a/src/rgw/rgw_appmain.cc +++ b/src/rgw/rgw_appmain.cc @@ -519,8 +519,6 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib) derr << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl; /* ignore error */ } - s3vector::init(dpp, env.driver); - #ifdef WITH_RADOSGW_RADOS if (env.driver->get_name() == "rados") { // add a watcher to respond to realm configuration changes @@ -540,6 +538,9 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib) } if (dedup_background) { rgw_pauser->add_pauser(dedup_background.get()); + } + if (s3vector_pauser) { + rgw_pauser->add_pauser(s3vector_pauser.get()); } reloader = std::make_unique( env, *implicit_tenant_context, service_map_meta, rgw_pauser.get(), context_pool_holder.get()); @@ -617,6 +618,12 @@ void rgw::AppMain::init_kms_cache() dpp->get_cct(), Keyring::get_best()); } +void rgw::AppMain::init_s3vector() +{ + s3vector::init(dpp, env.driver); + s3vector_pauser = std::make_unique(dpp); +} + void rgw::AppMain::shutdown(std::function finalize_async_signals) { // stop the realm reloader @@ -658,6 +665,7 @@ void rgw::AppMain::shutdown(std::function finalize_async_signals) } s3vector::shutdown(); + s3vector_pauser.reset(); env.driver->shutdown(); // Do this before closing storage so requests don't try to call into diff --git a/src/rgw/rgw_lib.cc b/src/rgw/rgw_lib.cc index 2ea765b1390..d066d1b00d9 100644 --- a/src/rgw/rgw_lib.cc +++ b/src/rgw/rgw_lib.cc @@ -545,6 +545,7 @@ namespace rgw { } main.init_lua(); + main.init_s3vector(); #ifdef WITH_RADOSGW_RADOS main.init_dedup(); #endif diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index ebdff90c333..79cf7660578 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -166,6 +166,7 @@ int main(int argc, char *argv[]) main.init_tracepoints(); main.init_lua(); main.init_kms_cache(); + main.init_s3vector(); #ifdef WITH_RADOSGW_RADOS main.init_dedup(); #endif diff --git a/src/rgw/rgw_main.h b/src/rgw/rgw_main.h index 66f4c932af7..adcdc9cd291 100644 --- a/src/rgw/rgw_main.h +++ b/src/rgw/rgw_main.h @@ -31,6 +31,7 @@ #ifdef WITH_RADOSGW_RADOS #include "rgw_dedup.h" #endif +#include "rgw_s3vector_background.h" #include "rgw_dmclock_scheduler_ctx.h" #include "rgw_ratelimit.h" @@ -54,6 +55,18 @@ public: }; +class S3VectorPauser : public RGWRealmReloader::Pauser { + const DoutPrefixProvider* dpp; +public: + S3VectorPauser(const DoutPrefixProvider* dpp) : dpp(dpp) {} + void pause() override { + rgw::s3vector::pause(); + } + void resume(rgw::sal::Driver* driver) override { + rgw::s3vector::resume(dpp, driver); + } +}; + namespace rgw { namespace lua { class Background; } @@ -75,6 +88,7 @@ class AppMain { std::unique_ptr ldh; RGWREST rest; std::unique_ptr lua_background; + std::unique_ptr s3vector_pauser; #ifdef WITH_RADOSGW_RADOS std::unique_ptr dedup_background; #endif @@ -139,6 +153,7 @@ public: void init_tracepoints(); void init_lua(); void init_kms_cache(); + void init_s3vector(); #ifdef WITH_RADOSGW_RADOS void init_dedup(); #endif diff --git a/src/rgw/rgw_s3vector_background.cc b/src/rgw/rgw_s3vector_background.cc index d2dcda0a197..95e228504e2 100644 --- a/src/rgw/rgw_s3vector_background.cc +++ b/src/rgw/rgw_s3vector_background.cc @@ -259,6 +259,14 @@ void shutdown() { s_manager.reset(); } +void pause() { + shutdown(); +} + +void resume(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver) { + init(dpp, driver); +} + bool notify_index_update(const DoutPrefixProvider* dpp, const std::string& bucket_name, const std::string& index_name) { if (!s_manager) { ldpp_dout(dpp, 1) << "ERROR: failed to notify s3vectors manager about table update: manager is not initialized" << dendl; diff --git a/src/rgw/rgw_s3vector_background.h b/src/rgw/rgw_s3vector_background.h index 2ee8d72a2e9..4758b4ec15f 100644 --- a/src/rgw/rgw_s3vector_background.h +++ b/src/rgw/rgw_s3vector_background.h @@ -13,6 +13,8 @@ class DoutPrefixProvider; namespace rgw::s3vector { bool init(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver); void shutdown(); + void pause(); + void resume(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver); // update whenever new vectors are added to an index bool notify_index_update(const DoutPrefixProvider* dpp, const std::string& bucket_name, const std::string& index_name); }