]> 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>
Tue, 23 Jan 2018 16:24:54 +0000 (11:24 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit eb140e38207dc43e16d803ee1174678cc9d5e39c)

src/rgw/rgw_sync.cc

index 91424a1c47024654ba8012365285c12b4333c0f9..42286c4e67d70d02ee94e8db92d7dc4ba5e71c7b 100644 (file)
@@ -2471,6 +2471,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),
@@ -2560,6 +2561,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;