From: Casey Bodley Date: Fri, 1 Jun 2018 13:04:54 +0000 (-0400) Subject: rgw: Object::Write::_do_write_meta() takes optional olh epoch X-Git-Tag: v12.2.9~85^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0eaf8f4b894b8a2841334a987642a7dc2d08670;p=ceph.git rgw: Object::Write::_do_write_meta() takes optional olh epoch take an optional olh_epoch, and use its empty state to skip set_olh() Signed-off-by: Casey Bodley (cherry picked from commit 519f1b407db91695a49de7bda04b02e86fd35c1b) Conflicts: src/rgw/rgw_rados.h - use boost::optional instead of std::optional --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 876147417a68..eadbe61227fe 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7123,7 +7123,8 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si orig_size = state->accounted_size; } - bool versioned_target = (meta.olh_epoch > 0 || !obj.key.instance.empty()); + bool versioned_target = (meta.olh_epoch && *meta.olh_epoch > 0) || + !obj.key.instance.empty(); bool versioned_op = (target->versioning_enabled() || is_olh || versioned_target); @@ -7170,8 +7171,8 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si target->invalidate_state(); state = NULL; - if (versioned_op) { - r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, meta.olh_epoch, real_time(), false, meta.zones_trace); + if (versioned_op && meta.olh_epoch) { + r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, meta.zones_trace); if (r < 0) { return r; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index c19aa3fe1897..cf94303d6f9c 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -2821,7 +2821,7 @@ public: int flags; const char *if_match; const char *if_nomatch; - uint64_t olh_epoch; + boost::optional olh_epoch; ceph::real_time delete_at; bool canceled; const string *user_data; @@ -2831,7 +2831,7 @@ public: MetaParams() : mtime(NULL), rmattrs(NULL), data(NULL), manifest(NULL), ptag(NULL), remove_objs(NULL), category(RGW_OBJ_CATEGORY_MAIN), flags(0), - if_match(NULL), if_nomatch(NULL), olh_epoch(0), canceled(false), user_data(nullptr), zones_trace(nullptr), + if_match(NULL), if_nomatch(NULL), canceled(false), user_data(nullptr), zones_trace(nullptr), modify_tail(false), completeMultipart(false) {} } meta; @@ -3994,7 +3994,7 @@ class RGWPutObjProcessor_Atomic : public RGWPutObjProcessor_Aio uint64_t max_chunk_size; bool versioned_object; - uint64_t olh_epoch; + boost::optional olh_epoch; string version_id; protected: @@ -4031,7 +4031,6 @@ public: data_ofs(0), max_chunk_size(0), versioned_object(versioned), - olh_epoch(0), bucket(_b), obj_str(_o), unique_tag(_t) {}