]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: data/bilogs are trimmed when no peers are reading them
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 14:01:30 +0000 (10:01 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 18 Oct 2019 19:34:14 +0000 (15:34 -0400)
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 <cbodley@redhat.com>
(cherry picked from commit da3803f59fcf904ec32e6e03d2dedc23d0a127f8)

Conflicts:
src/rgw/rgw_trim_datalog.cc moved from rgw_data_sync.cc

src/rgw/rgw_data_sync.cc
src/rgw/rgw_sync_log_trim.cc

index bd6c4b50a47fea89cf743de434d531c32ef8b4a3..e24b1206c498766e0997a2f6c30e0d6122e35c07 100644 (file)
@@ -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)
   {}
 
index 243fa65d0f6a4c27ebf0aba0293b58665a4626e2..d6d53cd535d5262c7f88d9fcd3038e5ad4b5ade3 100644 (file)
@@ -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(),