]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: teach librgw about rgw_backend_store 46022/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 21 Apr 2022 23:26:55 +0000 (19:26 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 25 Apr 2022 15:18:20 +0000 (11:18 -0400)
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>
src/rgw/librgw.cc

index 4ec71216398b8acd97d8c1def34538b45fc14c03..1ebd668685584e33694fd3a2ab122ae458fded4f 100644 (file)
@@ -538,8 +538,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,