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
-
- // Get the filter
- std::string rgw_filter = "none";
- const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
- if (config_filter == "base") {
- rgw_filter = "base";
- }
-
+ StoreManager::Config cfg = StoreManager::get_config(false, g_ceph_context);
store = StoreManager::get_storage(this, g_ceph_context,
- rgw_store,
- rgw_filter,
+ cfg,
run_gc,
run_lc,
run_quota,
bool need_cache = readonly_ops_list.find(opt_cmd) == readonly_ops_list.end();
bool need_gc = (gc_ops_list.find(opt_cmd) != gc_ops_list.end()) && !bypass_gc;
- std::string rgw_store = "rados";
- // Get the store backend
- 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
-
- // Get the filter
- std::string rgw_filter = "none";
- const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
- if (config_filter == "base") {
- rgw_filter = "base";
- }
+ StoreManager::Config cfg = StoreManager::get_config(true, g_ceph_context);
if (raw_storage_op) {
store = StoreManager::get_raw_storage(dpp(),
g_ceph_context,
- rgw_store,
- rgw_filter);
+ cfg);
} else {
store = StoreManager::get_storage(dpp(),
g_ceph_context,
- rgw_store,
- rgw_filter,
+ cfg,
false,
false,
false,
rgw_http_client_init(g_ceph_context);
rgw_kmip_client_init(*new RGWKMIPManagerImpl(g_ceph_context));
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_local_datacache_enabled=" << cct->_conf->rgw_d3n_l1_local_datacache_enabled << dendl;
- if (cct->_conf->rgw_d3n_l1_local_datacache_enabled) {
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_datacache_persistent_path='" << cct->_conf->rgw_d3n_l1_datacache_persistent_path << "'" << dendl;
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_datacache_size=" << cct->_conf->rgw_d3n_l1_datacache_size << dendl;
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_evict_cache_on_start=" << cct->_conf->rgw_d3n_l1_evict_cache_on_start << dendl;
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_fadvise=" << cct->_conf->rgw_d3n_l1_fadvise << dendl;
- lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_eviction_policy=" << cct->_conf->rgw_d3n_l1_eviction_policy << dendl;
- }
- 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";
-
- // Get the store backend
- 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
-
- // Get the filter
- std::string rgw_filter = "none";
- const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
- if (config_filter == "base") {
- rgw_filter = "base";
- }
+ StoreManager::Config cfg = StoreManager::get_config(false, g_ceph_context);
rgw::sal::Store* store =
StoreManager::get_storage(&dp, g_ceph_context,
- rgw_store,
- rgw_filter,
+ cfg,
g_conf()->rgw_enable_gc_threads,
g_conf()->rgw_enable_lc_threads,
g_conf()->rgw_enable_quota_threads,
common_init_finish(g_ceph_context);
const DoutPrefix dp(cct.get(), dout_subsys, "rgw object expirer: ");
- store = StoreManager::get_storage(&dp, g_ceph_context, "rados", "none", false, false, false, false, false);
+ StoreManager::Config cfg;
+ cfg.store_name = "rados";
+ cfg.filter_name = "none";
+ store = StoreManager::get_storage(&dp, g_ceph_context, cfg, false, false, false, false, false);
if (!store) {
std::cerr << "couldn't init storage provider" << std::endl;
return EIO;
while (!store) {
// recreate and initialize a new store
+ StoreManager::Config cfg;
+ cfg.store_name = "rados";
+ cfg.filter_name = "none";
store =
StoreManager::get_storage(&dp, cct,
- "rados",
- "none",
+ cfg,
cct->_conf->rgw_enable_gc_threads,
cct->_conf->rgw_enable_lc_threads,
cct->_conf->rgw_enable_quota_threads,
compressed = rhs.compressed;
}
-rgw::sal::Store* StoreManager::init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache, bool use_gc)
+rgw::sal::Store* StoreManager::init_storage_provider(const DoutPrefixProvider* dpp,
+ CephContext* cct,
+ const Config& cfg,
+ bool use_gc_thread,
+ bool use_lc_thread,
+ bool quota_threads,
+ bool run_sync_thread,
+ bool run_reshard_thread,
+ bool use_cache,
+ bool use_gc)
{
rgw::sal::Store* store{nullptr};
- if (svc.compare("rados") == 0) {
+ if (cfg.store_name.compare("rados") == 0) {
store = newStore();
RGWRados* rados = static_cast<rgw::sal::RadosStore* >(store)->getRados();
return nullptr;
}
}
- else if (svc.compare("d3n") == 0) {
+ else if (cfg.store_name.compare("d3n") == 0) {
store = new rgw::sal::RadosStore();
RGWRados* rados = new D3nRGWDataCache<RGWRados>;
dynamic_cast<rgw::sal::RadosStore*>(store)->setRados(rados);
delete store;
return nullptr;
}
+
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_local_datacache_enabled=" <<
+ cct->_conf->rgw_d3n_l1_local_datacache_enabled << dendl;
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_datacache_persistent_path='" <<
+ cct->_conf->rgw_d3n_l1_datacache_persistent_path << "'" << dendl;
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_datacache_size=" <<
+ cct->_conf->rgw_d3n_l1_datacache_size << dendl;
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_evict_cache_on_start=" <<
+ cct->_conf->rgw_d3n_l1_evict_cache_on_start << dendl;
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_fadvise=" <<
+ cct->_conf->rgw_d3n_l1_fadvise << dendl;
+ lsubdout(cct, rgw, 1) << "rgw_d3n: rgw_d3n_l1_eviction_policy=" <<
+ cct->_conf->rgw_d3n_l1_eviction_policy << dendl;
}
#ifdef WITH_RADOSGW_DBSTORE
- else if (svc.compare("dbstore") == 0) {
+ else if (cfg.store_name.compare("dbstore") == 0) {
store = newDBStore(cct);
if ((*(rgw::sal::DBStore*)store).set_run_lc_thread(use_lc_thread)
#endif
#ifdef WITH_RADOSGW_MOTR
- else if (svc.compare("motr") == 0) {
+ else if (cfg.store_name.compare("motr") == 0) {
store = newMotrStore(cct);
if (store == nullptr) {
ldpp_dout(dpp, 0) << "newMotrStore() failed!" << dendl;
}
#endif
- if (filter.compare("base") == 0) {
+ if (cfg.filter_name.compare("base") == 0) {
rgw::sal::Store* next = store;
store = newBaseFilter(next);
return store;
}
-rgw::sal::Store* StoreManager::init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter)
+rgw::sal::Store* StoreManager::init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const Config& cfg)
{
rgw::sal::Store* store = nullptr;
- if (svc.compare("rados") == 0) {
+ if (cfg.store_name.compare("rados") == 0) {
store = newStore();
RGWRados* rados = static_cast<rgw::sal::RadosStore* >(store)->getRados();
delete store;
return nullptr;
}
- } else if (svc.compare("dbstore") == 0) {
+ } else if (cfg.store_name.compare("dbstore") == 0) {
#ifdef WITH_RADOSGW_DBSTORE
store = newDBStore(cct);
#else
store = nullptr;
#endif
- } else if (svc.compare("motr") == 0) {
+ } else if (cfg.store_name.compare("motr") == 0) {
#ifdef WITH_RADOSGW_MOTR
store = newMotrStore(cct);
#else
#endif
}
- if (filter.compare("base") == 0) {
+ if (cfg.filter_name.compare("base") == 0) {
rgw::sal::Store* next = store;
store = newBaseFilter(next);
delete store;
}
+StoreManager::Config StoreManager::get_config(bool admin, CephContext* cct)
+{
+ StoreManager::Config cfg;
+
+ // Get the store backend
+ const auto& config_store = g_conf().get_val<std::string>("rgw_backend_store");
+ if (config_store == "rados") {
+ cfg.store_name = "rados";
+
+ /* Check to see if d3n is configured, but only for non-admin */
+ const auto& d3n = g_conf().get_val<bool>("rgw_d3n_l1_local_datacache_enabled");
+ if (!admin && d3n) {
+ if (g_conf().get_val<size_t>("rgw_max_chunk_size") !=
+ g_conf().get_val<size_t>("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;
+ } else if (!g_conf().get_val<bool>("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;
+ } else {
+ cfg.store_name = "d3n";
+ }
+ }
+ }
+#ifdef WITH_RADOSGW_DBSTORE
+ else if (config_store == "dbstore") {
+ cfg.store_name = "dbstore";
+ }
+#endif
+#ifdef WITH_RADOSGW_MOTR
+ else if (config_store == "motr") {
+ cfg.store_name = "motr";
+ }
+#endif
+
+ // Get the filter
+ cfg.filter_name = "none";
+ const auto& config_filter = g_conf().get_val<std::string>("rgw_filter");
+ if (config_filter == "base") {
+ cfg.filter_name = "base";
+ }
+
+ return cfg;
+}
+
namespace rgw::sal {
int Object::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end)
{
}
return 0;
}
-}
+} // namespace rgw::sal
*/
class StoreManager {
public:
+ struct Config {
+ /** Name of store to create */
+ std::string store_name;
+ /** Name of filter to create or "none" */
+ std::string filter_name;
+ };
+
StoreManager() {}
/** Get a full store by service name */
- static rgw::sal::Store* get_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads,
- bool run_sync_thread, bool run_reshard_thread, bool use_cache = true, bool use_gc = true) {
- rgw::sal::Store* store = init_storage_provider(dpp, cct, svc, filter, use_gc_thread, use_lc_thread,
- quota_threads, run_sync_thread, run_reshard_thread, use_cache, use_gc);
+ static rgw::sal::Store* get_storage(const DoutPrefixProvider* dpp,
+ CephContext* cct,
+ const Config& cfg,
+ bool use_gc_thread,
+ bool use_lc_thread,
+ bool quota_threads,
+ bool run_sync_thread,
+ bool run_reshard_thread,
+ bool use_cache = true,
+ bool use_gc = true) {
+ rgw::sal::Store* store = init_storage_provider(dpp, cct, cfg, use_gc_thread,
+ use_lc_thread,
+ quota_threads,
+ run_sync_thread,
+ run_reshard_thread,
+ use_cache, use_gc);
return store;
}
/** Get a stripped down store by service name */
- static rgw::sal::Store* get_raw_storage(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter) {
- rgw::sal::Store* store = init_raw_storage_provider(dpp, cct, svc, filter);
+ static rgw::sal::Store* get_raw_storage(const DoutPrefixProvider* dpp,
+ CephContext* cct, const Config& cfg) {
+ rgw::sal::Store* store = init_raw_storage_provider(dpp, cct, cfg);
return store;
}
/** Initialize a new full Store */
- static rgw::sal::Store* init_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache, bool use_gc);
+ static rgw::sal::Store* init_storage_provider(const DoutPrefixProvider* dpp,
+ CephContext* cct,
+ const Config& cfg,
+ bool use_gc_thread,
+ bool use_lc_thread,
+ bool quota_threads,
+ bool run_sync_thread,
+ bool run_reshard_thread,
+ bool use_metadata_cache,
+ bool use_gc);
/** Initialize a new raw Store */
- static rgw::sal::Store* init_raw_storage_provider(const DoutPrefixProvider* dpp, CephContext* cct, const std::string svc, const std::string filter);
+ static rgw::sal::Store* init_raw_storage_provider(const DoutPrefixProvider* dpp,
+ CephContext* cct,
+ const Config& cfg);
/** Close a Store when it's no longer needed */
static void close_storage(rgw::sal::Store* store);
+ /** Get the config for stores/filters */
+ static Config get_config(bool admin, CephContext* cct);
};
/** @} */