MB-24221: Don't fetch deleted values as part of get_if 46/77746/3
authorSriram Ganesan <sriram@couchbase.com>
Thu, 4 May 2017 23:22:13 +0000 (16:22 -0700)
committerDave Rigby <daver@couchbase.com>
Mon, 8 May 2017 09:17:30 +0000 (09:17 +0000)
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>
src/ep_engine.cc
tests/ep_testsuite_basic.cc

index fc54487..97c2c15 100644 (file)
@@ -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);
         }
index 7c0fc3f..93f74b6 100644 (file)
@@ -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;
 }