]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWSyncLogTrimCR wont set last_trim=max_marker 30130/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 19:31:59 +0000 (15:31 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 4 Sep 2019 10:02:38 +0000 (12:02 +0200)
if datalog trim has no peer zones, it will trim once with
marker=99999999. if we set last_trim=99999999, it will never attempt to
trim again

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 7afc486a34d64ac875b3730ebb637a920f289c03)

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_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_sync_log_trim.cc

index d8f34cde83edfc55b7778aa0a82ebd884e74c783..335ae1f55a53ca5a0369fbf433016dd7d29de2ee 100644 (file)
@@ -804,7 +804,7 @@ int RGWSyncLogTrimCR::request_complete()
     return r;
   }
   // nothing left to trim, update last_trim_marker
-  if (*last_trim_marker < to_marker) {
+  if (*last_trim_marker < to_marker && to_marker != max_marker) {
     *last_trim_marker = to_marker;
   }
   return 0;
index b8ff6128ed58e3fadc40102f95782338b2cabc03..2a5a045f608df5b2b341b32dea86bd14f5f01f3b 100644 (file)
@@ -1136,6 +1136,9 @@ class RGWSyncLogTrimCR : public RGWRadosTimelogTrimCR {
   CephContext *cct;
   std::string *last_trim_marker;
  public:
+  // a marker that compares greater than any timestamp-based index
+  static constexpr const char* max_marker = "99999999";
+
   RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
                    const std::string& to_marker, std::string *last_trim_marker);
   int request_complete() override;
index 24dc908e47d9f360e4fb1dfc24d06ed4cd0c4d6b..11ae38e921e87269756740268efb90cb78519ab0 100644 (file)
@@ -3547,6 +3547,7 @@ void take_min_markers(IterIn first, IterIn last, IterOut dest)
 } // anonymous namespace
 
 class DataLogTrimCR : public RGWCoroutine {
+  using TrimCR = RGWSyncLogTrimCR;
   RGWRados *store;
   RGWHTTPManager *http;
   const int num_shards;
@@ -3563,7 +3564,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, "99999999"),
+      min_shard_markers(num_shards, TrimCR::max_marker),
       last_trim(last_trim)
   {}
 
@@ -3622,7 +3623,6 @@ int DataLogTrimCR::operate()
         ldout(cct, 10) << "trimming log shard " << i
             << " at marker=" << m
             << " last_trim=" << last_trim[i] << dendl;
-        using TrimCR = RGWSyncLogTrimCR;
         spawn(new TrimCR(store, store->data_log->get_oid(i),
                          m, &last_trim[i]),
               true);
index 7d3820af460fe0fd447dbe0d7d3ac334a25de6f5..630988b7b570a6143c7a8ea11f14becadd31dab7 100644 (file)
@@ -474,7 +474,8 @@ int BucketTrimInstanceCR::operate()
 
     // 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");
+    min_markers.assign(std::max(1u, bucket_info.num_shards),
+                       RGWSyncLogTrimCR::max_marker);
 
     // determine the minimum marker for each shard
     retcode = take_min_status(cct, peer_status.begin(), peer_status.end(),