]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: move lua_manager into RGWProcessEnv
authorCasey Bodley <cbodley@redhat.com>
Wed, 2 Nov 2022 17:29:50 +0000 (13:29 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 9 Dec 2022 21:34:19 +0000 (16:34 -0500)
each frontend no longer has to own/reload the lua manager themselves

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_appmain.cc
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_loadgen_process.cc
src/rgw/rgw_process.h

index bef2bddd9bef03b1f381bce3132f681667978161..23c60074c4018e6ed419032e8af9f442ee6b70dc 100644 (file)
@@ -408,6 +408,7 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
       dpp->get_cct(), *implicit_tenant_context, env.driver);
   env.ratelimiting = ratelimiter.get();
   env.lua_background = lua_background.get();
+  env.lua_manager = env.driver->get_lua_manager();
 
   int fe_count = 0;
   for (multimap<string, RGWFrontendConfig *>::iterator fiter = fe_map.begin();
index 5cfd0dc6bd20b62b59350420c9c74a945f2cbfeb..659816b654fb531c8335a3c79eaafb0de65f6614 100644 (file)
@@ -184,7 +184,6 @@ void handle_connection(boost::asio::io_context& context,
                        SharedMutex& pause_mutex,
                        rgw::dmclock::Scheduler *scheduler,
                        const std::string& uri_prefix,
-                       std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
                        boost::system::error_code& ec,
                        yield_context yield)
 {
@@ -276,7 +275,7 @@ void handle_connection(boost::asio::io_context& context,
                       scheduler, &user, &latency,
                       env.ratelimiting->get_active(),
                       env.lua_background,
-                      lua_manager,
+                      env.lua_manager,
                       &http_ret);
 
       if (cct->_conf->subsys.should_gather(ceph_subsys_rgw_access, 1)) {
@@ -392,7 +391,6 @@ class AsioFrontend {
 #endif
   SharedMutex pause_mutex;
   std::unique_ptr<rgw::dmclock::Scheduler> scheduler;
-  std::unique_ptr<rgw::sal::LuaManager> lua_manager;
 
   struct Listener {
     tcp::endpoint endpoint;
@@ -423,8 +421,7 @@ class AsioFrontend {
  public:
   AsioFrontend(RGWProcessEnv& env, RGWFrontendConfig* conf,
               dmc::SchedulerCtx& sched_ctx)
-    : env(env), conf(conf), pause_mutex(context.get_executor()),
-    lua_manager(env.driver->get_lua_manager())
+    : env(env), conf(conf), pause_mutex(context.get_executor())
   {
     auto sched_t = dmc::get_scheduler_t(ctx());
     switch(sched_t){
@@ -1019,7 +1016,7 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
         conn->buffer.consume(bytes);
         handle_connection(context, env, stream, timeout, header_limit,
                           conn->buffer, true, pause_mutex, scheduler.get(),
-                          uri_prefix, lua_manager, ec, yield);
+                          uri_prefix, ec, yield);
         if (!ec) {
           // ssl shutdown (ignoring errors)
           stream.async_shutdown(yield[ec]);
@@ -1038,7 +1035,7 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
         boost::system::error_code ec;
         handle_connection(context, env, conn->socket, timeout, header_limit,
                           conn->buffer, false, pause_mutex, scheduler.get(),
-                          uri_prefix, lua_manager, ec, yield);
+                          uri_prefix, ec, yield);
         conn->socket.shutdown(tcp_socket::shutdown_both, ec);
       }, make_stack_allocator());
   }
@@ -1120,8 +1117,6 @@ void AsioFrontend::pause()
 
 void AsioFrontend::unpause()
 {
-  lua_manager = env.driver->get_lua_manager();
-
   // unpause to unblock connections
   pause_mutex.unlock();
 
index d7aa78b578f990ef013a1fd664b6aae290ef04e3..c4467cb31467ea7b859042d16cf2dd1d80caed6f 100644 (file)
@@ -138,7 +138,7 @@ void RGWLoadGenProcess::handle_request(const DoutPrefixProvider *dpp, RGWRequest
                             null_yield, nullptr, nullptr, nullptr,
                             ratelimit.get_active(),
                             nullptr,
-                            lua_manager);
+                            env.lua_manager);
   if (ret < 0) {
     /* we don't really care about return code */
     dout(20) << "process_request() returned " << ret << dendl;
index d3a9f5cc24e808a972d25d5a728bed44d054c3bd..5326c1572c84245e6a38ce7d5b18a483695565eb 100644 (file)
@@ -27,6 +27,9 @@ namespace rgw::dmclock {
 namespace rgw::lua {
   class Background;
 }
+namespace rgw::sal {
+  class LuaManager;
+}
 
 struct RGWProcessEnv {
   rgw::sal::Driver* driver = nullptr;
@@ -35,6 +38,7 @@ struct RGWProcessEnv {
   rgw_auth_registry_ptr_t auth_registry;
   ActiveRateLimiter* ratelimiting = nullptr;
   rgw::lua::Background* lua_background = nullptr;
+  std::unique_ptr<rgw::sal::LuaManager> lua_manager;
 };
 
 class RGWFrontendConfig;
@@ -50,7 +54,6 @@ protected:
   RGWFrontendConfig* conf;
   int sock_fd;
   std::string uri_prefix;
-  std::unique_ptr<rgw::sal::LuaManager> lua_manager;
 
   struct RGWWQ : public DoutPrefixProvider, public ThreadPool::WorkQueue<RGWRequest> {
     RGWProcess* process;
@@ -99,7 +102,6 @@ public:
       conf(conf),
       sock_fd(-1),
       uri_prefix(std::move(uri_prefix)),
-      lua_manager(env.driver->get_lua_manager()),
       req_wq(this,
             ceph::make_timespan(g_conf()->rgw_op_thread_timeout),
             ceph::make_timespan(g_conf()->rgw_op_thread_suicide_timeout),
@@ -116,7 +118,6 @@ public:
   }
 
   void unpause_with_new_config() {
-    lua_manager = env.driver->get_lua_manager();
     m_tp.unpause();
   }