Skip to content

Commit 3dab2ed

Browse files
committed
rgw: update attrs with replication status to reflect in response
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 <[email protected]>
1 parent 2f3c292 commit 3dab2ed

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/rgw/rgw_op.cc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,20 @@ void handle_replication_status_header(
917917
auto attr_iter = attrs.find(RGW_ATTR_OBJ_REPLICATION_STATUS);
918918
if (attr_iter != attrs.end() && attr_iter->second.to_str() == "PENDING") {
919919
if (s->object->is_sync_completed(dpp, obj_mtime)) {
920-
s->object->set_atomic();
921-
rgw::sal::Attrs setattrs, rmattrs;
922-
bufferlist bl;
923-
bl.append("COMPLETED");
924-
setattrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = std::move(bl);
925-
int ret = s->object->set_obj_attrs(dpp, &setattrs, &rmattrs, s->yield, 0);
926-
if (ret == 0) {
927-
ldpp_dout(dpp, 20) << *s->object << " has amz-replication-status header set to COMPLETED" << dendl;
928-
}
920+
s->object->set_atomic();
921+
rgw::sal::Attrs setattrs, rmattrs;
922+
bufferlist bl;
923+
bl.append("COMPLETED");
924+
setattrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = bl;
925+
int ret = s->object->set_obj_attrs(dpp, &setattrs, &rmattrs, s->yield, 0);
926+
if (ret < 0) {
927+
ldpp_dout(dpp, 0) << "ERROR: failed to set object replication status to COMPLETED ret=" << ret << dendl;
928+
return;
929+
}
930+
931+
ldpp_dout(dpp, 20) << *s->object << " has amz-replication-status header set to COMPLETED" << dendl;
932+
933+
attrs[RGW_ATTR_OBJ_REPLICATION_STATUS] = std::move(bl); // update the attrs so that the status is reflected in the response
929934
}
930935
}
931936
}

0 commit comments

Comments
 (0)