]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: master purges period mdlogs once all peers are done
authorCasey Bodley <cbodley@redhat.com>
Mon, 23 Jan 2017 20:42:18 +0000 (15:42 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 27 Apr 2017 14:39:21 +0000 (10:39 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_sync.cc

index a883f168a33bb5379753c1c8d4bef50a00b0e295..9fd9c4a307cc7a25d06a868acad723f0c8ed56e3 100644 (file)
@@ -2496,6 +2496,7 @@ struct TrimEnv {
   int num_shards;
   const std::string& zone;
   Cursor current; //< cursor to current period
+  epoch_t last_trim_epoch{0}; //< epoch of last mdlog that was purged
 
   TrimEnv(RGWRados *store, RGWHTTPManager *http, int num_shards)
     : store(store), http(http), num_shards(num_shards),
@@ -2585,6 +2586,20 @@ int MetaMasterTrimCR::operate()
       ldout(cct, 4) << "failed to calculate min sync status from peers" << dendl;
       return set_cr_error(ret);
     }
+    yield {
+      auto store = env.store;
+      auto epoch = min_status.sync_info.realm_epoch;
+      ldout(cct, 4) << "realm epoch min=" << epoch
+          << " current=" << env.current.get_epoch()<< dendl;
+      if (epoch > env.last_trim_epoch + 1) {
+        // delete any prior mdlog periods
+        spawn(new PurgePeriodLogsCR(store, epoch, &env.last_trim_epoch), true);
+      } else {
+        ldout(cct, 10) << "mdlogs already purged up to realm_epoch "
+            << env.last_trim_epoch << dendl;
+      }
+    }
+    // ignore any errors during purge/trim because we want to hold the lock open
     return set_cr_done();
   }
   return 0;