Skip to content

Commit e4daef7

Browse files
rgw/d4n: removing calls to redis MULTI, DISCARD, WATCH,
UNWATCH and EXEC since other options for Redis transactions are being explored. Signed-off-by: Pritha Srivastava <[email protected]>
1 parent 81e6b62 commit e4daef7

File tree

3 files changed

+11
-142
lines changed

3 files changed

+11
-142
lines changed

src/rgw/driver/d4n/d4n_policy.cc

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -865,11 +865,6 @@ void LFUDAPolicy::cleaning(const DoutPrefixProvider* dpp)
865865
block.blockID = 0;
866866
//non-versioned case
867867
if (!c_obj->have_instance()) {
868-
//add watch on latest entry, as it can be modified by a put or a del
869-
ret = blockDir->watch(dpp, &block, y);
870-
if (ret < 0) {
871-
ldpp_dout(dpp, 0) << __func__ << "(): Failed to add a watch on: " << block.cacheObj.objName << ", ret=" << ret << dendl;
872-
}
873868
// hash entry for latest version
874869
op_ret = blockDir->get(dpp, &block, y);
875870
if (op_ret < 0) {
@@ -888,20 +883,10 @@ void LFUDAPolicy::cleaning(const DoutPrefixProvider* dpp)
888883
if (null_block.version == e->version) {
889884
block.cacheObj.dirty = false;
890885
null_block.cacheObj.dirty = false;
891-
//start redis transaction using MULTI
892-
blockDir->multi(dpp, y);
893886
auto blk_op_ret = blockDir->set(dpp, &block, y);
894887
auto null_op_ret = blockDir->set(dpp, &null_block, y);
895888
if (blk_op_ret < 0 || null_op_ret < 0) {
896-
blockDir->discard(dpp, y);
897889
ldpp_dout(dpp, 0) << __func__ << "(): Failed to Queue update dirty flag for latest entry/null entry in block directory" << dendl;
898-
} else {
899-
std::vector<std::string> responses;
900-
ret = blockDir->exec(dpp, responses, y);
901-
if (responses.empty()) {
902-
//transaction failed, which means latest hash entry has been modified by a put/del so ignore and do not update the entries
903-
ldpp_dout(dpp, 0) << __func__ << "(): Execute responses are empty which means transaction failed!" << dendl;
904-
}
905890
}
906891
}
907892
}
@@ -937,11 +922,6 @@ void LFUDAPolicy::cleaning(const DoutPrefixProvider* dpp)
937922
//the next steps remove the entry from the ordered set and if needed the latest hash entry also in case of versioned buckets
938923
rgw::d4n::CacheBlock latest_block = block;
939924
latest_block.cacheObj.objName = c_obj->get_name();
940-
//add watch on latest entry, as it can be modified by a put or a del
941-
ret = blockDir->watch(dpp, &latest_block, y);
942-
if (ret < 0) {
943-
ldpp_dout(dpp, 0) << __func__ << "(): Failed to add a watch on: " << latest_block.cacheObj.objName << ", ret=" << ret << dendl;
944-
}
945925
int retry = 3;
946926
while(retry) {
947927
retry--;
@@ -950,14 +930,11 @@ void LFUDAPolicy::cleaning(const DoutPrefixProvider* dpp)
950930
if (ret < 0) {
951931
ldpp_dout(dpp, 0) << __func__ << "(): Failed to get latest entry in block directory for: " << latest_block.cacheObj.objName << ", ret=" << ret << dendl;
952932
}
953-
//start redis transaction using MULTI
954-
blockDir->multi(dpp, y);
955933
if (latest_block.version == e->version) {
956934
//remove object entry from ordered set
957935
if (c_obj->have_instance()) {
958-
blockDir->del(dpp, &latest_block, y, true);
936+
blockDir->del(dpp, &latest_block, y);
959937
if (ret < 0) {
960-
blockDir->discard(dpp, y);
961938
ldpp_dout(dpp, 0) << __func__ << "(): Failed to queue del for latest hash entry: " << latest_block.cacheObj.objName << ", ret=" << ret << dendl;
962939
continue;
963940
}
@@ -970,16 +947,9 @@ void LFUDAPolicy::cleaning(const DoutPrefixProvider* dpp)
970947
};
971948
ret = objDir->zremrangebyscore(dpp, &dir_obj, e->creationTime, e->creationTime, y, true);
972949
if (ret < 0) {
973-
blockDir->discard(dpp, y);
974950
ldpp_dout(dpp, 0) << __func__ << "(): Failed to remove object from ordered set with error: " << ret << dendl;
975951
continue;
976952
}
977-
std::vector<std::string> responses;
978-
ret = blockDir->exec(dpp, responses, y);
979-
if (responses.empty()) {
980-
ldpp_dout(dpp, 0) << __func__ << "(): Execute responses are empty hence continuing!" << dendl;
981-
continue;
982-
}
983953
break;
984954
}//end-while (retry)
985955
}

0 commit comments

Comments
 (0)