]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/lua: don't create the script manager per request 46304/head
authoryuval Lifshitz <ylifshit@redhat.com>
Tue, 17 May 2022 13:51:32 +0000 (16:51 +0300)
committeryuval Lifshitz <ylifshit@redhat.com>
Sun, 7 Aug 2022 09:28:33 +0000 (12:28 +0300)
Fixes: https://tracker.ceph.com/issues/53810
Signed-off-by: yuval Lifshitz <ylifshit@redhat.com>
12 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_loadgen_process.cc
src/rgw/rgw_lua.cc
src/rgw/rgw_lua.h
src/rgw/rgw_lua_background.cc
src/rgw/rgw_lua_background.h
src/rgw/rgw_process.cc
src/rgw/rgw_process.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/test/rgw/test_rgw_lua.cc

index ee7c926ed7aab297e2d45df949b54d9ba1a96d0c..95b8e40453a2c15eaef472e2cecc6ce73106dd39 100644 (file)
@@ -10394,7 +10394,8 @@ next:
       cerr << "ERROR: cannot specify tenant in background context" << std::endl;
       return EINVAL;
     }
-    rc = rgw::lua::write_script(dpp(), store, tenant, null_yield, script_ctx, script);
+    auto lua_manager = store->get_lua_manager();
+    rc = rgw::lua::write_script(dpp(), lua_manager.get(), tenant, null_yield, script_ctx, script);
     if (rc < 0) {
       cerr << "ERROR: failed to put script. error: " << rc << std::endl;
       return -rc;
@@ -10411,8 +10412,9 @@ next:
       cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: preRequest, postRequest, background" << std::endl;
       return EINVAL;
     }
+    auto lua_manager = store->get_lua_manager();
     std::string script;
-    const auto rc = rgw::lua::read_script(dpp(), store, tenant, null_yield, script_ctx, script);
+    const auto rc = rgw::lua::read_script(dpp(), lua_manager.get(), tenant, null_yield, script_ctx, script);
     if (rc == -ENOENT) {
       std::cout << "no script exists for context: " << *str_script_ctx << 
         (tenant.empty() ? "" : (" in tenant: " + tenant)) << std::endl;
@@ -10434,7 +10436,8 @@ next:
       cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: preRequest, postRequest, background" << std::endl;
       return EINVAL;
     }
