Skip to content

Commit

Permalink
MB-24221: Don't fetch deleted values as part of get_if
Browse files Browse the repository at this point in the history
The get_if doesn't support deleted values. Hence, it shouldn't be
part of the options.

Change-Id: I12270a8e61ec7a04b3d166626eb534736e7e403e
Reviewed-on: http://review.couchbase.org/77746
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
  • Loading branch information
Sriram Ganesan authored and daverigby committed May 8, 2017
1 parent d754de3 commit 1e08035
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/ep_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2179,8 +2179,7 @@ cb::EngineErrorItemPair EventuallyPersistentEngine::get_if(const void* cookie,
TRACK_REFERENCE |
DELETE_TEMP |
HIDE_LOCKED_CAS |
ALLOW_META_ONLY |
GET_DELETED_VALUE);
ALLOW_META_ONLY);
if (ii == 1 || kvBucket->getItemEvictionPolicy() == FULL_EVICTION) {
options = static_cast<get_options_t>(int(options) | QUEUE_BG_FETCH);
}
Expand Down
10 changes: 10 additions & 0 deletions tests/ep_testsuite_basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,16 @@ static test_result get_if(ENGINE_HANDLE* h, ENGINE_HANDLE_V1* h1) {
[](const item_info&) { return true; });
check(!doc.second, "non-existing document should not be found");

checkeq(ENGINE_SUCCESS, del(h, h1, key.c_str(), 0, 0),
"Failed remove with value");

doc = h1->get_if(h,
nullptr,
DocKey(key, testHarness.doc_namespace),
0,
[](const item_info&) { return true; });
check(!doc.second, "deleted document should not be found");

return SUCCESS;
}

Expand Down

0 comments on commit 1e08035

Please sign in to comment.