From: Ali Masarwa Date: Thu, 24 Jul 2025 15:25:27 +0000 (+0300) Subject: RGW | Added debugs in cases where precondition check fails X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b99a47f1cb60e98bc2cf1c47f72953fd5accee17;p=ceph.git RGW | Added debugs in cases where precondition check fails Signed-off-by: Ali Masarwa --- diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 52f99a372a72..4ab7fe06e94f 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -6457,12 +6457,15 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, using namespace std::string_literals; if (params.if_match && params.if_match != "*"sv) { - if(string if_match = rgw_string_unquote(params.if_match); dirent.meta.etag != if_match) { + string if_match = rgw_string_unquote(params.if_match); + ldpp_dout(dpp, 10) << "checking precondtion if_match: " << if_match << ", etag: " << dirent.meta.etag << dendl; + if(dirent.meta.etag != if_match) { return -ERR_PRECONDITION_FAILED; } } if (params.size_match.has_value()) { + ldpp_dout(dpp, 10) << "checking precondtion size_match: " << params.size_match << ", size: " << dirent.meta.size << dendl; if (params.size_match != dirent.meta.size) { return -ERR_PRECONDITION_FAILED; } @@ -6476,7 +6479,8 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, last_mod_time.tv_nsec = 0; } - ldpp_dout(dpp, 10) << "If-Match-Last-Modified-Time: " << params.last_mod_time_match << " Last-Modified: " << ctime << dendl; + ldpp_dout(dpp, 10) << "checking precondtion If-Match-Last-Modified-Time: " << params.last_mod_time_match + << ", Last-Modified: " << ctime << ", with high_precision_time:" << params.high_precision_time << dendl; if (ctime != last_mod_time) { return -ERR_PRECONDITION_FAILED; } @@ -7189,8 +7193,11 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op ceph::real_time last_mod_time_match, bool high_precision_time, const char *if_match, const char *if_nomatch, RGWObjState& current_state, optional_yield y) { - if (size_match.has_value() && current_state.size != size_match) { - return -ERR_PRECONDITION_FAILED; + if (size_match.has_value()) { + ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions size_match: " << size_match.value() << ", size: " << current_state.size << dendl; + if (current_state.size != size_match) { + return -ERR_PRECONDITION_FAILED; + } } if (!real_clock::is_zero(last_mod_time_match)) { @@ -7201,7 +7208,8 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op last_mod_time.tv_nsec = 0; } - ldpp_dout(dpp, 10) << "If-Match-Last-Modified-Time: " << last_mod_time_match << " Last-Modified: " << ctime << dendl; + ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions If-Match-Last-Modified-Time: " << last_mod_time_match + << ", Last-Modified: " << ctime << ", with high_precision_time:" << high_precision_time << dendl; if (ctime != last_mod_time) { return -ERR_PRECONDITION_FAILED; } @@ -7219,10 +7227,12 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op if (current_state.get_attr(RGW_ATTR_ETAG, bl)) { string if_match_str = rgw_string_unquote(if_match); string etag = string(bl.c_str(), bl.length()); + ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match: " << if_match_str << ", etag: " << etag << dendl; if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) { return -ERR_PRECONDITION_FAILED; } } else { + ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match object has no etag" << dendl; return (!current_state.exists)? -ENOENT: -ERR_PRECONDITION_FAILED; } } @@ -7239,6 +7249,7 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op if (current_state.get_attr(RGW_ATTR_ETAG, bl)) { string if_nomatch_str = rgw_string_unquote(if_nomatch); string etag = string(bl.c_str(), bl.length()); + ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match: " << if_nomatch_str << ", etag: " << etag << dendl; if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) { return -ERR_PRECONDITION_FAILED; }