-    const auto rc = rgw::lua::delete_script(dpp(), store, tenant, null_yield, script_ctx);
+    auto lua_manager = store->get_lua_manager();
+    const auto rc = rgw::lua::delete_script(dpp(), lua_manager.get(), tenant, null_yield, script_ctx);
     if (rc < 0) {
       cerr << "ERROR: failed to remove script. error: " << rc << std::endl;
       return -rc;
index 8f2c8a25b8ebf7db9b8a935c1630df3397a4a641..064a6d72ffd3de36d0b7bb8a73a22ffbab1f2459 100644 (file)
@@ -183,6 +183,7 @@ void handle_connection(boost::asio::io_context& context,
                        parse_buffer& buffer, bool is_ssl,
                        SharedMutex& pause_mutex,
                        rgw::dmclock::Scheduler *scheduler,
+                       std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
                        boost::system::error_code& ec,
                        yield_context yield)
 {
@@ -269,7 +270,9 @@ void handle_connection(boost::asio::io_context& context,
                       *env.auth_registry, &client, env.olog, y,
                       scheduler, &user, &latency,
                       env.ratelimiting->get_active(),
-                      &http_ret, env.lua_background);
+                      env.lua_background,
+                      lua_manager,
+                      &http_ret);
 
       if (cct->_conf->subsys.should_gather(ceph_subsys_rgw_access, 1)) {
         // access log line elements begin per Apache Combined Log Format with additions following
@@ -383,6 +386,7 @@ 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;
@@ -413,7 +417,8 @@ class AsioFrontend {
  public:
   AsioFrontend(const RGWProcessEnv& env, RGWFrontendConfig* conf,
               dmc::SchedulerCtx& sched_ctx)
-    : env(env), conf(conf), pause_mutex(context.get_executor())
+    : env(env), conf(conf), pause_mutex(context.get_executor()),
+    lua_manager(env.store->get_lua_manager())
   {
     auto sched_t = dmc::get_scheduler_t(ctx());
     switch(sched_t){
@@ -1004,6 +1009,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(),
+                          lua_manager,
                           ec, yield);
         if (!ec) {
           // ssl shutdown (ignoring errors)
@@ -1023,6 +1029,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(),
+                          lua_manager,
                           ec, yield);
         conn->socket.shutdown(tcp_socket::shutdown_both, ec);
       }, make_stack_allocator());
@@ -1108,6 +1115,7 @@ void AsioFrontend::unpause(rgw::sal::Store* const store,
 {
   env.store = store;
   env.auth_registry = std::move(auth_registry);
+  lua_manager = store->get_lua_manager();
 
   // unpause to unblock connections
   pause_mutex.unlock();
index 38b7510974360f166a8b552ed848814e0e8ec1ee..e5a966b4fd779d9a2a49575bd29eff0183e2dbb1 100644 (file)
@@ -137,7 +137,9 @@ void RGWLoadGenProcess::handle_request(const DoutPrefixProvider *dpp, RGWRequest
   int ret = process_request(store, rest, req, uri_prefix,
                             *auth_registry, &client_io, olog,
                             null_yield, nullptr, nullptr, nullptr,
-                            ratelimit.get_active(), nullptr);
+                            ratelimit.get_active(),
+                            nullptr,
+                            lua_manager);
   if (ret < 0) {
     /* we don't really care about return code */
     dout(20) << "process_request() returned " << ret << dendl;
index e0f61049b605893a7a015f449dd7a14654243acc..2d4833e2ebf4ddd2e0539a282dded90a3140b808 100644 (file)
@@ -67,25 +67,21 @@ std::string script_oid(context ctx, const std::string& tenant) {
 }
 
 
-int read_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, std::string& script)
+int read_script(const DoutPrefixProvider *dpp, sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx, std::string& script)
 {
-  auto lua_mgr = store->get_lua_manager();
 
-  return lua_mgr->get_script(dpp, y, script_oid(ctx, tenant), script);
+  return manager->get_script(dpp, y, script_oid(ctx, tenant), script);
+
 }
 
-int write_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script)
+int write_script(const DoutPrefixProvider *dpp, sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx, const std::string& script)
 {
-  auto lua_mgr = store->get_lua_manager();
-
-  return lua_mgr->put_script(dpp, y, script_oid(ctx, tenant), script);
+  return manager->put_script(dpp, y, script_oid(ctx, tenant), script);
 }
 
-int delete_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx)
+int delete_script(const DoutPrefixProvider *dpp, sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx)
 {
-  auto lua_mgr = store->get_lua_manager();
-
-  return lua_mgr->del_script(dpp, y, script_oid(ctx, tenant));
+  return manager->del_script(dpp, y, script_oid(ctx, tenant));
 }
 
 #ifdef WITH_RADOSGW_LUA_PACKAGES
index 0596ee104115ca2873f64ac1ed3b17bafbe6653f..562a80c6c3d3330975635b9d645a0592141389a4 100644 (file)
@@ -9,8 +9,10 @@
 
 class lua_State;
 class rgw_user;
+class DoutPrefixProvider;
 namespace rgw::sal {
   class RadosStore;
+  class LuaManager;
 }
 
 namespace rgw::lua {
@@ -31,13 +33,13 @@ context to_context(const std::string& s);
 bool verify(const std::string& script, std::string& err_msg);
 
 // store a lua script in a context
-int write_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script);
+int write_script(const DoutPrefixProvider *dpp, rgw::sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx, const std::string& script);
 
 // read the stored lua script from a context
-int read_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, std::string& script);
+int read_script(const DoutPrefixProvider *dpp, rgw::sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx, std::string& script);
 
 // delete the stored lua script from a context
-int delete_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx);
+int delete_script(const DoutPrefixProvider *dpp, rgw::sal::LuaManager* manager, const std::string& tenant, optional_yield y, context ctx);
 
 using packages_t = std::set<std::string>;
 
