]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: move timelog trim wrapper to header
authorCasey Bodley <cbodley@redhat.com>
Tue, 9 Aug 2016 21:32:36 +0000 (17:32 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 22 Jan 2018 21:28:07 +0000 (16:28 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit db79bfabc87884ca5ae92a0685ec217a99af4597)

src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_sync.h

index cf0c14f284740ff0c088c256b4877e047e36c1d7..08e334d85126b101ea5029714f8a4fedde959d45 100644 (file)
@@ -701,6 +701,29 @@ int RGWRadosTimelogTrimCR::request_complete()
   return r;
 }
 
+
+RGWSyncLogTrimCR::RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
+                                   const std::string& to_marker,
+                                   std::string *last_trim_marker)
+  : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{},
+                          std::string{}, to_marker),
+    cct(store->ctx()), last_trim_marker(last_trim_marker)
+{
+}
+
+int RGWSyncLogTrimCR::request_complete()
+{
+  int r = RGWRadosTimelogTrimCR::request_complete();
+  if (r < 0 && r != -ENODATA) {
+    return r;
+  }
+  if (*last_trim_marker < to_marker) {
+    *last_trim_marker = to_marker;
+  }
+  return 0;
+}
+
+
 int RGWAsyncStatObj::_send_request()
 {
   return store->raw_obj_stat(obj, psize, pmtime, pepoch,
index bda1bcda264dbb65667dc1a22492e0849d05911b..1d8fc571866b0a6550c5f8031402ca5a884d3881 100644 (file)
@@ -1009,6 +1009,16 @@ class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine {
   int request_complete() override;
 };
 
+// wrapper to update last_trim_marker on success
+class RGWSyncLogTrimCR : public RGWRadosTimelogTrimCR {
+  CephContext *cct;
+  std::string *last_trim_marker;
+ public:
+  RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
+                   const std::string& to_marker, std::string *last_trim_marker);
+  int request_complete() override;
+};
+
 class RGWAsyncStatObj : public RGWAsyncRadosRequest {
   RGWRados *store;
   rgw_obj obj;
index e30c860bf2da9a45bfe5e1a858e4d9df69972b8c..6f52cd2f283cd19a750663ef21960ae7c4c24e2b 100644 (file)
@@ -2923,29 +2923,6 @@ void take_min_markers(IterIn first, IterIn last, IterOut dest)
   }
 }
 
-// wrapper to update last_trim_marker on success
-class LastTimelogTrimCR : public RGWRadosTimelogTrimCR {
-  CephContext *cct;
-  std::string *last_trim_marker;
- public:
-  LastTimelogTrimCR(RGWRados *store, const std::string& oid,
-                    const std::string& to_marker, std::string *last_trim_marker)
-    : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{},
-                            std::string{}, to_marker),
-      cct(store->ctx()), last_trim_marker(last_trim_marker)
-  {}
-  int request_complete() override {
-    int r = RGWRadosTimelogTrimCR::request_complete();
-    if (r < 0 && r != -ENODATA) {
-      ldout(cct, 1) << "failed to trim datalog: " << cpp_strerror(r) << dendl;
-      return r;
-    }
-    ldout(cct, 10) << "datalog trimmed to marker " << to_marker << dendl;
-    *last_trim_marker = to_marker;
-    return 0;
-  }
-};
-
 class DataLogTrimCR : public RGWCoroutine {
   RGWRados *store;
   RGWHTTPManager *http;
@@ -3023,7 +3000,7 @@ int DataLogTrimCR::operate()
         ldout(cct, 10) << "trimming log shard " << i
             << " at marker=" << stable
             << " last_trim=" << last_trim[i] << dendl;
-        using TrimCR = LastTimelogTrimCR;
+        using TrimCR = RGWSyncLogTrimCR;
         spawn(new TrimCR(store, store->data_log->get_oid(i),
                          stable, &last_trim[i]),
               true);
index 442f2d9ebc5a641f5aa0d965e6789ccdcbe050dd..ac266fd8b322ba5e02f252d16e6e71e4ac7f5766 100644 (file)
@@ -447,5 +447,4 @@ public:
   int operate();
 };
 
-
 #endif