From 425546a032d1c6f2557390214be11e70eb63e061 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Tue, 15 Mar 2016 14:33:58 +0100 Subject: [PATCH] rgw: use current period id when it is empty for mdlog list and shard lock/unlock Signed-off-by: Orit Wasserman --- src/rgw/rgw_rados.h | 3 +++ src/rgw/rgw_rest_log.cc | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 8a2db376d29bd..b95c838a47c52 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1928,6 +1928,9 @@ public: return current_period.get_config().user_quota; } + const string& get_current_period_id() { + return current_period.get_id(); + } // pulls missing periods for period_history std::unique_ptr period_puller; // maintains a connected history of periods diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 0b32789a4f75d..854da2e0d6b33 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -78,10 +78,15 @@ void RGWOp_MDLog_List::execute() { } if (period.empty()) { - ldout(s->cct, 5) << "Missing period id" << dendl; - http_ret = -EINVAL; - return; + ldout(s->cct, 5) << "Missing period id trying to use current" << dendl; + period = store->get_current_period_id(); + if (period.empty()) { + ldout(s->cct, 5) << "Missing period id" << dendl; + http_ret = -EINVAL; + return; + } } + RGWMetadataLog meta_log{s->cct, store, period}; meta_log.init_list_entries(shard_id, ut_st, ut_et, marker, &handle); @@ -233,6 +238,11 @@ void RGWOp_MDLog_Lock::execute() { locker_id = s->info.args.get("locker-id"); zone_id = s->info.args.get("zone-id"); + if (period.empty()) { + ldout(s->cct, 5) << "Missing period id trying to use current" << dendl; + period = store->get_current_period_id(); + } + if (period.empty() || shard_id_str.empty() || (duration_str.empty()) || @@ -276,6 +286,11 @@ void RGWOp_MDLog_Unlock::execute() { locker_id = s->info.args.get("locker-id"); zone_id = s->info.args.get("zone-id"); + if (period.empty()) { + ldout(s->cct, 5) << "Missing period id trying to use current" << dendl; + period = store->get_current_period_id(); + } + if (period.empty() || shard_id_str.empty() || locker_id.empty() || -- 2.39.5