If an item is found to be expired in the hash table, then its value
needs to be set correctly. For example, in case the item contains
xattrs, the system xattrs will be retained in the value and hence
needs to be set correctly
Change-Id: I99a54ca82feb837f530b18eb3f245a9d92f12369
Reviewed-on: http://review.couchbase.org/78220
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
}
} else if (v->isExpired(startTime) && !v->isDeleted()) {
VBNotifyCtx notifyCtx;
+ ht.setValue(it, *v);
std::tie(std::ignore, std::ignore, notifyCtx) =
processExpiredItem(hbl, *v);
// we unlock ht lock here because we want to avoid potential lock
cb::xattr::Blob new_blob(value_buf);
const std::string& cas_str{"{\"cas\":\"0xdeadbeefcafefeed\"}"};
- const std::string& sync_str = to_string(blob.get(to_const_byte_buffer("_sync")));
+ const std::string& sync_str = to_string(new_blob.get(to_const_byte_buffer("_sync")));
EXPECT_EQ(cas_str, sync_str) << "Unexpected system xattrs";
+ EXPECT_TRUE(new_blob.get(to_const_byte_buffer("user")).empty()) <<
+ "The user attribute should be gone";
+ EXPECT_TRUE(new_blob.get(to_const_byte_buffer("meta")).empty()) <<
+ "The meta attribute should be gone";
kvbucket.getMetaData(makeStoredDocKey("key"), vbid, cookie, metadata,
deleted, datatype);
const std::string& meta_str = to_string(new_blob.get(to_const_byte_buffer("_meta")));
EXPECT_EQ(rev_str, meta_str) << "Unexpected system xattrs";
+ EXPECT_TRUE(new_blob.get(to_const_byte_buffer("foo")).empty()) <<
+ "The foo attribute should be gone";
}
// Test cases which run in both Full and Value eviction