index ea85193edf7c4a7a66a6857fc93ae3b8a11a71f7..a8d31c8ab3615c128e09b9906af54bd009e5ac3a 100644 (file)
@@ -1,3 +1,4 @@
+#include "rgw_sal_rados.h"
 #include "rgw_lua_background.h"
 #include "rgw_lua.h"
 #include "rgw_lua_utils.h"
@@ -61,7 +62,7 @@ Background::Background(rgw::sal::Store* store,
       int execute_interval) :
     execute_interval(execute_interval),
     dp(cct, dout_subsys, "lua background: "),
-    store(store),
+    lua_manager(store->get_lua_manager()),
     cct(cct),
     luarocks_path(luarocks_path) {}
 
@@ -95,8 +96,8 @@ void Background::pause() {
   cond.notify_all();
 }
 
-void Background::resume(rgw::sal::Store* _store) {
-  store = _store;
+void Background::resume(rgw::sal::Store* store) {
+  lua_manager = store->get_lua_manager();
   paused = false;
   cond.notify_all();
 }
@@ -107,7 +108,7 @@ int Background::read_script() {
     return -EAGAIN;
   }
   std::string tenant;
-  return rgw::lua::read_script(&dp, store, tenant, null_yield, rgw::lua::context::background, rgw_script);
+  return rgw::lua::read_script(&dp, lua_manager.get(), tenant, null_yield, rgw::lua::context::background, rgw_script);
 }
 
 const BackgroundMapValue Background::empty_table_value;
index c6051164eb4212536a3d0d945670a46ccbd46829..878baf3dba0f6f9311cf931040e04c2273b04ab6 100644 (file)
@@ -189,7 +189,7 @@ private:
   bool paused = false;
   int execute_interval;
   const DoutPrefix dp;
-  rgw::sal::Store* store;
+  std::unique_ptr<rgw::sal::LuaManager> lua_manager; 
   CephContext* const cct;
   const std::string luarocks_path;
   std::thread runner;
