From a40574eb5e3180986f301305c10d47b089673d78 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 21 Apr 2022 19:26:55 -0400 Subject: [PATCH] librgw: teach librgw about rgw_backend_store 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 --- src/rgw/librgw.cc | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 4ec71216398b8..1ebd668685584 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -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("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, -- 2.39.5