]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWSyncLogTrimCR wont set last_trim=max_marker 27794/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 19:31:59 +0000 (15:31 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 19:32:01 +0000 (15:32 -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>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_trim_bilog.cc
src/rgw/rgw_trim_datalog.cc

index 3f4db80f4d19826527ca37cd828e981669d6cd6e..869d5c0ad7321b9ffe98655f0e74f754b10a7a8e 100644 (file)
@@ -837,7 +837,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 816815bfc083647e0e5a46d87ed0493f235beec8..f9dceebf8e15e5082901e20784779f1362a5b38e 100644 (file)
@@ -1288,6 +1288,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 0a63a258e1a9611600e3fdf9876081790f6ad51f..1209375ca7319597823df20562fcf60c207d5f98 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(),
index 8009c5f130728068ea9456c237d38b9d837d8f31..1fd0fdefbce61fb67a532c1657dacccf3cd6364c 100644 (file)
@@ -48,6 +48,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;
@@ -64,7 +65,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)
   {}
 
@@ -123,7 +124,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);