diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-16 19:18:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-16 19:18:58 +0100 |
commit | 3917386600113b4411c9bd2de0856dd9e041c29e (patch) | |
tree | 2404e2c24d5a9e33ec32d99ffcd452623affd004 | |
parent | ec2b37c76e0c2e752610b57fad622f064bf831e6 (diff) | |
parent | 9a538ab59ec796398b677e2f20ce6a14e699bfe4 (diff) |
Merge pull request #30301 from vespa-engine/toregge/extend-predicate-index-unit-test
Extend predicate index unit test to cover case where the copies of
-rw-r--r-- | searchlib/src/tests/predicate/predicate_index_test.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/searchlib/src/tests/predicate/predicate_index_test.cpp b/searchlib/src/tests/predicate/predicate_index_test.cpp index 31098feddbc..461fa46d4da 100644 --- a/searchlib/src/tests/predicate/predicate_index_test.cpp +++ b/searchlib/src/tests/predicate/predicate_index_test.cpp @@ -418,19 +418,41 @@ TEST("require that hold lists are attempted emptied on destruction") { // No assert on index destruction. } -TEST("require that predicate index saver protected by a generation guard observes a snapshot of the predicate index") +void verify_snapshot_property(uint32_t num_docs) { PredicateIndex index(generation_holder, dummy_provider, simple_index_config, 10); - indexFeature(index, doc_id, min_feature, {{hash, interval}}, {{hash2, bounds}}); + for (uint32_t i = 0; i < num_docs; ++i) { + indexFeature(index, doc_id + i, min_feature, {{hash, interval}}, {{hash2, bounds}}); + } auto saver1 = make_guarded_saver(index); auto buf1 = saver1.save(); - index.removeDocument(doc_id); + for (uint32_t i = 0; i < num_docs; ++i) { + index.removeDocument(doc_id + i); + } index.commit(); auto saver2 = make_guarded_saver(index); EXPECT_TRUE(equal_buffers(buf1, saver1.save())); EXPECT_FALSE(equal_buffers(buf1, saver2.save())); } +TEST("require that predicate index saver protected by a generation guard observes a snapshot of the predicate index") +{ + /* + * short array in simple index btree posting list + */ + TEST_DO(verify_snapshot_property(1)); + /* + * short array in simple index btree posting list + */ + TEST_DO(verify_snapshot_property(8)); + /* + * BTree in simple index btree posting list. + * Needs copy of frozen roots in simple index saver to observe snapshot + * of predicate index. + */ + TEST_DO(verify_snapshot_property(9)); +} + } // namespace TEST_MAIN() { TEST_RUN_ALL(); } |