]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW | fix conditional MultiWrite
authorAli Masarwa <amasarwa@redhat.com>
Sun, 3 Aug 2025 11:00:11 +0000 (14:00 +0300)
committerAli Masarwa <amasarwa@redhat.com>
Wed, 17 Sep 2025 14:48:10 +0000 (17:48 +0300)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
17 files changed:
src/rgw/driver/d4n/rgw_sal_d4n.cc
src/rgw/driver/d4n/rgw_sal_d4n.h
src/rgw/driver/motr/rgw_sal_motr.cc
src/rgw/driver/motr/rgw_sal_motr.h
src/rgw/driver/posix/rgw_sal_posix.cc
src/rgw/driver/posix/rgw_sal_posix.h
src/rgw/driver/rados/rgw_putobj_processor.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h

index 1b118726f1e5b6be3a8ca210889f6d9505cbca28..6c6700d7f1a680baf0432d066c5244b268e5ea56 100644 (file)
@@ -2891,7 +2891,9 @@ int D4NFilterMultipartUpload::complete(const DoutPrefixProvider *dpp,
                                    std::string& tag, ACLOwner& owner,
                                    uint64_t olh_epoch,
                                    rgw::sal::Object* target_obj,
-            prefix_map_t& processed_prefixes)
+            prefix_map_t& processed_prefixes,
+            const char *if_match,
+            const char *if_nomatch)
 {
   //call next->complete to complete writing the object to the backend store
   auto ret = next->complete(dpp, y, cct, part_etags, remove_objs, accounted_size,
index 1478aa5f40f49171f0785fca4a2d6ca15218e071..473a03a42608f1f483debfd0ef73d93943b71b03 100644 (file)
@@ -355,7 +355,9 @@ public:
                                    std::string& tag, ACLOwner& owner,
                                    uint64_t olh_epoch,
                                    rgw::sal::Object* target_obj,
-            prefix_map_t& processed_prefixes) override;
+            prefix_map_t& processed_prefixes,
+            const char *if_match = nullptr,
+            const char *if_nomatch = nullptr) override;
 };
 
 } } // namespace rgw::sal
index 3cb654fe41bf4df878f74d5e67b8559e0a7a843a..f156ab2d4ab1f082717309f11db73c963fa842a3 100644 (file)
@@ -2675,7 +2675,9 @@ int MotrMultipartUpload::complete(const DoutPrefixProvider *dpp,
                                   std::string& tag, ACLOwner& owner,
                                   uint64_t olh_epoch,
                                   rgw::sal::Object* target_obj,
-                                  prefix_map_t& processed_prefixes)
+                                  prefix_map_t& processed_prefixes,
+           const char *if_match,
+           const char *if_nomatch)
 {
   char final_etag[CEPH_CRYPTO_MD5_DIGESTSIZE];
   char final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
index 709b77c34a565642432791bd3bbb04b61d9ac0b9..cf4cf1069b04c5d7d8a915aca500971be3a6a8cd 100644 (file)
@@ -939,7 +939,9 @@ public:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                      prefix_map_t& processed_prefixes) override;
+                      prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) override;
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
            CephContext *cct, optional_yield y,
            const rgw_obj& obj,
index b309d0b203fbd40aaa0adadfe017e277de8bde6d..9fe4fe3d0ca9b596c72cff88e412f6c9cf162134 100644 (file)
@@ -3918,7 +3918,9 @@ int POSIXMultipartUpload::complete(const DoutPrefixProvider *dpp,
                                    std::string& tag, ACLOwner& owner,
                                    uint64_t olh_epoch,
                                    rgw::sal::Object* target_obj,
-                                   prefix_map_t& processed_prefixes)
+                                   prefix_map_t& processed_prefixes,
+            const char *if_match,
+            const char *if_nomatch)
 {
   char final_etag[CEPH_CRYPTO_MD5_DIGESTSIZE];
   char final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
index fe664574d2d1b6cc9207aa3cfe60e56b710e6a44..f9193eb4aa36161c728adbba41ed2f3a22851947 100644 (file)
@@ -1284,7 +1284,9 @@ public:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                      prefix_map_t& processed_prefixes) override;
+                      prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) override;
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
                                      CephContext *cct, optional_yield y,
                                      const rgw_obj& obj,
