]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use current period id when it is empty for mdlog list and shard lock/unlock 8183/head
authorOrit Wasserman <owasserm@redhat.com>
Tue, 15 Mar 2016 13:33:58 +0000 (14:33 +0100)
committerOrit Wasserman <owasserm@redhat.com>
Thu, 17 Mar 2016 19:27:10 +0000 (20:27 +0100)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_rados.h
src/rgw/rgw_rest_log.cc

index 8a2db376d29bd7ce24d90314927cca1b6b3e52b2..b95c838a47c522336e7189856943e336492497ba 100644 (file)
@@ -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<RGWPeriodPuller> period_puller;
   // maintains a connected history of periods
index 0b32789a4f75dc954253673ca8578ef0e23313c0..854da2e0d6b3321b88ce0081321d2698f31e0f79 100644 (file)
@@ -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() ||