index 1d4c8014c1fdd9cb1fde62c71cfbf36d960352ce..8c13105e872d1c74c7b5109b4372269cf189a5c2 100644 (file)
@@ -273,8 +273,9 @@ int process_request(rgw::sal::Store* const store,
                     string* user,
                     ceph::coarse_real_clock::duration* latency,
                     std::shared_ptr<RateLimiter> ratelimit,
-                    int* http_ret,
-                    rgw::lua::Background* lua_background)
+                    rgw::lua::Background* lua_background,
+                    std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
+                    int* http_ret)
 {
   int ret = client_io->init(g_ceph_context);
   dout(1) << "====== starting new request req=" << hex << req << dec
@@ -330,7 +331,7 @@ int process_request(rgw::sal::Store* const store,
   {
     s->trace_enabled = tracing::rgw::tracer.is_enabled();
     std::string script;
-    auto rc = rgw::lua::read_script(s, store, s->bucket_tenant, s->yield, rgw::lua::context::preRequest, script);
+    auto rc = rgw::lua::read_script(s, lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::preRequest, script);
     if (rc == -ENOENT) {
       // no script, nothing to do
     } else if (rc < 0) {
@@ -413,7 +414,7 @@ done:
       s->trace->SetAttribute(tracing::rgw::OBJECT_NAME, s->object->get_name());
     }
     std::string script;
-    auto rc = rgw::lua::read_script(s, store, s->bucket_tenant, s->yield, rgw::lua::context::postRequest, script);
+    auto rc = rgw::lua::read_script(s, lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::postRequest, script);
     if (rc == -ENOENT) {
       // no script, nothing to do
     } else if (rc < 0) {
index c40a9beaf3beea64e781fb5ad9775db2d8082549..964842811cf9ed641685a35d6e9ae4f0f2c51fd7 100644 (file)
@@ -63,6 +63,7 @@ protected:
   int sock_fd;
   std::string uri_prefix;
   rgw::lua::Background* lua_background;
+  std::unique_ptr<rgw::sal::LuaManager> lua_manager;
 
   struct RGWWQ : public DoutPrefixProvider, public ThreadPool::WorkQueue<RGWRequest> {
     RGWProcess* process;
@@ -115,6 +116,7 @@ public:
       sock_fd(-1),
       uri_prefix(pe->uri_prefix),
       lua_background(pe->lua_background),
+      lua_manager(store->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),
@@ -134,6 +136,7 @@ public:
                                rgw_auth_registry_ptr_t auth_registry) {
     this->store = store;
     this->auth_registry = std::move(auth_registry);
+    lua_manager = store->get_lua_manager();
     m_tp.unpause();
   }
 
@@ -183,8 +186,9 @@ extern int process_request(rgw::sal::Store* store,
                            std::string* user,
                            ceph::coarse_real_clock::duration* latency,
                            std::shared_ptr<RateLimiter> ratelimit,
-                           int* http_ret = nullptr,
-                           rgw::lua::Background* lua_background = nullptr);
+                           rgw::lua::Background* lua_background,
+                           std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
+                           int* http_ret = nullptr);
 
 extern int rgw_process_authenticated(RGWHandler_REST* handler,
                                      RGWOp*& op,
index 0955366f6d017a3d077fac89ef3b0bdb0a44c501..c063467a2c81a7fec730c1ec95af511d3e003e13 100644 (file)
@@ -3009,13 +3009,17 @@ const std::string_view RadosZone::get_tier_type()
   return store->svc()->zone->get_zone().tier_type;
 }
 
-RadosLuaManager::RadosLuaManager(RadosStore* _s) : store(_s)
-{
-  pool = store->svc()->zone->get_zone_params().log_pool;
-}
+RadosLuaManager::RadosLuaManager(RadosStore* _s) : 
+  store(_s),
+  pool((store->svc() && store->svc()->zone) ? store->svc()->zone->get_zone_params().log_pool : rgw_pool())
+}
 
 int RadosLuaManager::get_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, std::string& script)
 {
+  if (pool.empty()) {
+    ldpp_dout(dpp, 10) << "WARNING: missing pool when reading lua script " << dendl;
+    return 0;
+  }
   bufferlist bl;
 
   int r = rgw_get_system_obj(store->svc()->sysobj, pool, key, bl, nullptr, nullptr, y, dpp);
@@ -3035,6 +3039,10 @@ int RadosLuaManager::get_script(const DoutPrefixProvider* dpp, optional_yield y,
 
 int RadosLuaManager::put_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, const std::string& script)
 {
+  if (pool.empty()) {
+    ldpp_dout(dpp, 10) << "WARNING: missing pool when writing lua script " << dendl;
+    return 0;
+  }
   bufferlist bl;
   ceph::encode(script, bl);
 
@@ -3048,6 +3056,10 @@ int RadosLuaManager::put_script(const DoutPrefixProvider* dpp, optional_yield y,
 
 int RadosLuaManager::del_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key)
 {
+  if (pool.empty()) {
+    ldpp_dout(dpp, 10) << "WARNING: missing pool when deleting lua script " << dendl;
+    return 0;
+  }
   int r = rgw_delete_system_obj(dpp, store->svc()->sysobj, pool, key, nullptr, y);
   if (r < 0 && r != -ENOENT) {
     return r;
index 128aead8802a74999ce35e51c30cd1fbf70431f1..e6965571ce408e93e054c3991cb8e599c30f797c 100644 (file)
@@ -879,7 +879,7 @@ public:
 };
 
 class RadosLuaManager : public StoreLuaManager {
-  RadosStore* store;
+  RadosStore* const store;
   rgw_pool pool;
 
 public:
index 110e6addd84cd8d0dfce7e42b05ea357b8b73313..aed870269251832482f9937603a1684bd4f5528b 100644 (file)
@@ -630,6 +630,9 @@ TEST(TestRGWLua, NotAllowedInLib)
   ASSERT_NE(rc, 0);
 }
 
+#define MAKE_STORE auto store = std::unique_ptr<sal::RadosStore>(new sal::RadosStore); \
+                        store->setRados(new RGWRados);
+
 TEST(TestRGWLua, OpsLog)
 {
   const std::string script = R"(
@@ -641,8 +644,7 @@ TEST(TestRGWLua, OpsLog)
                end
   )";
 
-  auto store = std::unique_ptr<sal::RadosStore>(new sal::RadosStore);
-  store->setRados(new RGWRados);
+  MAKE_STORE;
 
   struct MockOpsLogSink : OpsLogSink {
     bool logged = false;
@@ -684,6 +686,7 @@ TEST(TestRGWLua, OpsLog)
 
 class TestBackground : public rgw::lua::Background {
   const unsigned read_time;
+
 protected:
   int read_script() override {
     // don't read the object from the store
@@ -692,8 +695,8 @@ protected:
   }
 
 public:
-  TestBackground(const std::string& script, unsigned read_time = 0) : 
-    rgw::lua::Background(nullptr, g_cct, "", 1 /*run every second*/),
+  TestBackground(sal::RadosStore* store, const std::string& script, unsigned read_time = 0) : 
+    rgw::lua::Background(store, g_cct, "", /* luarocks path */ 1 /* run every second */),
     read_time(read_time) {
       // the script is passed in the constructor
       rgw_script = script;
@@ -706,13 +709,14 @@ public:
 
 TEST(TestRGWLuaBackground, Start)
 {
+  MAKE_STORE;
   {
     // ctr and dtor without running
-    TestBackground lua_background("");
+    TestBackground lua_background(store.get(), "");
   }
   {
     // ctr and dtor with running
-    TestBackground lua_background("");
+    TestBackground lua_background(store.get(), "");
     lua_background.start();
   }
 }
@@ -738,7 +742,8 @@ TEST(TestRGWLuaBackground, Script)
     RGW[key] = value
   )";
 
-  TestBackground lua_background(script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), script);
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
   EXPECT_EQ(get_table_value<std::string>(lua_background, "hello"), "world");
@@ -752,7 +757,8 @@ TEST(TestRGWLuaBackground, RequestScript)
     RGW[key] = value
   )";
 
-  TestBackground lua_background(background_script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), background_script);
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
 
@@ -771,7 +777,7 @@ TEST(TestRGWLuaBackground, RequestScript)
   ASSERT_EQ(rc, 0);
   EXPECT_EQ(get_table_value<std::string>(lua_background, "hello"), "from request");
   // now we resume and let the background set the value
-  lua_background.resume(nullptr);
+  lua_background.resume(store.get());
   std::this_thread::sleep_for(wait_time);
   EXPECT_EQ(get_table_value<std::string>(lua_background, "hello"), "from background");
 }
@@ -788,7 +794,8 @@ TEST(TestRGWLuaBackground, Pause)
     end
   )";
 
-  TestBackground lua_background(script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), script);
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
   const auto value_len = get_table_value<std::string>(lua_background, "hello").size();
