From: Casey Bodley Date: Thu, 25 Apr 2019 14:01:30 +0000 (-0400) Subject: rgw: data/bilogs are trimmed when no peers are reading them X-Git-Tag: v14.2.5~110^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=685e262f78bdf944549fe08ca78c66420a90d158;p=ceph.git rgw: data/bilogs are trimmed when no peers are reading them if no peers zones are configured to sync from us, we can safely trim our entire log. start with the marker '99999999' (which compares larger than any key based on a timestamp) instead of an empty marker, then take the minimum of that with any peer markers Fixes: http://tracker.ceph.com/issues/39487 Signed-off-by: Casey Bodley (cherry picked from commit da3803f59fcf904ec32e6e03d2dedc23d0a127f8) Conflicts: src/rgw/rgw_trim_datalog.cc moved from rgw_data_sync.cc --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index bd6c4b50a47..e24b1206c49 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -3584,7 +3584,7 @@ class DataLogTrimCR : public RGWCoroutine { num_shards(num_shards), zone_id(store->svc.zone->get_zone().id), peer_status(store->svc.zone->get_zone_data_notify_to_map().size()), - min_shard_markers(num_shards), + min_shard_markers(num_shards, "99999999"), last_trim(last_trim) {} diff --git a/src/rgw/rgw_sync_log_trim.cc b/src/rgw/rgw_sync_log_trim.cc index 243fa65d0f6..d6d53cd535d 100644 --- a/src/rgw/rgw_sync_log_trim.cc +++ b/src/rgw/rgw_sync_log_trim.cc @@ -477,7 +477,9 @@ int BucketTrimInstanceCR::operate() } } - min_markers.resize(std::max(1u, bucket_info.num_shards)); + // initialize each shard with the maximum marker, which is only used when + // there are no peers syncing from us + min_markers.assign(std::max(1u, bucket_info.num_shards), "99999999"); // determine the minimum marker for each shard retcode = take_min_status(cct, peer_status.begin(), peer_status.end(),