]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: teach librgw about rgw_backend_store 59315/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 21 Apr 2022 23:26:55 +0000 (19:26 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Mon, 19 Aug 2024 16:29:09 +0000 (23:29 +0700)
With this change, basic i/o against dbstore works in the primary
librgw_file tests.

Fixes: https://tracker.ceph.com/issues/55430
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit a40574eb5e3180986f301305c10d47b089673d78)

src/rgw/librgw.cc

index e45ebed8c6102be4eff66bc165aa351d4b466a97..36c370d4bbc63a016172498ad90ab09ade520723 100644 (file)
@@ -541,8 +541,44 @@ namespace rgw {
       g_conf()->rgw_run_sync_thread &&
       g_conf()->rgw_nfs_run_sync_thread;
 
+    bool rgw_d3n_datacache_enabled =
+        cct->_conf->rgw_d3n_l1_local_datacache_enabled;
+    if (rgw_d3n_datacache_enabled &&
+        (cct->_conf->rgw_max_chunk_size != cct->_conf->rgw_obj_stripe_size)) {
+      lsubdout(cct, rgw_datacache, 0)
+          << "rgw_d3n:  WARNING: D3N DataCache disabling (D3N requires that "
+             "the chunk_size equals stripe_size)"
+          << dendl;
+      rgw_d3n_datacache_enabled = false;
+    }
+    if (rgw_d3n_datacache_enabled && !cct->_conf->rgw_beast_enable_async) {
+      lsubdout(cct, rgw_datacache, 0)
+          << "rgw_d3n:  WARNING: D3N DataCache disabling (D3N requires yield "
+             "context - rgw_beast_enable_async=true)"
+          << dendl;
+      rgw_d3n_datacache_enabled = false;
+    }
+    lsubdout(cct, rgw, 1) << "D3N datacache enabled: "
+                          << rgw_d3n_datacache_enabled << dendl;
+
+    std::string rgw_store = (!rgw_d3n_datacache_enabled) ? "rados" : "d3n";
+
+    const auto &config_store =
+        g_conf().get_val<std::string>("rgw_backend_store");
+#ifdef WITH_RADOSGW_DBSTORE
+    if (config_store == "dbstore") {
+      rgw_store = "dbstore";
+    }
+#endif
+
+#ifdef WITH_RADOSGW_MOTR
+    if (config_store == "motr") {
+      rgw_store = "motr";
+    }
+#endif
+
     store = StoreManager::get_storage(this, g_ceph_context,
-                                        "rados",
+                                        rgw_store,
                                         run_gc,
                                         run_lc,
                                         run_quota,