]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: update attrs with replication status to reflect in response 61407/head
authorSeena Fallah <seenafallah@gmail.com>
Sun, 3 Nov 2024 22:18:57 +0000 (23:18 +0100)
committerSeena Fallah <seenafallah@gmail.com>
Wed, 15 Jan 2025 20:18:30 +0000 (21:18 +0100)
In handle_replication_status_header() when the COMPLETED status is
being set to object's attr, it needs to be reflected to the current
live attrs for the corresponding request so it can be reflected in
the first try than the second.

Fixes: https://tracker.ceph.com/issues/69549
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
src/rgw/rgw_op.cc

index 7b0ca3134a3068dd67cac55d9c654851845d90ed..9f25d275852862e5fbbf87b2484b960d967e4a97 100644 (file)
@@ -917,15 +917,20 @@ void handle_replication_status_header(
   auto attr_iter = attrs.find(RGW_ATTR_OBJ_REPLICATION_STATUS);
   if (attr_iter != attrs.end() && attr_iter->second.to_str() == "PENDING") {
     if (s->object->is_sync_completed(dpp, obj_mtime)) {
-        s->object->set_atomic();
-        rgw::sal::Attrs setattrs, rmattrs;
-        bufferlist bl;
-        bl.append("COMPLETED");
-        setattrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = std::move(bl);
-       int ret = s->object->set_obj_attrs(dpp, &setattrs, &rmattrs, s->yield, 0);
-       if (ret == 0) {
-         ldpp_dout(dpp, 20) << *s->object << " has amz-replication-status header set to COMPLETED" << dendl;
-       }
+      s->object->set_atomic();
+      rgw::sal::Attrs setattrs, rmattrs;
+      bufferlist bl;
+      bl.append("COMPLETED");
+      setattrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = bl;
+      int ret = s->object->set_obj_attrs(dpp, &setattrs, &rmattrs, s->yield, 0);
+      if (ret < 0) {
+        ldpp_dout(dpp, 0) << "ERROR: failed to set object replication status to COMPLETED ret=" << ret << dendl;
+        return;
+      }
+
+      ldpp_dout(dpp, 20) << *s->object << " has amz-replication-status header set to COMPLETED" << dendl;
+
+      attrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = std::move(bl); // update the attrs so that the status is reflected in the response
     }
   }
 }