From: Casey Bodley Date: Wed, 2 Nov 2022 17:29:50 +0000 (-0400) Subject: rgw: move lua_manager into RGWProcessEnv X-Git-Tag: v18.1.0~650^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0de9bd3fb6acf4a5aba545d8c856544fb19960fa;p=ceph.git rgw: move lua_manager into RGWProcessEnv each frontend no longer has to own/reload the lua manager themselves Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_appmain.cc b/src/rgw/rgw_appmain.cc index bef2bddd9bef0..23c60074c4018 100644 --- a/src/rgw/rgw_appmain.cc +++ b/src/rgw/rgw_appmain.cc @@ -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::iterator fiter = fe_map.begin(); diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 5cfd0dc6bd20b..659816b654fb5 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -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& 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 scheduler; - std::unique_ptr 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(); diff --git a/src/rgw/rgw_loadgen_process.cc b/src/rgw/rgw_loadgen_process.cc index d7aa78b578f99..c4467cb31467e 100644 --- a/src/rgw/rgw_loadgen_process.cc +++ b/src/rgw/rgw_loadgen_process.cc @@ -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; diff --git a/src/rgw/rgw_process.h b/src/rgw/rgw_process.h index d3a9f5cc24e80..5326c1572c842 100644 --- a/src/rgw/rgw_process.h +++ b/src/rgw/rgw_process.h @@ -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 lua_manager; }; class RGWFrontendConfig; @@ -50,7 +54,6 @@ protected: RGWFrontendConfig* conf; int sock_fd; std::string uri_prefix; - std::unique_ptr lua_manager; struct RGWWQ : public DoutPrefixProvider, public ThreadPool::WorkQueue { 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(); }