From: Casey Bodley Date: Mon, 23 Jan 2017 20:42:18 +0000 (-0500) Subject: rgw: master purges period mdlogs once all peers are done X-Git-Tag: v10.2.11~111^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=119a3b2de6480dc55b948bf2e2d7a2ef32b7744d;p=ceph.git rgw: master purges period mdlogs once all peers are done Signed-off-by: Casey Bodley (cherry picked from commit eb140e38207dc43e16d803ee1174678cc9d5e39c) --- diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 91424a1c4702..42286c4e67d7 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -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;