]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fetch_remote_obj() uses correct version_id
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 8 Oct 2015 22:52:13 +0000 (15:52 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:12:58 +0000 (16:12 -0800)
This fixes one aspect of the versioned objects sync

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_data_sync.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_conn.cc

index a0107950f5cb3162061c2205f743e506ed94ff87..2a66fd88527ef976a0a7c28a30a026e42702e1c0 100644 (file)
@@ -429,7 +429,7 @@ int RGWAsyncFetchRemoteObj::_send_request()
                        RGW_OBJ_CATEGORY_MAIN,
                        versioned_epoch,
                        0, /* delete_at */
-                       NULL, /* string *version_id, */
+                       &key.instance, /* string *version_id, */
                        NULL, /* string *ptag, */
                        NULL, /* string *petag, */
                        NULL, /* struct rgw_err *err, */
index 983a7c9c7bd60f47502ad9b26898552c2c42f017..c472c44ba4c257f08c963a84358953563e616de9 100644 (file)
@@ -1767,6 +1767,7 @@ public:
       yield {
         int r;
         if (op == CLS_RGW_OP_ADD) {
+          ldout(store->ctx(), 5) << "bucket sync: sync obj: " << source_zone << "/" << bucket_info->bucket << "/" << key << "[" << versioned_epoch << "]" << dendl;
           r = call(new RGWFetchRemoteObjCR(async_rados, store, source_zone, *bucket_info,
                                            key, versioned_epoch,
                                            true));
index 7ecc9f17fd6349a341d58e7c10e06e229de47afc..4aaec1e15b5b3c0945a783a4afda45d2fa3c2b77 100644 (file)
@@ -5252,6 +5252,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
   RGWPutObjProcessor_Atomic processor(obj_ctx,
                                       dest_bucket_info, dest_obj.bucket, dest_obj.get_orig_obj(),
                                       cct->_conf->rgw_obj_stripe_size, tag, dest_bucket_info.versioning_enabled());
+  processor.set_version_id(dest_obj.get_instance());
   int ret = processor.prepare(this, NULL);
   if (ret < 0) {
     return ret;
index 0738992f7465ca7858bae6f55d4a07695393b37e..24c0b86ea7eab6a9e4210b9486cec24fc5b70892 100644 (file)
@@ -124,6 +124,10 @@ int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, rgw
   if (prepend_metadata) {
     params.push_back(pair<string, string>(RGW_SYS_PARAM_PREFIX "prepend-metadata", zone_group));
   }
+  if (!obj.get_instance().empty()) {
+    const string& instance = obj.get_instance();
+    params.push_back(pair<string, string>("versionId", instance));
+  }
   *req = new RGWRESTStreamReadRequest(cct, url, cb, NULL, &params);
   map<string, string> extra_headers;
   if (info) {