diff options
author | Geir Storli <geirst@oath.com> | 2017-09-11 15:12:02 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2017-09-11 15:12:02 +0000 |
commit | 67bf5f95c79f9452112931714fc1f273a19a5eb9 (patch) | |
tree | 4e54c19ab09085d9299a23a140b24da8f524cdb5 /searchlib/src/tests | |
parent | fcefafb47a56d9893834d27eb6de1759c8286193 (diff) |
Keep a document meta store read guard together with bitvector posting list in search cache for imported attributes.
This is to ensure that no lids that are cached in the bitvector are re-used until the guard is released.
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r-- | searchlib/src/tests/attribute/bitvector_search_cache/bitvector_search_cache_test.cpp | 3 | ||||
-rw-r--r-- | searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/searchlib/src/tests/attribute/bitvector_search_cache/bitvector_search_cache_test.cpp b/searchlib/src/tests/attribute/bitvector_search_cache/bitvector_search_cache_test.cpp index 1f738a209df..0072f83bc54 100644 --- a/searchlib/src/tests/attribute/bitvector_search_cache/bitvector_search_cache_test.cpp +++ b/searchlib/src/tests/attribute/bitvector_search_cache/bitvector_search_cache_test.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/searchlib/attribute/bitvector_search_cache.h> #include <vespa/searchlib/common/bitvector.h> +#include <vespa/searchlib/common/i_document_meta_store_context.h> using namespace search; using namespace search::attribute; @@ -13,7 +14,7 @@ using Entry = BitVectorSearchCache::Entry; Entry::SP makeEntry() { - return std::make_shared<Entry>(BitVector::create(5), 10); + return std::make_shared<Entry>(IDocumentMetaStoreContext::IReadGuard::UP(), BitVector::create(5), 10); } struct Fixture { diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp index f6ab6bb50bf..4ab0ed878cf 100644 --- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp +++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp @@ -370,7 +370,7 @@ makeSearchCacheEntry(const std::vector<uint32_t> docIds, uint32_t docIdLimit) for (uint32_t docId : docIds) { bitVector->setBit(docId); } - return std::make_shared<BitVectorSearchCache::Entry>(bitVector, docIdLimit); + return std::make_shared<BitVectorSearchCache::Entry>(IDocumentMetaStoreContext::IReadGuard::UP(), bitVector, docIdLimit); } TEST_F("Bit vector from search cache is used if found", SearchCacheFixture) @@ -382,6 +382,7 @@ TEST_F("Bit vector from search cache is used if found", SearchCacheFixture) TermFieldMatchData match; auto iter = f.create_strict_iterator(*ctx, match); TEST_DO(f.assertSearch({2, 6}, *iter)); // Note: would be {3, 5} if cache was not used + EXPECT_EQUAL(0u, f.document_meta_store->get_read_guard_cnt); } void @@ -405,6 +406,7 @@ TEST_F("Entry is inserted into search cache if bit vector posting list is used", auto cacheEntry = f.imported_attr->getSearchCache()->find("5678"); EXPECT_EQUAL(cacheEntry->docIdLimit, f.imported_attr->getNumDocs()); TEST_DO(assertBitVector({3, 5}, *cacheEntry->bitVector)); + EXPECT_EQUAL(1u, f.document_meta_store->get_read_guard_cnt); } } |