Skip to content

Commit 9ffebb3

Browse files
committed
MB-54516: Construct VB::Manifest using KVStore derived history value
In the KVStore driven constructor, the meta.canDeduplicate value is the correct value to use. Change-Id: Id7fe3f7bf79be2fb2116951f14c9aa0e0adca52a Reviewed-on: https://review.couchbase.org/c/kv_engine/+/184800 Well-Formed: Restriction Checker Tested-by: Jim Walker <[email protected]> Reviewed-by: Paolo Cocchi <[email protected]>
1 parent 55a4de0 commit 9ffebb3

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

engines/ep/src/collections/vbucket_manifest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Manifest::Manifest(std::shared_ptr<Manager> manager,
5656
addNewCollectionEntry({meta.sid, meta.cid},
5757
meta.name,
5858
meta.maxTtl,
59-
bucketManifest->getCanDeduplicate(meta.cid),
59+
meta.canDeduplicate,
6060
e.startSeqno);
6161
}
6262
}

engines/ep/tests/module_tests/collections/collections_kvstore_test.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,19 @@ TEST(CollectionsKVStoreTest, test_KVStore_comparison) {
300300
m2.scopes.push_back(
301301
OpenScope{0, Collections::ScopeMetaData{ScopeID{91}, "s91"}});
302302
EXPECT_NE(m1, m2);
303+
304+
m1 = m2;
305+
EXPECT_EQ(m1, m2);
306+
// Add a collection but check a different history state is noticed
307+
auto c1 = Collections::CollectionMetaData{ScopeID{88},
308+
CollectionID{102},
309+
"c1",
310+
{},
311+
CanDeduplicate::Yes};
312+
m1.collections.push_back(OpenCollection{0, c1});
313+
c1.canDeduplicate = CanDeduplicate::No;
314+
m2.collections.push_back(OpenCollection{0, c1});
315+
EXPECT_NE(m1, m2);
303316
}
304317

305318
TEST_P(CollectionsKVStoreTest, initial_meta) {
@@ -407,6 +420,13 @@ TEST_P(CollectionsKVStoreTest, create_and_modify_same_batch) {
407420
applyAndCheck(cm);
408421
}
409422

423+
// Check that the history state persists and comes back
424+
TEST_P(CollectionsKVStoreTest, one_update_with_history) {
425+
CollectionsManifest cm;
426+
cm.add(CollectionEntry::vegetable, {}, true);
427+
applyAndCheck(cm);
428+
}
429+
410430
// Related to MB-44098 test that we fail to generate 'corrupt' collection or
411431
// scope metadata (i.e duplicate entries). This is not the sequence of steps
412432
// that lead to warmup failure seen in the MB, but tests that we can detect

0 commit comments

Comments
 (0)