From: Casey Bodley Date: Thu, 29 Sep 2016 16:34:17 +0000 (-0400) Subject: rgw: pass accounted_size directly into RGWPutObjProcessor::complete X-Git-Tag: v11.1.0~429^2~12 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7902ce2069970ee1b6aa9148fe1a971236b74875;p=ceph-ci.git rgw: pass accounted_size directly into RGWPutObjProcessor::complete Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 95b0c61f4a1..bd5b772150e 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2585,9 +2585,10 @@ class RGWPutObjProcessor_Multipart : public RGWPutObjProcessor_Atomic protected: int prepare(RGWRados *store, string *oid_rand); - int do_complete(string& etag, real_time *mtime, real_time set_mtime, - map& attrs, real_time delete_at, - const char *if_match = NULL, const char *if_nomatch = NULL); + int do_complete(size_t accounted_size, const string& etag, real_time *mtime, + real_time set_mtime, map& attrs, + real_time delete_at, const char *if_match, + const char *if_nomatch) override; public: bool immutable_head() { return true; } @@ -2659,9 +2660,13 @@ static bool is_v2_upload_id(const string& upload_id) (strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX_LEGACY, sizeof(MULTIPART_UPLOAD_ID_PREFIX_LEGACY) - 1) == 0); } -int RGWPutObjProcessor_Multipart::do_complete(string& etag, real_time *mtime, real_time set_mtime, - map& attrs, real_time delete_at, - const char *if_match, const char *if_nomatch) +int RGWPutObjProcessor_Multipart::do_complete(size_t accounted_size, + const string& etag, + real_time *mtime, real_time set_mtime, + map& attrs, + real_time delete_at, + const char *if_match, + const char *if_nomatch) { complete_writing_data(); @@ -2673,7 +2678,7 @@ int RGWPutObjProcessor_Multipart::do_complete(string& etag, real_time *mtime, re head_obj_op.meta.owner = s->owner.get_id(); head_obj_op.meta.delete_at = delete_at; - int r = head_obj_op.write_meta(obj_len, obj_len, attrs); + int r = head_obj_op.write_meta(obj_len, accounted_size, attrs); if (r < 0) return r; @@ -2697,8 +2702,8 @@ int RGWPutObjProcessor_Multipart::do_complete(string& etag, real_time *mtime, re } info.num = atoi(part_num.c_str()); info.etag = etag; - info.size = s->obj_size; - info.accounted_size = s->obj_size; // TODO + info.size = obj_len; + info.accounted_size = accounted_size; info.modified = real_clock::now(); info.manifest = manifest; @@ -3124,8 +3129,8 @@ void RGWPutObj::execute() emplace_attr(RGW_ATTR_SLO_UINDICATOR, std::move(slo_userindicator_bl)); } - op_ret = processor->complete(etag, &mtime, real_time(), attrs, delete_at, - if_match, if_nomatch); + op_ret = processor->complete(s->obj_size, etag, &mtime, real_time(), attrs, + delete_at, if_match, if_nomatch); /* produce torrent */ if (s->cct->_conf->rgw_torrent_flag && (ofs == torrent.get_data_len())) @@ -3289,7 +3294,7 @@ void RGWPostObj::execute() emplace_attr(RGW_ATTR_COMPRESSION, std::move(tmp)); } - op_ret = processor.complete(etag, NULL, real_time(), attrs, delete_at); + op_ret = processor.complete(s->obj_size, etag, NULL, real_time(), attrs, delete_at); } @@ -4957,7 +4962,7 @@ void RGWCompleteMultipart::execute() obj_op.meta.ptag = &s->req_id; /* use req_id as operation tag */ obj_op.meta.owner = s->owner.get_id(); obj_op.meta.flags = PUT_OBJ_CREATE; - op_ret = obj_op.write_meta(ofs, ofs, attrs); + op_ret = obj_op.write_meta(ofs, accounted_size, attrs); if (op_ret < 0) return; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 8a6c492cdd4..89b3b7f4bb9 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2197,11 +2197,12 @@ void RGWObjVersionTracker::generate_new_write_ver(CephContext *cct) append_rand_alpha(cct, write_version.tag, write_version.tag, TAG_LEN); } -int RGWPutObjProcessor::complete(string& etag, real_time *mtime, real_time set_mtime, +int RGWPutObjProcessor::complete(size_t accounted_size, const string& etag, + real_time *mtime, real_time set_mtime, map& attrs, real_time delete_at, - const char *if_match, const char * if_nomatch) + const char *if_match, const char *if_nomatch) { - int r = do_complete(etag, mtime, set_mtime, attrs, delete_at, if_match, if_nomatch); + int r = do_complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at, if_match, if_nomatch); if (r < 0) return r; @@ -2511,8 +2512,10 @@ int RGWPutObjProcessor_Atomic::complete_writing_data() return 0; } -int RGWPutObjProcessor_Atomic::do_complete(string& etag, real_time *mtime, real_time set_mtime, - map& attrs, real_time delete_at, +int RGWPutObjProcessor_Atomic::do_complete(size_t accounted_size, const string& etag, + real_time *mtime, real_time set_mtime, + map& attrs, + real_time delete_at, const char *if_match, const char *if_nomatch) { int r = complete_writing_data(); @@ -2540,7 +2543,7 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, real_time *mtime, real_ obj_op.meta.olh_epoch = olh_epoch; obj_op.meta.delete_at = delete_at; - r = obj_op.write_meta(obj_len, obj_len, attrs); + r = obj_op.write_meta(obj_len, accounted_size, attrs); if (r < 0) { return r; } @@ -6733,8 +6736,9 @@ public: return data_len; } - int complete(string& etag, real_time *mtime, real_time set_mtime, map& attrs, real_time delete_at) { - return processor->complete(etag, mtime, set_mtime, attrs, delete_at); + int complete(const string& etag, real_time *mtime, real_time set_mtime, + map& attrs, real_time delete_at) { + return processor->complete(data_len, etag, mtime, set_mtime, attrs, delete_at); } bool is_canceled() { @@ -7638,7 +7642,8 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx, } } - ret = processor.complete(etag, mtime, set_mtime, attrs, delete_at); + // XXX: need to copy over compression attr and its orig_size here? + ret = processor.complete(ofs, etag, mtime, set_mtime, attrs, delete_at); return ret; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 788923e9726..12ac5691769 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -3356,9 +3356,10 @@ protected: RGWBucketInfo bucket_info; bool canceled; - virtual int do_complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime, + virtual int do_complete(size_t accounted_size, const string& etag, + ceph::real_time *mtime, ceph::real_time set_mtime, map& attrs, ceph::real_time delete_at, - const char *if_match = NULL, const char *if_nomatch = NULL) = 0; + const char *if_match, const char *if_nomatch) = 0; public: RGWPutObjProcessor(RGWObjectCtx& _obj_ctx, RGWBucketInfo& _bi) : store(NULL), @@ -3372,9 +3373,10 @@ public: return 0; } - virtual int complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime, - map& attrs, ceph::real_time delete_at, - const char *if_match = NULL, const char *if_nomatch = NULL); + int complete(size_t accounted_size, const string& etag, + ceph::real_time *mtime, ceph::real_time set_mtime, + map& attrs, ceph::real_time delete_at, + const char *if_match = NULL, const char *if_nomatch = NULL); CephContext *ctx(); @@ -3444,9 +3446,10 @@ protected: RGWObjManifest::generator manifest_gen; int write_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool exclusive); - virtual int do_complete(string& etag, ceph::real_time *mtime, ceph::real_time set_mtime, - map& attrs, ceph::real_time delete_at, - const char *if_match = NULL, const char *if_nomatch = NULL); + int do_complete(size_t accounted_size, const string& etag, + ceph::real_time *mtime, ceph::real_time set_mtime, + map& attrs, ceph::real_time delete_at, + const char *if_match, const char *if_nomatch) override; int prepare_next_part(off_t ofs); int complete_parts();