MB-19204: ep_testsuite: Don't release the item while we're using it 09/62909/3
authorTrond Norbye <trond.norbye@gmail.com>
Wed, 5 Nov 2014 19:24:03 +0000 (20:24 +0100)
committerChiyoung Seo <chiyoung@couchbase.com>
Sat, 23 Apr 2016 00:47:21 +0000 (00:47 +0000)
Fixes a number of issues detected by ThreadSanitizer.

Change-Id: I6ab6c9fee2497d0843af47647f33bcce73111f76
Reviewed-on: http://review.couchbase.org/62909
Well-Formed: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Will Gardner <will.gardner@couchbase.com>
tests/ep_testsuite.cc

index c5dfd15..d4c4548 100644 (file)
@@ -1069,12 +1069,12 @@ static enum test_result test_append_prepend_to_json(ENGINE_HANDLE *h,
 
     check(h1->get(h, NULL, &i, key1, strlen(key1), 0) == ENGINE_SUCCESS,
             "Unable to get stored item");
-    h1->release(h, NULL, i);
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 1, "Expected JSON");
     check(info.datatype == PROTOCOL_BINARY_DATATYPE_JSON, "Invalid datatype");
+    h1->release(h, NULL, i);
 
     check(storeCasVb11(h, h1, NULL, OPERATION_APPEND, key1,
                        value2, strlen(value2), 82758, &i, 0, 0)
@@ -1086,11 +1086,11 @@ static enum test_result test_append_prepend_to_json(ENGINE_HANDLE *h,
             "Unable to get stored item");
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
-    h1->release(h, NULL, i);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 0, "Expected Binary");
     check(info.datatype == PROTOCOL_BINARY_RAW_BYTES,
                 "Invalid datatype after append");
+    h1->release(h, NULL, i);
 
     // PREPEND
     check(storeCasVb11(h, h1, NULL, OPERATION_SET, key2,
@@ -1103,10 +1103,10 @@ static enum test_result test_append_prepend_to_json(ENGINE_HANDLE *h,
             "Unable to get stored item");
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
-    h1->release(h, NULL, i);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 1, "Expected JSON");
     check(info.datatype == PROTOCOL_BINARY_DATATYPE_JSON, "Invalid datatype");
+    h1->release(h, NULL, i);
 
     check(storeCasVb11(h, h1, NULL, OPERATION_PREPEND, key2,
                        value2, strlen(value2), 82758, &i, 0, 0)
@@ -1116,13 +1116,13 @@ static enum test_result test_append_prepend_to_json(ENGINE_HANDLE *h,
 
     check(h1->get(h, NULL, &i, key2, strlen(key2), 0) == ENGINE_SUCCESS,
             "Unable to get stored item");
-    h1->release(h, NULL, i);
     info.nvalue = 1;
     h1->get_item_info(h, NULL, i, &info);
     check(checkUTF8JSON((const unsigned char*)info.value[0].iov_base,
                         (int)info.value[0].iov_len) == 0, "Expected Binary");
     check(info.datatype == PROTOCOL_BINARY_RAW_BYTES,
                 "Invalid datatype after prepend");
+    h1->release(h, NULL, i);
 
     return SUCCESS;
 }