]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Object::Write::_do_write_meta() takes optional olh epoch
authorCasey Bodley <cbodley@redhat.com>
Fri, 1 Jun 2018 13:04:54 +0000 (09:04 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 12 Sep 2018 14:44:29 +0000 (16:44 +0200)
take an optional olh_epoch, and use its empty state to skip set_olh()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 519f1b407db91695a49de7bda04b02e86fd35c1b)

Conflicts:
    src/rgw/rgw_rados.h
- use boost::optional instead of std::optional

src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 876147417a68d2044c6d41aa0e3d2858ba36d087..eadbe61227fe549de6dce53de738e1170dcd8d29 100644 (file)
@@ -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;
     }
index c19aa3fe189758878b45289ec841947e7ef118bd..cf94303d6f9c18ab2e09b73fe721d01408f38d76 100644 (file)
@@ -2821,7 +2821,7 @@ public:
         int flags;
         const char *if_match;
         const char *if_nomatch;
-        uint64_t olh_epoch;
+        boost::optional<uint64_t> 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<uint64_t> 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) {}