From 5e368857bb39ff724fddb012af60036c7b7ddeb7 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 8 Oct 2015 15:52:13 -0700 Subject: [PATCH] rgw: fetch_remote_obj() uses correct version_id This fixes one aspect of the versioned objects sync Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_cr_rados.cc | 2 +- src/rgw/rgw_data_sync.cc | 1 + src/rgw/rgw_rados.cc | 1 + src/rgw/rgw_rest_conn.cc | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index a0107950f5cb3..2a66fd88527ef 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -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, */ diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 983a7c9c7bd60..c472c44ba4c25 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -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)); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 7ecc9f17fd634..4aaec1e15b5b3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index 0738992f7465c..24c0b86ea7eab 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -124,6 +124,10 @@ int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, rgw if (prepend_metadata) { params.push_back(pair(RGW_SYS_PARAM_PREFIX "prepend-metadata", zone_group)); } + if (!obj.get_instance().empty()) { + const string& instance = obj.get_instance(); + params.push_back(pair("versionId", instance)); + } *req = new RGWRESTStreamReadRequest(cct, url, cb, NULL, ¶ms); map extra_headers; if (info) { -- 2.39.5