@@ -812,8 +819,9 @@ TEST(TestRGWLuaBackground, PauseWhileReading)
     end
   )";
 
+  MAKE_STORE;
   constexpr auto long_wait_time = std::chrono::seconds(6);
-  TestBackground lua_background(script, 2);
+  TestBackground lua_background(store.get(), script, 2);
   lua_background.start();
   std::this_thread::sleep_for(long_wait_time);
   const auto value_len = get_table_value<std::string>(lua_background, "hello").size();
@@ -832,12 +840,13 @@ TEST(TestRGWLuaBackground, ReadWhilePaused)
     RGW[key] = value
   )";
 
-  TestBackground lua_background(script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), script);
   lua_background.pause();
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
   EXPECT_EQ(get_table_value<std::string>(lua_background, "hello"), "");
-  lua_background.resume(nullptr);
+  lua_background.resume(store.get());
   std::this_thread::sleep_for(wait_time);
   EXPECT_EQ(get_table_value<std::string>(lua_background, "hello"), "world");
 }
@@ -854,7 +863,8 @@ TEST(TestRGWLuaBackground, PauseResume)
     end
   )";
 
-  TestBackground lua_background(script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), script);
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
   const auto value_len = get_table_value<std::string>(lua_background, "hello").size();
@@ -863,7 +873,7 @@ TEST(TestRGWLuaBackground, PauseResume)
   std::this_thread::sleep_for(wait_time);
   // no change in len
   EXPECT_EQ(value_len, get_table_value<std::string>(lua_background, "hello").size());
