From: Orit Wasserman Date: Thu, 29 Mar 2018 07:54:33 +0000 (+0300) Subject: rgw: make cache configurable durining init_storage X-Git-Tag: v13.1.0~295^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bde45b8353b529783cb0c74296b7f6bd6f4abc24;p=ceph.git rgw: make cache configurable durining init_storage Fixes: http://tracker.ceph.com/issues/23468 Signed-off-by: Orit Wasserman --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 06ce5a00322d..04903accef44 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2997,7 +2997,8 @@ int main(int argc, const char **argv) if (raw_storage_op) { store = RGWStoreManager::get_raw_storage(g_ceph_context); } else { - store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false); + store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false, + g_conf->rgw_cache_enabled); } if (!store) { cerr << "couldn't init storage provider" << std::endl; diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 76374aa6b2cf..bfafed70f0f6 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -293,7 +293,7 @@ int main(int argc, const char **argv) RGWRados *store = RGWStoreManager::get_storage(g_ceph_context, g_conf->rgw_enable_gc_threads, g_conf->rgw_enable_lc_threads, g_conf->rgw_enable_quota_threads, - g_conf->rgw_run_sync_thread, g_conf->rgw_dynamic_resharding); + g_conf->rgw_run_sync_thread, g_conf->rgw_dynamic_resharding, g_conf->rgw_cache_enabled); if (!store) { mutex.Lock(); init_timer.cancel_all_events(); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d0e1298be0a6..9d3042c869ba 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -13900,14 +13900,14 @@ uint64_t RGWRados::next_bucket_id() return ++max_bucket_id; } -RGWRados *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread) +RGWRados *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, + bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache) { - int use_cache = cct->_conf->rgw_cache_enabled; RGWRados *store = NULL; if (!use_cache) { store = new RGWRados; } else { - store = new RGWCache; + store = new RGWCache; } if (store->initialize(cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, run_reshard_thread) < 0) { diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index dbc4f94ae434..c5d1c6f3299a 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -3795,16 +3795,17 @@ public: class RGWStoreManager { public: RGWStoreManager() {} - static RGWRados *get_storage(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread) { + static RGWRados *get_storage(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, + bool run_sync_thread, bool run_reshard_thread, bool use_cache = true) { RGWRados *store = init_storage_provider(cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, - run_reshard_thread); + run_reshard_thread, use_cache); return store; } static RGWRados *get_raw_storage(CephContext *cct) { RGWRados *store = init_raw_storage_provider(cct); return store; } - static RGWRados *init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread); + static RGWRados *init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache); static RGWRados *init_raw_storage_provider(CephContext *cct); static void close_storage(RGWRados *store); diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc index 2bae84c1ecbd..af4a72c5dc8b 100644 --- a/src/rgw/rgw_realm_reloader.cc +++ b/src/rgw/rgw_realm_reloader.cc @@ -105,7 +105,9 @@ void RGWRealmReloader::reload() cct->_conf->rgw_enable_lc_threads, cct->_conf->rgw_enable_quota_threads, cct->_conf->rgw_run_sync_thread, - cct->_conf->rgw_dynamic_resharding); + cct->_conf->rgw_dynamic_resharding, + cct->_conf->rgw_cache_enabled + ); ldout(cct, 1) << "Creating new store" << dendl;