Skip to content

Commit 0f53297

Browse files
authored
Merge pull request ceph#64428 from sungjoon-koh/add-wildcard-support-cond-read
rgw: add wildcard "*" support for conditional read
2 parents 98d9be3 + beba28f commit 0f53297

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/rgw/driver/dbstore/common/dbstore.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,14 +1381,22 @@ int DB::Object::Read::prepare(const DoutPrefixProvider *dpp)
13811381

13821382
if (conds.if_match) {
13831383
string if_match_str = rgw_string_unquote(conds.if_match);
1384-
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl;
1385-
if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) {
1386-
return -ERR_PRECONDITION_FAILED;
1384+
if (if_match_str.compare("*") != 0) {
1385+
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl;
1386+
if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) {
1387+
return -ERR_PRECONDITION_FAILED;
1388+
}
1389+
} else {
1390+
ldpp_dout(dpp, 10) << "If-Match: " << if_match_str << dendl;
13871391
}
13881392
}
13891393

13901394
if (conds.if_nomatch) {
13911395
string if_nomatch_str = rgw_string_unquote(conds.if_nomatch);
1396+
if (if_nomatch_str.compare("*") == 0) {
1397+
ldpp_dout(dpp, 10) << "If-NoMatch: " << if_nomatch_str << dendl;
1398+
return -ERR_NOT_MODIFIED;
1399+
}
13921400
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-NoMatch: " << if_nomatch_str << dendl;
13931401
if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) {
13941402
return -ERR_NOT_MODIFIED;

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7788,14 +7788,22 @@ int RGWRados::Object::Read::prepare(optional_yield y, const DoutPrefixProvider *
77887788

77897789
if (conds.if_match) {
77907790
string if_match_str = rgw_string_unquote(conds.if_match);
7791-
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl;
7792-
if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) {
7793-
return -ERR_PRECONDITION_FAILED;
7791+
if (if_match_str.compare("*") != 0) {
7792+
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl;
7793+
if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) {
7794+
return -ERR_PRECONDITION_FAILED;
7795+
}
7796+
} else {
7797+
ldpp_dout(dpp, 10) << "If-Match: " << if_match_str << dendl;
77947798
}
77957799
}
77967800

77977801
if (conds.if_nomatch) {
77987802
string if_nomatch_str = rgw_string_unquote(conds.if_nomatch);
7803+
if (if_nomatch_str.compare("*") == 0) {
7804+
ldpp_dout(dpp, 10) << "If-NoMatch: " << if_nomatch_str << dendl;
7805+
return -ERR_NOT_MODIFIED;
7806+
}
77997807
ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-NoMatch: " << if_nomatch_str << dendl;
78007808
if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) {
78017809
return -ERR_NOT_MODIFIED;

0 commit comments

Comments
 (0)