-  lua_background.resume(nullptr);
+  lua_background.resume(store.get());
   std::this_thread::sleep_for(wait_time);
   // should be a change in len
   EXPECT_GT(get_table_value<std::string>(lua_background, "hello").size(), value_len);
@@ -881,7 +891,8 @@ TEST(TestRGWLuaBackground, MultipleStarts)
     end
   )";
 
-  TestBackground lua_background(script);
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), script);
   lua_background.start();
   std::this_thread::sleep_for(wait_time);
   const auto value_len = get_table_value<std::string>(lua_background, "hello").size();
@@ -898,7 +909,8 @@ TEST(TestRGWLuaBackground, MultipleStarts)
 
 TEST(TestRGWLuaBackground, TableValues)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = "string value"
@@ -919,7 +931,8 @@ TEST(TestRGWLuaBackground, TableValues)
 
 TEST(TestRGWLuaBackground, TablePersist)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   std::string request_script = R"(
     RGW["key1"] = "string value"
@@ -948,7 +961,8 @@ TEST(TestRGWLuaBackground, TablePersist)
 
 TEST(TestRGWLuaBackground, TableValuesFromRequest)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
   lua_background.start();
 
   const std::string request_script = R"(
@@ -974,7 +988,8 @@ TEST(TestRGWLuaBackground, TableValuesFromRequest)
 
 TEST(TestRGWLuaBackground, TableInvalidValue)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
   lua_background.start();
 
   const std::string request_script = R"(
@@ -999,7 +1014,8 @@ TEST(TestRGWLuaBackground, TableInvalidValue)
 
 TEST(TestRGWLuaBackground, TableErase)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   std::string request_script = R"(
     RGW["size"] = 0
@@ -1036,7 +1052,8 @@ TEST(TestRGWLuaBackground, TableErase)
 
 TEST(TestRGWLuaBackground, TableIterate)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = "string value"
@@ -1062,7 +1079,8 @@ TEST(TestRGWLuaBackground, TableIterate)
 
 TEST(TestRGWLuaBackground, TableIncrement)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = 42
@@ -1081,7 +1099,8 @@ TEST(TestRGWLuaBackground, TableIncrement)
 
 TEST(TestRGWLuaBackground, TableIncrementBy)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = 42
@@ -1102,7 +1121,8 @@ TEST(TestRGWLuaBackground, TableIncrementBy)
 
 TEST(TestRGWLuaBackground, TableDecrement)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = 42
@@ -1121,7 +1141,8 @@ TEST(TestRGWLuaBackground, TableDecrement)
 
 TEST(TestRGWLuaBackground, TableDecrementBy)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   const std::string request_script = R"(
     RGW["key1"] = 42
@@ -1142,7 +1163,8 @@ TEST(TestRGWLuaBackground, TableDecrementBy)
 
 TEST(TestRGWLuaBackground, TableIncrementValueError)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   std::string request_script = R"(
     -- cannot increment string values
@@ -1176,7 +1198,8 @@ TEST(TestRGWLuaBackground, TableIncrementValueError)
 
 TEST(TestRGWLuaBackground, TableIncrementError)
 {
-  TestBackground lua_background("");
+  MAKE_STORE;
+  TestBackground lua_background(store.get(), "");
 
   std::string request_script = R"(
     -- missing argument