Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: radosgw-admin should not use metadata cache for readonly commands #21129

Merged
merged 2 commits into from Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 56 additions & 1 deletion src/rgw/rgw_admin.cc
Expand Up @@ -2990,14 +2990,69 @@ int main(int argc, const char **argv)
OPT_REALM_RENAME, OPT_REALM_SET,
OPT_REALM_DEFAULT, OPT_REALM_PULL};

std::set<int> readonly_ops_list = {
OPT_USER_INFO,
OPT_USER_STATS,
OPT_BUCKETS_LIST,
OPT_BUCKET_LIMIT_CHECK,
OPT_BUCKET_STATS,
OPT_BUCKET_SYNC_STATUS,
OPT_LOG_LIST,
OPT_LOG_SHOW,
OPT_USAGE_SHOW,
OPT_OBJECT_STAT,
OPT_BI_GET,
OPT_BI_LIST,
OPT_OLH_GET,
OPT_OLH_READLOG,
OPT_GC_LIST,
OPT_LC_LIST,
OPT_ORPHANS_LIST_JOBS,
OPT_ZONEGROUP_GET,
OPT_ZONEGROUP_LIST,
OPT_ZONEGROUP_PLACEMENT_LIST,
OPT_ZONE_GET,
OPT_ZONE_LIST,
OPT_ZONE_PLACEMENT_LIST,
OPT_METADATA_GET,
OPT_METADATA_LIST,
OPT_METADATA_SYNC_STATUS,
OPT_MDLOG_LIST,
OPT_MDLOG_STATUS,
OPT_SYNC_ERROR_LIST,
OPT_BILOG_LIST,
OPT_BILOG_STATUS,
OPT_DATA_SYNC_STATUS,
OPT_DATALOG_LIST,
OPT_DATALOG_STATUS,
OPT_OPSTATE_LIST,
OPT_REPLICALOG_GET,
OPT_REALM_GET,
OPT_REALM_GET_DEFAULT,
OPT_REALM_LIST,
OPT_REALM_LIST_PERIODS,
OPT_PERIOD_GET,
OPT_PERIOD_GET_CURRENT,
OPT_PERIOD_LIST,
OPT_GLOBAL_QUOTA_GET,
OPT_SYNC_STATUS,
OPT_ROLE_GET,
OPT_ROLE_LIST,
OPT_ROLE_POLICY_LIST,
OPT_ROLE_POLICY_GET,
OPT_RESHARD_LIST,
OPT_RESHARD_STATUS,
};

bool raw_storage_op = (raw_storage_ops_list.find(opt_cmd) != raw_storage_ops_list.end() ||
raw_period_update);
bool need_cache = readonly_ops_list.find(opt_cmd) == readonly_ops_list.end();

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,
need_cache && g_conf->rgw_cache_enabled);
}
if (!store) {
cerr << "couldn't init storage provider" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_main.cc
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/rgw/rgw_rados.cc
Expand Up @@ -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<RGWRados>;
store = new RGWCache<RGWRados>;
}

if (store->initialize(cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, run_reshard_thread) < 0) {
Expand Down
7 changes: 4 additions & 3 deletions src/rgw/rgw_rados.h
Expand Up @@ -3795,16 +3795,17 @@ class RGWRados : public AdminSocketHook
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);

Expand Down
4 changes: 3 additions & 1 deletion src/rgw/rgw_realm_reloader.cc
Expand Up @@ -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;

Expand Down