From: Orit Wasserman Date: Tue, 15 Mar 2016 13:33:58 +0000 (+0100) Subject: rgw: use current period id when it is empty for mdlog list and shard lock/unlock X-Git-Tag: v10.1.0~32^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F8183%2Fhead;p=ceph.git rgw: use current period id when it is empty for mdlog list and shard lock/unlock Signed-off-by: Orit Wasserman --- diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 8a2db376d29b..b95c838a47c5 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 0b32789a4f75..854da2e0d6b3 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() ||