]> git-server-git.apps.pok.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>
Wed, 26 Apr 2017 18:04:16 +0000 (14:04 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_sync.h

index 489ef589172593136a4b4f334f0e3db94544d13d..6c748dabc988b5f8f27f7abaabf2d64b12108ff4 100644 (file)
@@ -722,6 +722,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()
 {
   rgw_raw_obj raw_obj;
index 8496201e0cdf4933ea1d5789c52cc4dcae0aa1f3..52cacde3bdf5c37f684f43dac8e7d685dd59e88c 100644 (file)
@@ -1091,6 +1091,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;
   RGWBucketInfo bucket_info;
index a1698b5fffdc6b8f7659b32b4db92b3dca2bfcfe..ea69374b074691e668582421ac53952e9f5b2f0e 100644 (file)
@@ -2936,29 +2936,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;
@@ -3036,7 +3013,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 bb245aedceb817694a07898f1de09b01f2ff7fd2..7a39bd68eea2c693fedce8f8ce1a2b8a70ed305d 100644 (file)
@@ -450,5 +450,4 @@ public:
   int operate() override;
 };
 
-
 #endif