From 8b69847d7b3e92c70090d1dddf7cea5c44fb6b20 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 8 Mar 2017 16:31:34 -0500 Subject: [PATCH] rgw: data sync skips slo data when syncing the manifest object Fixes: http://tracker.ceph.com/issues/19027 Signed-off-by: Casey Bodley --- src/rgw/rgw_rados.cc | 4 ++-- src/rgw/rgw_rest_conn.cc | 6 +++++- src/rgw/rgw_rest_conn.h | 2 +- src/rgw/rgw_rest_s3.cc | 9 +++++++++ src/rgw/rgw_rest_s3.h | 1 + 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index da90e7afaee..205e4feac13 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7001,7 +7001,7 @@ int RGWRados::stat_remote_obj(RGWObjectCtx& obj_ctx, int ret = conn->get_obj(user_id, info, src_obj, pmod, unmod_ptr, dest_mtime_weight.zone_short_id, dest_mtime_weight.pg_ver, true /* prepend_meta */, true /* GET */, true /* rgwx-stat */, - &cb, &in_stream_req); + true /* sync manifest */, &cb, &in_stream_req); if (ret < 0) { return ret; } @@ -7180,7 +7180,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, ret = conn->get_obj(user_id, info, src_obj, pmod, unmod_ptr, dest_mtime_weight.zone_short_id, dest_mtime_weight.pg_ver, true /* prepend_meta */, true /* GET */, false /* rgwx-stat */, - &cb, &in_stream_req); + true /* sync manifest */, &cb, &in_stream_req); if (ret < 0) { goto set_err_state; } diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index f7bfb3984b6..8699624002b 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -129,7 +129,8 @@ int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, rgw const real_time *mod_ptr, const real_time *unmod_ptr, uint32_t mod_zone_id, uint64_t mod_pg_ver, bool prepend_metadata, bool get_op, bool rgwx_stat, - RGWGetDataCB *cb, RGWRESTStreamRWRequest **req) + bool sync_manifest, RGWGetDataCB *cb, + RGWRESTStreamRWRequest **req) { string url; int ret = get_url(url); @@ -144,6 +145,9 @@ int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, rgw if (rgwx_stat) { params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "stat", "true")); } + if (sync_manifest) { + params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "sync-manifest", "")); + } if (!obj.key.instance.empty()) { const string& instance = obj.key.instance; params.push_back(param_pair_t("versionId", instance)); diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index 38d1d336421..674387ffa05 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -88,7 +88,7 @@ public: int get_obj(const rgw_user& uid, req_info *info /* optional */, rgw_obj& obj, const ceph::real_time *mod_ptr, const ceph::real_time *unmod_ptr, uint32_t mod_zone_id, uint64_t mod_pg_ver, - bool prepend_metadata, bool get_op, bool rgwx_stat, + bool prepend_metadata, bool get_op, bool rgwx_stat, bool sync_manifest, RGWGetDataCB *cb, RGWRESTStreamRWRequest **req); int complete_request(RGWRESTStreamRWRequest *req, string& etag, ceph::real_time *mtime, uint64_t *psize, map& attrs); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 277ff62c256..7f44125135d 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -114,6 +114,15 @@ int RGWGetObj_ObjStore_S3Website::send_response_data_error() return RGWGetObj_ObjStore_S3::send_response_data_error(); } +int RGWGetObj_ObjStore_S3::get_params() +{ + // for multisite sync requests, only read the slo manifest itself, rather than + // all of the data from its parts. the parts will sync as separate objects + skip_manifest = s->info.args.exists(RGW_SYS_PARAM_PREFIX "sync-manifest"); + + return RGWGetObj_ObjStore::get_params(); +} + int RGWGetObj_ObjStore_S3::send_response_data_error() { bufferlist bl; diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index c89e7c32980..89e67ff20da 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -37,6 +37,7 @@ public: RGWGetObj_ObjStore_S3() {} ~RGWGetObj_ObjStore_S3() override {} + int get_params() override; int send_response_data_error() override; int send_response_data(bufferlist& bl, off_t ofs, off_t len) override; void set_custom_http_response(int http_ret) { custom_http_ret = http_ret; } -- 2.47.3