aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2017-09-11 15:12:02 +0000
committerGeir Storli <geirst@oath.com>2017-09-11 15:12:02 +0000
commit67bf5f95c79f9452112931714fc1f273a19a5eb9 (patch)
tree4e54c19ab09085d9299a23a140b24da8f524cdb5 /searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h
parentfcefafb47a56d9893834d27eb6de1759c8286193 (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/vespa/searchlib/attribute/bitvector_search_cache.h')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h
index 73fb95e1752..a889120f8df 100644
--- a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h
+++ b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h
@@ -2,6 +2,7 @@
#pragma once
+#include <vespa/searchlib/common/i_document_meta_store_context.h>
#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/stllike/string.h>
#include <memory>
@@ -21,13 +22,17 @@ namespace attribute {
class BitVectorSearchCache {
public:
using BitVectorSP = std::shared_ptr<BitVector>;
+ using ReadGuardUP = IDocumentMetaStoreContext::IReadGuard::UP;
struct Entry {
using SP = std::shared_ptr<Entry>;
+ // We need to keep a document meta store read guard to ensure that no lids that are cached
+ // in the bit vector are re-used until the guard is released.
+ ReadGuardUP dmsReadGuard;
BitVectorSP bitVector;
uint32_t docIdLimit;
- Entry(BitVectorSP bitVector_, uint32_t docIdLimit_)
- : bitVector(std::move(bitVector_)), docIdLimit(docIdLimit_) {}
+ Entry(ReadGuardUP dmsReadGuard_, BitVectorSP bitVector_, uint32_t docIdLimit_)
+ : dmsReadGuard(std::move(dmsReadGuard_)), bitVector(std::move(bitVector_)), docIdLimit(docIdLimit_) {}
};
private: