]> 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)
committerNathan Cutler <ncutler@suse.com>
Wed, 4 Sep 2019 09:59:50 +0000 (11:59 +0200)
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
- file does not exist in mimic; made the changes manually in
  src/rgw/rgw_data_sync.cc

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

index 07197507b722d175697ef0c16c1ab53c65b4942a..24dc908e47d9f360e4fb1dfc24d06ed4cd0c4d6b 100644 (file)
@@ -3563,7 +3563,7 @@ class DataLogTrimCR : public RGWCoroutine {
       num_shards(num_shards),
       zone_id(store->get_zone().id),
       peer_status(store->zone_conn_map.size()),
-      min_shard_markers(num_shards),
+      min_shard_markers(num_shards, "99999999"),
       last_trim(last_trim)
   {}
 
index f1e56c4262fec683f81a9314b04f1bf67b02f774..7d3820af460fe0fd447dbe0d7d3ac334a25de6f5 100644 (file)
@@ -472,7 +472,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(),