Skip to content

Commit c0c1db1

Browse files
daverigbytrondn
authored andcommitted
kvstore_test: Set delete item to deleted
In KVStoreParamTest/TestPersistenceCallbacksForDel; the item which was deleted was incorrectly not set to deleted. This is incorrect; the deleted flag should be true for any item which is a delete. Change-Id: Ibd63743de79f8f84a808638d0594e2614bef98af Reviewed-on: http://review.couchbase.org/93763 Tested-by: Build Bot <[email protected]> Reviewed-by: Trond Norbye <[email protected]>
1 parent acc67a3 commit c0c1db1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

engines/ep/src/rocksdb-kvstore/rocksdb-kvstore.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,10 @@ void RocksDBKVStore::reset(uint16_t vbucketId) {
638638

639639
void RocksDBKVStore::del(const Item& item,
640640
Callback<TransactionContext, int>& cb) {
641+
if (!item.isDeleted()) {
642+
throw std::invalid_argument(
643+
"RocksDBKVStore::del item to delete is not marked as deleted.");
644+
}
641645
if (!in_transaction) {
642646
throw std::logic_error(
643647
"RocksDBKVStore::del: in_transaction must be true to perform a "

engines/ep/tests/module_tests/kvstore_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ TEST_P(KVStoreParamTest, TestPersistenceCallbacksForDel) {
19431943
int delCount = 1;
19441944
EXPECT_CALL(mpc, callback(_, delCount)).Times(0);
19451945

1946+
item.setDeleted();
19461947
kvstore->del(item, mpc);
19471948

19481949
// Expect that the DEL callback will be called once after `commit`

0 commit comments

Comments
 (0)