]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: log sync module gets source object's meta
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 4 Aug 2016 20:00:53 +0000 (13:00 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:19 +0000 (10:31 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_sync_module.cc

index dff66ad0c85ea8e9594607a50fed89fe040ea7be..16c11450c910321b7d4a5c9ea8f72e2fe0818518 100644 (file)
@@ -1,11 +1,52 @@
 #include "rgw_common.h"
 #include "rgw_coroutine.h"
+#include "rgw_cr_rados.h"
 #include "rgw_sync_module.h"
-// #include "rgw_sync.h"
 #include "rgw_data_sync.h"
+#include "rgw_boost_asio_yield.h"
 
 #define dout_subsys ceph_subsys_rgw
 
+class RGWLogStatRemoteObjCR : public RGWCoroutine {
+  RGWDataSyncEnv *sync_env;
+
+  RGWBucketInfo bucket_info;
+  rgw_obj_key key;
+
+  ceph::real_time mtime;
+  uint64_t size;
+  map<string, bufferlist> attrs;
+
+
+public:
+  RGWLogStatRemoteObjCR(RGWDataSyncEnv *_sync_env,
+                        RGWBucketInfo& _bucket_info, rgw_obj_key& _key) : RGWCoroutine(_sync_env->cct),
+                                                                          sync_env(_sync_env),
+                                                                          bucket_info(_bucket_info), key(_key) {
+  }
+
+  ~RGWLogStatRemoteObjCR() {}
+
+  int operate() {
+    reenter(this) {
+      yield {
+        call(new RGWStatRemoteObjCR(sync_env->async_rados, sync_env->store,
+                      sync_env->source_zone,
+                      bucket_info, key, &mtime, &size, &attrs));
+      }
+      if (retcode < 0) {
+        ldout(sync_env->cct, 0) << "RGWStatRemoteObjCR() returned " << retcode << dendl;
+        return set_cr_error(retcode);
+      }
+      ldout(sync_env->cct, 0) << "stat of remote obj: z=" << sync_env->source_zone
+                              << " b=" << bucket_info.bucket << " k=" << key << " size=" << size << " mtime=" << mtime
+                              << " attrs=" << attrs << dendl;
+      return set_cr_done();
+    }
+    return 0;
+  }
+};
+
 class RGWLogDataSyncModule : public RGWDataSyncModule {
   string prefix;
 public:
@@ -13,7 +54,7 @@ public:
 
   RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch) override {
     ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
-    return NULL;
+    return new RGWLogStatRemoteObjCR(sync_env, bucket_info, key);
   }
   RGWCoroutine *remove_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch) override {
     ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: rm_object: b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;