Skip to content

Commit b99a47f

Browse files
committed
RGW | Added debugs in cases where precondition check fails
Signed-off-by: Ali Masarwa <[email protected]>
1 parent 55f5b76 commit b99a47f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6457,12 +6457,15 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
64576457

64586458
using namespace std::string_literals;
64596459
if (params.if_match && params.if_match != "*"sv) {
6460-
if(string if_match = rgw_string_unquote(params.if_match); dirent.meta.etag != if_match) {
6460+
string if_match = rgw_string_unquote(params.if_match);
6461+
ldpp_dout(dpp, 10) << "checking precondtion if_match: " << if_match << ", etag: " << dirent.meta.etag << dendl;
6462+
if(dirent.meta.etag != if_match) {
64616463
return -ERR_PRECONDITION_FAILED;
64626464
}
64636465
}
64646466

64656467
if (params.size_match.has_value()) {
6468+
ldpp_dout(dpp, 10) << "checking precondtion size_match: " << params.size_match << ", size: " << dirent.meta.size << dendl;
64666469
if (params.size_match != dirent.meta.size) {
64676470
return -ERR_PRECONDITION_FAILED;
64686471
}
@@ -6476,7 +6479,8 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
64766479
last_mod_time.tv_nsec = 0;
64776480
}
64786481

6479-
ldpp_dout(dpp, 10) << "If-Match-Last-Modified-Time: " << params.last_mod_time_match << " Last-Modified: " << ctime << dendl;
6482+
ldpp_dout(dpp, 10) << "checking precondtion If-Match-Last-Modified-Time: " << params.last_mod_time_match
6483+
<< ", Last-Modified: " << ctime << ", with high_precision_time:" << params.high_precision_time << dendl;
64806484
if (ctime != last_mod_time) {
64816485
return -ERR_PRECONDITION_FAILED;
64826486
}
@@ -7189,8 +7193,11 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op
71897193
ceph::real_time last_mod_time_match, bool high_precision_time,
71907194
const char *if_match, const char *if_nomatch, RGWObjState& current_state, optional_yield y)
71917195
{
7192-
if (size_match.has_value() && current_state.size != size_match) {
7193-
return -ERR_PRECONDITION_FAILED;
7196+
if (size_match.has_value()) {
7197+
ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions size_match: " << size_match.value() << ", size: " << current_state.size << dendl;
7198+
if (current_state.size != size_match) {
7199+
return -ERR_PRECONDITION_FAILED;
7200+
}
71947201
}
71957202

71967203
if (!real_clock::is_zero(last_mod_time_match)) {
@@ -7201,7 +7208,8 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op
72017208
last_mod_time.tv_nsec = 0;
72027209
}
72037210

7204-
ldpp_dout(dpp, 10) << "If-Match-Last-Modified-Time: " << last_mod_time_match << " Last-Modified: " << ctime << dendl;
7211+
ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions If-Match-Last-Modified-Time: " << last_mod_time_match
7212+
<< ", Last-Modified: " << ctime << ", with high_precision_time:" << high_precision_time << dendl;
72057213
if (ctime != last_mod_time) {
72067214
return -ERR_PRECONDITION_FAILED;
72077215
}
@@ -7219,10 +7227,12 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op
72197227
if (current_state.get_attr(RGW_ATTR_ETAG, bl)) {
72207228
string if_match_str = rgw_string_unquote(if_match);
72217229
string etag = string(bl.c_str(), bl.length());
7230+
ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match: " << if_match_str << ", etag: " << etag << dendl;
72227231
if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) {
72237232
return -ERR_PRECONDITION_FAILED;
72247233
}
72257234
} else {
7235+
ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match object has no etag" << dendl;
72267236
return (!current_state.exists)? -ENOENT: -ERR_PRECONDITION_FAILED;
72277237
}
72287238
}
@@ -7239,6 +7249,7 @@ int RGWRados::Object::check_preconditions(const DoutPrefixProvider *dpp, std::op
72397249
if (current_state.get_attr(RGW_ATTR_ETAG, bl)) {
72407250
string if_nomatch_str = rgw_string_unquote(if_nomatch);
72417251
string etag = string(bl.c_str(), bl.length());
7252+
ldpp_dout(dpp, 10) << "RGWRados::Object::check_preconditions if_match: " << if_nomatch_str << ", etag: " << etag << dendl;
72427253
if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) {
72437254
return -ERR_PRECONDITION_FAILED;
72447255
}

0 commit comments

Comments
 (0)