index 645f744be4416f956e2ed7acb05ed999974205e1..c892d9c1dff4c1599f28ea8d876c69faee068c99 100644 (file)
@@ -560,6 +560,8 @@ int MultipartObjectProcessor::complete(
   obj_op.meta.delete_at = delete_at;
   obj_op.meta.zones_trace = zones_trace;
   obj_op.meta.modify_tail = true;
+  obj_op.meta.if_match = if_match;
+  obj_op.meta.if_nomatch = if_nomatch;
 
   r = obj_op.write_meta(actual_size, accounted_size, attrs, rctx,
                         writer.get_trace(), flags & rgw::sal::FLAG_LOG_OP);
@@ -791,6 +793,8 @@ int AppendObjectProcessor::complete(
   obj_op.meta.modify_tail = true;
   obj_op.meta.keep_tail = keep_tail;
   obj_op.meta.appendable = true;
+  obj_op.meta.if_match = if_match;
+  obj_op.meta.if_nomatch = if_nomatch;
   //Add the append part number
   bufferlist cur_part_num_bl;
   using ceph::encode;
index 6c74ccde9c97b6c0171c9d209c94832b7df8ad33..de0d37f046ccc8a69e72e16a9c119d4a47ff0743 100644 (file)
@@ -4149,7 +4149,9 @@ int RadosMultipartUpload::complete(const DoutPrefixProvider *dpp,
                                   std::string& tag, ACLOwner& owner,
                                   uint64_t olh_epoch,
                                   rgw::sal::Object* target_obj,
-                                  prefix_map_t& processed_prefixes)
+                                  prefix_map_t& processed_prefixes,
+           const char *if_match,
+           const char *if_nomatch)
 {
   char final_etag[CEPH_CRYPTO_MD5_DIGESTSIZE];
   char final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
@@ -4340,6 +4342,8 @@ int RadosMultipartUpload::complete(const DoutPrefixProvider *dpp,
   obj_op.meta.modify_tail = true;
   obj_op.meta.completeMultipart = true;
   obj_op.meta.olh_epoch = olh_epoch;
+  obj_op.meta.if_match = if_match;
+  obj_op.meta.if_nomatch = if_nomatch;
 
   const req_context rctx{dpp, y, nullptr};
   ret = obj_op.write_meta(ofs, accounted_size, attrs, rctx, get_trace());
index eb48cc31634cdd4a8fa0ef44bf3ace5b15cd5259..4ab9141e18b8565a81f45067e528b06a83a293dd 100644 (file)
@@ -875,7 +875,9 @@ public:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                      prefix_map_t& processed_prefixes) override;
+                      prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) override;
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
                                      CephContext *cct, optional_yield y,
                                      const rgw_obj& obj,
index 36fc34961e5954d0a5ecda8e9cb4056dc6a547e3..8a7af75f920c31394fc96fd72a2f9c6211b851fc 100644 (file)
@@ -7197,7 +7197,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
   op_ret =
     upload->complete(this, y, s->cct, parts->parts, remove_objs, accounted_size,
                      compressed, cs_info, ofs, s->req_id, s->owner, olh_epoch,
-                     s->object.get(), processed_prefixes);
+                     s->object.get(), processed_prefixes, if_match, if_nomatch);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: upload complete failed ret=" << op_ret << dendl;
     return;
index 85f283551eef65334bce37e46ff939fb14a2a3b8..f3068fe55512361bf789d10fd5733c5ff7d89c9a 100644 (file)
@@ -2015,6 +2015,8 @@ protected:
   std::optional<rgw::cksum::Cksum> cksum;
   std::optional<std::string> armored_cksum;
   off_t ofs = 0;
+  const char *if_match{nullptr};
+  const char *if_nomatch{nullptr};
 
 public:
   RGWCompleteMultipart() {}
index 73bd030bbaa6372f05921f9313b275ccc275fd1f..df17c2d12773be61b3a705c39b8c5e3772570464 100644 (file)
@@ -4668,6 +4668,9 @@ int RGWCompleteMultipart_ObjStore_S3::get_params(optional_yield y)
     return ret;
   }
 
+  if_match = s->info.env->get("HTTP_IF_MATCH");
+  if_nomatch = s->info.env->get("HTTP_IF_NONE_MATCH");
+
   map_qs_metadata(s, true);
 
   return do_aws4_auth_completion();
index 42626160c13e4f8004f922c8df2421374dd48ec1..2d6d1bed276b3a5955c511092900447776b86102 100644 (file)
@@ -1530,7 +1530,9 @@ public:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                       prefix_map_t& processed_prefixes) = 0;
+           prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) = 0;
   /** Cleanup orphaned parts caused by racing condition involving part upload retry */
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
                                      CephContext *cct, optional_yield y,
index 3b456b46366f1c56452fe29cf250f98f329c5d71..2bb397c35a58521df58a0228498e8b1679c0d368 100644 (file)
@@ -926,7 +926,9 @@ namespace rgw::sal {
                                   std::string& tag, ACLOwner& owner,
                                   uint64_t olh_epoch,
                                   rgw::sal::Object* target_obj,
-                                  prefix_map_t& processed_prefixes)
+                                  prefix_map_t& processed_prefixes,
+           const char *if_match,
+           const char *if_nomatch)
   {
     char final_etag[CEPH_CRYPTO_MD5_DIGESTSIZE];
     char final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
index 1fa10e0c70b9229ad6d816853c5076eeb4a0939e..c676b77cf7433cbb1b7ce47287136058d223e68b 100644 (file)
@@ -461,7 +461,9 @@ protected:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                      prefix_map_t& processed_prefixes) override;
+                      prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) override;
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
                                      CephContext *cct, optional_yield y,
                                      const rgw_obj& obj,
index 99c5168fddea9bcfc213c0b3440c2cc026fec40b..2dbaa49d1af2daa9599ac6a3a36ef5f7a6662499 100644 (file)
@@ -1334,7 +1334,9 @@ int FilterMultipartUpload::complete(const DoutPrefixProvider *dpp,
                                    std::string& tag, ACLOwner& owner,
                                    uint64_t olh_epoch,
                                    rgw::sal::Object* target_obj,
-                                   prefix_map_t& processed_prefixes)
+                                   prefix_map_t& processed_prefixes,
+            const char *if_match,
+            const char *if_nomatch)
 {
   return next->complete(dpp, y, cct, part_etags, remove_objs, accounted_size,
                        compressed, cs_info, ofs, tag, owner, olh_epoch,
index 8607712f6f107454c99cd223b89e7e944f645cb2..086e8bc733a2c07b6e54f61bff150b5eec9a0dd7 100644 (file)
@@ -978,7 +978,9 @@ public:
                       std::string& tag, ACLOwner& owner,
                       uint64_t olh_epoch,
                       rgw::sal::Object* target_obj,
-                      prefix_map_t& processed_prefixes) override;
+                      prefix_map_t& processed_prefixes,
+           const char *if_match = nullptr,
+           const char *if_nomatch = nullptr) override;
   virtual int cleanup_orphaned_parts(const DoutPrefixProvider *dpp,
                                      CephContext *cct, optional_yield y,
                                      const rgw_obj& obj,