]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWSyncLogTrimCR wont set last_trim=max_marker 30999/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 19:31:59 +0000 (15:31 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 18 Oct 2019 19:34:16 +0000 (15:34 -0400)
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 moved from 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 7284c10dc4e4fe49d8bd17e27756618580fc55e2..66d05e0876e75637a879bb87f54ff033189c3d53 100644 (file)
@@ -836,7 +836,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 e919217cbaac02b9a4248ea86fa2f378868cb289..70b52f357af48502a39a6cf7d0f2dafbccb74784 100644 (file)
@@ -1278,6 +1278,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 e24b1206c498766e0997a2f6c30e0d6122e35c07..0920e66ecf2ce51e680461f6ba8cc69da58e4f5b 100644 (file)
@@ -3568,6 +3568,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;
@@ -3584,7 +3585,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, "99999999"),
+      min_shard_markers(num_shards, TrimCR::max_marker),
       last_trim(last_trim)
   {}
 
@@ -3643,7 +3644,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 d6d53cd535d5262c7f88d9fcd3038e5ad4b5ade3..a8a3fdee913b20a60a678cd820011da1c22a991e 100644 (file)
@@ -479,7 +479,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(),