From 58ef78213b8c087eb4398c126586c97ab611f2f4 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Fri, 6 Apr 2018 11:31:57 +0000 Subject: Use active lids bitvector for whitelisting. This replaces nested small numeric attribute vector for blaclisting. --- .../documentmetastore/documentmetastore_test.cpp | 22 ++-- .../src/tests/proton/matching/query_test.cpp | 8 +- .../proton/documentmetastore/documentmetastore.cpp | 13 +-- .../proton/documentmetastore/documentmetastore.h | 12 +-- .../documentmetastore/documentmetastorecontext.cpp | 3 +- .../documentmetastore/documentmetastorecontext.h | 1 - .../proton/documentmetastore/i_bucket_handler.h | 2 +- .../documentmetastore/i_document_meta_store.h | 2 - .../proton/documentmetastore/lid_allocator.cpp | 111 ++++++--------------- .../proton/documentmetastore/lid_allocator.h | 28 +----- .../proton/documentmetastore/lidstatevector.h | 2 + .../searchcore/proton/matching/match_tools.cpp | 2 +- .../vespa/searchcore/proton/matching/matcher.cpp | 4 +- .../src/vespa/searchcore/proton/matching/query.cpp | 18 ++-- .../src/vespa/searchcore/proton/matching/query.h | 8 +- .../proton/test/document_meta_store_observer.h | 7 +- .../vespa/searchlib/common/idocumentmetastore.h | 6 +- 17 files changed, 80 insertions(+), 169 deletions(-) diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 9bcc63ad8d6..0a2f4973ce2 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -187,25 +187,25 @@ assertMetaData(const DocumentMetaData &exp, const DocumentMetaData &act) } bool -assertActiveLids(const BoolVector &exp, const SingleValueBitNumericAttribute &act) +assertActiveLids(const BoolVector &exp, const search::BitVector &act) { // lid 0 is reserved - if (!EXPECT_EQUAL(exp.size() + 1, act.getNumDocs())) return false; + if (!EXPECT_EQUAL(exp.size() + 1, act.size())) return false; for (size_t i = 0; i < exp.size(); ++i) { - if (!EXPECT_EQUAL((exp[i] ? 1 : 0), act.getInt(i + 1))) return false; + if (!EXPECT_EQUAL(exp[i], act.testBit(i + 1))) return false; } return true; } bool -assertBlackList(const SimpleResult &exp, Blueprint::UP blackListBlueprint, bool strict, uint32_t docIdLimit) +assertWhiteList(const SimpleResult &exp, Blueprint::UP whiteListBlueprint, bool strict, uint32_t docIdLimit) { MatchDataLayout mdl; MatchData::UP md = mdl.createMatchData(); - blackListBlueprint->fetchPostings(strict); - blackListBlueprint->setDocIdLimit(docIdLimit); + whiteListBlueprint->fetchPostings(strict); + whiteListBlueprint->setDocIdLimit(docIdLimit); - SearchIterator::UP sb = blackListBlueprint->createSearch(*md, strict); + SearchIterator::UP sb = whiteListBlueprint->createSearch(*md, strict); SimpleResult act; act.searchStrict(*sb, docIdLimit); return EXPECT_EQUAL(exp, act); @@ -986,7 +986,7 @@ TEST("requireThatBucketStateCanBeUpdated") { UserDocFixture f; f.dms.constructFreeList(); - EXPECT_EQUAL(1u, f.dms.getActiveLids().getNumDocs()); // lid 0 is reserved + EXPECT_EQUAL(1u, f.dms.getActiveLids().size()); // lid 0 is reserved f.addGlobalIds(); EXPECT_TRUE(assertActiveLids(BoolVector().F().F().F().F().F().F().F(), f.dms.getActiveLids())); @@ -1052,18 +1052,18 @@ TEST("requireThatRemovedLidsAreClearedAsActive") EXPECT_EQUAL(2u, f.dms.getNumActiveLids()); } -TEST("requireThatBlackListBlueprintIsCreated") +TEST("require that whitelist blueprint is created") { UserDocFixture f; f.dms.constructFreeList(); f.addGlobalIds(); f.dms.setBucketState(f.bid1, true); - EXPECT_TRUE(assertBlackList(SimpleResult().addHit(3).addHit(6).addHit(7), f.dms.createBlackListBlueprint(), + EXPECT_TRUE(assertWhiteList(SimpleResult().addHit(1).addHit(2).addHit(4).addHit(5), f.dms.createWhiteListBlueprint(), true, f.dms.getCommittedDocIdLimit())); f.dms.setBucketState(f.bid2, true); - EXPECT_TRUE(assertBlackList(SimpleResult(), f.dms.createBlackListBlueprint(), + EXPECT_TRUE(assertWhiteList(SimpleResult().addHit(1).addHit(2).addHit(3).addHit(4).addHit(5).addHit(6).addHit(7), f.dms.createWhiteListBlueprint(), true, f.dms.getCommittedDocIdLimit())); } diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index 9fc7b2e8662..eb49603f71d 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -100,7 +100,7 @@ class Test : public vespalib::TestApp { void requireThatNoDocsGiveZeroDocFrequency(); void requireThatWeakAndBlueprintsAreCreatedCorrectly(); void requireThatParallelWandBlueprintsAreCreatedCorrectly(); - void requireThatBlackListBlueprintCanBeUsed(); + void requireThatWhiteListBlueprintCanBeUsed(); public: ~Test(); @@ -825,7 +825,7 @@ void Test::requireThatParallelWandBlueprintsAreCreatedCorrectly() { } void -Test::requireThatBlackListBlueprintCanBeUsed() +Test::requireThatWhiteListBlueprintCanBeUsed() { QueryBuilder builder; builder.addStringTerm("foo", field, field_id, string_weight); @@ -839,7 +839,7 @@ Test::requireThatBlackListBlueprintCanBeUsed() .addResult(field, "foo", FakeResult().doc(1).doc(3).doc(5).doc(7).doc(9).doc(11)); context.setLimit(42); - query.setBlackListBlueprint(SimpleBlueprint::UP(new SimpleBlueprint(SimpleResult().addHit(3).addHit(9)))); + query.setWhiteListBlueprint(SimpleBlueprint::UP(new SimpleBlueprint(SimpleResult().addHit(1).addHit(2).addHit(4).addHit(5).addHit(6).addHit(7).addHit(8).addHit(10).addHit(11).addHit(12)))); FakeRequestContext requestContext; MatchDataLayout mdl; @@ -886,7 +886,7 @@ Test::Main() TEST_CALL(requireThatNoDocsGiveZeroDocFrequency); TEST_CALL(requireThatWeakAndBlueprintsAreCreatedCorrectly); TEST_CALL(requireThatParallelWandBlueprintsAreCreatedCorrectly); - TEST_CALL(requireThatBlackListBlueprintCanBeUsed); + TEST_CALL(requireThatWhiteListBlueprintCanBeUsed); TEST_DONE(); } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index 0ac634d05df..e257936e1ff 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -165,7 +165,7 @@ DocumentMetaStore::ensureSpace(DocId lid) setNumDocs(_metaDataStore.size()); unsigned int newSize = _metaDataStore.size(); unsigned int newCapacity = _metaDataStore.capacity(); - _lidAlloc.ensureSpace(lid, newSize, newCapacity); + _lidAlloc.ensureSpace(newSize, newCapacity); } bool @@ -190,7 +190,6 @@ DocumentMetaStore::insert(DocId lid, const RawDocumentMetaData &metaData) metaData.getDocSize(), _subDbType); _lidAlloc.updateActiveLids(lid, state.isActive()); - _lidAlloc.commitActiveLids(); updateCommittedDocIdLimit(); return true; } @@ -446,8 +445,7 @@ DocumentMetaStore::DocumentMetaStore(BucketDBOwner::SP bucketDB, _gidToLidMap(), _lidAlloc(_metaDataStore.size(), _metaDataStore.capacity(), - getGenerationHolder(), - grow), + getGenerationHolder()), _gidCompare(gidCompare), _bucketDB(bucketDB), _shrinkLidSpaceBlockers(0), @@ -778,9 +776,9 @@ DocumentMetaStore::getLidUsageStats() const } Blueprint::UP -DocumentMetaStore::createBlackListBlueprint() const +DocumentMetaStore::createWhiteListBlueprint() const { - return _lidAlloc.createBlackListBlueprint(); + return _lidAlloc.createWhiteListBlueprint(); } AttributeVector::SearchContext::UP @@ -964,7 +962,6 @@ DocumentMetaStore::updateActiveLids(const BucketId &bucketId, bool active) } _lidAlloc.updateActiveLids(lid, active); } - _lidAlloc.commitActiveLids(); } void @@ -978,7 +975,6 @@ DocumentMetaStore::populateActiveBuckets(const BucketId::List &buckets) for (const auto &bucketId : fixupBuckets) { updateActiveLids(bucketId, true); } - _lidAlloc.commitActiveLids(); } void @@ -993,7 +989,6 @@ void DocumentMetaStore::compactLidSpace(uint32_t wantedLidLimit) { AttributeVector::compactLidSpace(wantedLidLimit); - _lidAlloc.compactLidSpace(wantedLidLimit); ++_shrinkLidSpaceBlockers; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 180fb438808..33594117715 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -67,9 +67,6 @@ private: search::btree::BTreeNoLeafData, search::btree::NoAggregated, const KeyComp &> TreeType; - // Bit attribute vector used to keep track of active & inactive documents. - // Inactive documents will be black-listed during search. - typedef search::SingleValueBitNumericAttribute BitAttribute; MetaDataStore _metaDataStore; TreeType _gidToLidMap; @@ -209,7 +206,7 @@ public: DocId getNumUsedLids() const override { return _lidAlloc.getNumUsedLids(); } DocId getNumActiveLids() const override { return _lidAlloc.getNumActiveLids(); } search::LidUsageStats getLidUsageStats() const override; - search::queryeval::Blueprint::UP createBlackListBlueprint() const override; + search::queryeval::Blueprint::UP createWhiteListBlueprint() const override; /** * Implements search::AttributeVector @@ -231,10 +228,6 @@ public: void getLids(const BucketId &bucketId, std::vector &lids) override; - search::AttributeGuard getActiveLidsGuard() const override { - return _lidAlloc.getActiveLidsGuard(); - } - bool getFreeListActive() const override { return _lidAlloc.isFreeListConstructed(); } @@ -266,7 +259,8 @@ public: return AttributeVector::getGenerationHandler(); } - const BitAttribute &getActiveLids() const { return _lidAlloc.getActiveLids(); } + const search::GrowableBitVector &getActiveLids() const { return _lidAlloc.getActiveLids(); } + void clearDocs(DocId lidLow, DocId lidLimit) override; /* diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp index ebb0b03854a..b6486607821 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp @@ -6,8 +6,7 @@ namespace proton { DocumentMetaStoreContext::ReadGuard::ReadGuard(const search::AttributeVector::SP &metaStoreAttr) : _guard(metaStoreAttr), - _store(static_cast(*_guard)), - _activeLidsGuard(_store.getActiveLidsGuard()) + _store(static_cast(*_guard)) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index 04f3982c07c..bf1f12dc26b 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -19,7 +19,6 @@ public: private: search::AttributeGuard _guard; const DocumentMetaStore &_store; - search::AttributeGuard _activeLidsGuard; public: ReadGuard(const search::AttributeVector::SP &metaStoreAttr); const search::IDocumentMetaStore &get() const override { return _store; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h index 4849ad1bf96..1a0b3c61c47 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h @@ -51,7 +51,7 @@ struct IBucketHandler /** * Sets the bucket state to active / inactive. - * Documents that are inactive will be black-listed during search. + * Documents that are inactive will not be white-listed during search. **/ virtual void setBucketState(const BucketId &bucketId, bool active) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store.h index 1299b9fb759..eb1305baf38 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store.h @@ -59,8 +59,6 @@ struct IDocumentMetaStore : public search::IDocumentMetaStore, virtual void getLids(const BucketId &bucketId, std::vector &lids) = 0; - virtual search::AttributeGuard getActiveLidsGuard() const = 0; - /* * Called by document db executor to hold unblocking of shrinking of lid * space after all outstanding holdLid() operations at the time of diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index 6667db02173..1d812731f47 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -2,17 +2,12 @@ #include "lid_allocator.h" #include -#include -#include +#include #include #include LOG_SETUP(".proton.documentmetastore.lid_allocator"); -using search::AttributeVector; -using search::GrowStrategy; -using search::QueryTermSimple; -using search::attribute::SearchContextParams; using search::fef::TermFieldMatchDataArray; using search::queryeval::Blueprint; using search::queryeval::FieldSpecBaseList; @@ -24,27 +19,13 @@ namespace proton::documentmetastore { LidAllocator::LidAllocator(uint32_t size, uint32_t capacity, - GenerationHolder &genHolder, - const GrowStrategy & grow) + GenerationHolder &genHolder) : _holdLids(), - _freeLids(size, - capacity, - genHolder, - true, - false), - _usedLids(size, - capacity, - genHolder, - false, - true), - _pendingHoldLids(size, - capacity, - genHolder, - false, - false), + _freeLids(size, capacity, genHolder, true, false), + _usedLids(size, capacity, genHolder, false, true), + _pendingHoldLids(size, capacity, genHolder, false, false), _lidFreeListConstructed(false), - _activeLidsAttr(new BitAttribute("[activelids]", grow)), - _activeLids(static_cast(*_activeLidsAttr)), + _activeLids(size, capacity, genHolder, false, false), _numActiveLids(0u) { @@ -81,18 +62,7 @@ LidAllocator::ensureSpace(uint32_t newSize, _freeLids.resizeVector(newSize, newCapacity); _usedLids.resizeVector(newSize, newCapacity); _pendingHoldLids.resizeVector(newSize, newCapacity); -} - -void -LidAllocator::ensureSpace(DocId lid, - uint32_t newSize, - uint32_t newCapacity) -{ - ensureSpace(newSize, newCapacity); - if (lid >= _activeLids.getNumDocs()) { - _activeLids.addDocs((lid - _activeLids.getNumDocs()) + 1); - } - _activeLids.commit(); + _activeLids.resizeVector(newSize, newCapacity); } void @@ -103,11 +73,10 @@ LidAllocator::unregisterLid(DocId lid) _pendingHoldLids.setBit(lid); } _usedLids.clearBit(lid); - if (_activeLids.get(lid) != 0) { - --_numActiveLids; + if (_activeLids.testBit(lid)) { + _activeLids.clearBit(lid); + _numActiveLids = _activeLids.count(); } - _activeLids.update(lid, 0); - _activeLids.commit(); } size_t @@ -144,9 +113,10 @@ LidAllocator::moveLidEnd(DocId fromLid, DocId toLid) } _usedLids.setBit(toLid); _usedLids.clearBit(fromLid); - _activeLids.update(toLid, _activeLids.get(fromLid)); - _activeLids.update(fromLid, 0); - _activeLids.commit(); + if (_activeLids.testBit(fromLid)) { + _activeLids.setBit(toLid); + _activeLids.clearBit(fromLid); + } } void @@ -221,10 +191,10 @@ LidAllocator::constructFreeList(DocId lidLimit) namespace { -class BlackListBlueprint : public SimpleLeafBlueprint +class WhiteListBlueprint : public SimpleLeafBlueprint { private: - AttributeVector::SearchContext::UP _searchCtx; + const search::GrowableBitVector &_activeLids; mutable std::mutex _lock; mutable std::vector _matchDataVector; @@ -240,25 +210,20 @@ private: std::lock_guard lock(_lock); _matchDataVector.push_back(tfmd); } - return _searchCtx->createIterator(tfmd, strict); - } - - virtual void - fetchPostings(bool strict) override - { - _searchCtx->fetchPostings(strict); + uint32_t docIdLimit = _activeLids.size(); + return search::BitVectorIterator::create(&_activeLids, docIdLimit, *tfmd, strict); } public: - BlackListBlueprint(AttributeVector::SearchContext::UP searchCtx) + WhiteListBlueprint(const search::GrowableBitVector &activeLids) : SimpleLeafBlueprint(FieldSpecBaseList()), - _searchCtx(std::move(searchCtx)), + _activeLids(activeLids), _matchDataVector() { setEstimate(HitEstimate(0, false)); } - ~BlackListBlueprint() { + ~WhiteListBlueprint() { for (auto matchData : _matchDataVector) { delete matchData; } @@ -268,34 +233,23 @@ public: } Blueprint::UP -LidAllocator::createBlackListBlueprint() const +LidAllocator::createWhiteListBlueprint() const { - QueryTermSimple::UP term(new QueryTermSimple("0", QueryTermSimple::WORD)); - return Blueprint::UP( - new BlackListBlueprint(_activeLids.getSearch(std::move(term), SearchContextParams()))); + return std::make_unique(_activeLids.getBitVector()); } void LidAllocator::updateActiveLids(DocId lid, bool active) { - int8_t oldActiveFlag = _activeLids.get(lid); - int8_t newActiveFlag = (active ? 1 : 0); - if (oldActiveFlag != newActiveFlag) { - if (oldActiveFlag != 0) { - if (newActiveFlag == 0) { - --_numActiveLids; - } + bool oldActive = _activeLids.testBit(lid); + if (oldActive != active) { + if (active) { + _activeLids.setBit(lid); } else { - ++_numActiveLids; + _activeLids.clearBit(lid); } + _numActiveLids = _activeLids.count(); } - _activeLids.update(lid, newActiveFlag); -} - -void -LidAllocator::commitActiveLids() -{ - _activeLids.commit(); } void @@ -306,16 +260,9 @@ LidAllocator::clearDocs(DocId lidLow, DocId lidLimit) assert(_usedLids.getNextTrueBit(lidLow) >= lidLimit); } -void -LidAllocator::compactLidSpace(uint32_t wantedLidLimit) -{ - _activeLids.compactLidSpace(wantedLidLimit); -} - void LidAllocator::shrinkLidSpace(DocId committedDocIdLimit) { - _activeLids.shrinkLidSpace(); ensureSpace(committedDocIdLimit, committedDocIdLimit); } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h index 9d02195961c..d876b6c5502 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h @@ -7,12 +7,6 @@ #include #include -namespace search { -class AttributeVector; -class SingleValueBitNumericAttribute; -class GrowStrategy; -} - namespace proton::documentmetastore { /** @@ -22,34 +16,27 @@ namespace proton::documentmetastore { class LidAllocator { private: - typedef search::SingleValueBitNumericAttribute BitAttribute; typedef uint32_t DocId; typedef vespalib::GenerationHandler::generation_t generation_t; - using AttributeVectorSP = std::shared_ptr; LidHoldList _holdLids; LidStateVector _freeLids; LidStateVector _usedLids; LidStateVector _pendingHoldLids; bool _lidFreeListConstructed; - AttributeVectorSP _activeLidsAttr; - BitAttribute &_activeLids; + LidStateVector _activeLids; uint32_t _numActiveLids; public: LidAllocator(uint32_t size, uint32_t capacity, - vespalib::GenerationHolder &genHolder, - const search::GrowStrategy & grow); + vespalib::GenerationHolder &genHolder); ~LidAllocator(); DocId getFreeLid(DocId lidLimit); DocId peekFreeLid(DocId lidLimit); void ensureSpace(uint32_t newSize, uint32_t newCapacity); - void ensureSpace(DocId lid, - uint32_t newSize, - uint32_t newCapacity); void registerLid(DocId lid) { _usedLids.setBit(lid); } void unregisterLid(DocId lid); size_t getUsedLidsSize() const; @@ -61,11 +48,9 @@ public: generation_t currentGeneration); bool holdLidOK(DocId lid, DocId lidLimit) const; void constructFreeList(DocId lidLimit); - search::queryeval::Blueprint::UP createBlackListBlueprint() const; + search::queryeval::Blueprint::UP createWhiteListBlueprint() const; void updateActiveLids(DocId lid, bool active); - void commitActiveLids(); void clearDocs(DocId lidLow, DocId lidLimit); - void compactLidSpace(DocId wantedLidLimit); void shrinkLidSpace(DocId committedDocIdLimit); uint32_t getNumUsedLids() const; uint32_t getNumActiveLids() const { @@ -89,13 +74,8 @@ public: DocId getHighestUsedLid() const { return _usedLids.getHighest(); } - search::AttributeGuard getActiveLidsGuard() const { - return search::AttributeGuard(_activeLidsAttr); - } - const BitAttribute &getActiveLids() const { - return _activeLids; - } + const search::GrowableBitVector &getActiveLids() const { return _activeLids.getBitVector(); } }; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h index c346a10a3fe..0a5242323e6 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h @@ -100,6 +100,8 @@ public: { return _bv.getNextTrueBit(idx); } + + const search::GrowableBitVector &getBitVector() const { return _bv; } }; } diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index 9044cb79220..805c4a94c3b 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -148,7 +148,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter, if (_valid) { _query.extractTerms(_queryEnv.terms()); _query.extractLocations(_queryEnv.locations()); - _query.setBlackListBlueprint(metaStore.createBlackListBlueprint()); + _query.setWhiteListBlueprint(metaStore.createWhiteListBlueprint()); _query.reserveHandles(_requestContext, searchContext, _mdl); _query.optimize(); _query.fetchPostings(); diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 8cab32912a3..3fbf937cd1b 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -36,7 +36,7 @@ namespace proton::matching { namespace { -// used to give out empty blacklist blueprints +// used to give out empty whitelist blueprints struct StupidMetaStore : search::IDocumentMetaStore { bool getGid(DocId, GlobalId &) const override { return false; } bool getGidEvenIfMoved(DocId, GlobalId &) const override { return false; } @@ -48,7 +48,7 @@ struct StupidMetaStore : search::IDocumentMetaStore { DocId getNumActiveLids() const override { return 0; } uint64_t getCurrentGeneration() const override { return 0; } LidUsageStats getLidUsageStats() const override { return LidUsageStats(); } - Blueprint::UP createBlackListBlueprint() const override { return Blueprint::UP(); } + Blueprint::UP createWhiteListBlueprint() const override { return Blueprint::UP(); } }; FeatureSet::SP findFeatureSet(const DocsumRequest &req, diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 33118016d92..9181205bb19 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -26,7 +26,7 @@ using search::fef::Location; using search::query::Node; using search::query::QueryTreeCreator; using search::query::Weight; -using search::queryeval::AndNotBlueprint; +using search::queryeval::AndBlueprint; using search::queryeval::Blueprint; using search::queryeval::IRequestContext; using search::queryeval::SearchIterator; @@ -112,9 +112,9 @@ Query::extractLocations(vector &locations) } void -Query::setBlackListBlueprint(Blueprint::UP blackListBlueprint) +Query::setWhiteListBlueprint(Blueprint::UP whiteListBlueprint) { - _blackListBlueprint = std::move(blackListBlueprint); + _whiteListBlueprint = std::move(whiteListBlueprint); } void @@ -125,14 +125,14 @@ Query::reserveHandles(const IRequestContext & requestContext, ISearchContext &co _blueprint = BlueprintBuilder::build(requestContext, *_query_tree, context); LOG(debug, "original blueprint:\n%s\n", _blueprint->asString().c_str()); - if (_blackListBlueprint.get() != NULL) { - std::unique_ptr andNotBlueprint(new AndNotBlueprint()); - (*andNotBlueprint) + if (_whiteListBlueprint) { + std::unique_ptr andBlueprint(new AndBlueprint()); + (*andBlueprint) .addChild(std::move(_blueprint)) - .addChild(std::move(_blackListBlueprint)); - _blueprint = std::move(andNotBlueprint); + .addChild(std::move(_whiteListBlueprint)); + _blueprint = std::move(andBlueprint); _blueprint->setDocIdLimit(context.getDocIdLimit()); - LOG(debug, "blueprint after black listing:\n%s\n", _blueprint->asString().c_str()); + LOG(debug, "blueprint after white listing:\n%s\n", _blueprint->asString().c_str()); } } diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index 5c770e08353..0b769d558c5 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -22,7 +22,7 @@ private: search::query::Node::UP _query_tree; Blueprint::UP _blueprint; search::fef::Location _location; - Blueprint::UP _blackListBlueprint; + Blueprint::UP _whiteListBlueprint; public: Query(); @@ -54,14 +54,14 @@ public: void extractLocations(std::vector &locs); /** - * Use the given blueprint as black list node in the blueprint tree. + * Use the given blueprint as white list node in the blueprint tree. * The search iterator created by this blueprint should return all * invisible / inactive documents as hits. These hits will then not be * part of the result set for the query executed. * - * @param blackListBlueprint the blueprint used for black listing. + * @param whiteListBlueprint the blueprint used for white listing. **/ - void setBlackListBlueprint(Blueprint::UP blackListBlueprint); + void setWhiteListBlueprint(Blueprint::UP whiteListBlueprint); /** * Reserve room for terms in the query in the given match data diff --git a/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h b/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h index b5db143b819..e0faf372454 100644 --- a/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h +++ b/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h @@ -46,8 +46,8 @@ struct DocumentMetaStoreObserver : public IDocumentMetaStore virtual search::LidUsageStats getLidUsageStats() const override { return _store.getLidUsageStats(); } - virtual search::queryeval::Blueprint::UP createBlackListBlueprint() const override { - return _store.createBlackListBlueprint(); + virtual search::queryeval::Blueprint::UP createWhiteListBlueprint() const override { + return _store.createWhiteListBlueprint(); } uint64_t getCurrentGeneration() const override { return _store.getCurrentGeneration(); @@ -155,9 +155,6 @@ struct DocumentMetaStoreObserver : public IDocumentMetaStore virtual DocId getNumActiveLids() const override { return _store.getNumActiveLids(); } - virtual search::AttributeGuard getActiveLidsGuard() const override { - return _store.getActiveLidsGuard(); - } virtual bool getFreeListActive() const override { return _store.getFreeListActive(); } diff --git a/searchlib/src/vespa/searchlib/common/idocumentmetastore.h b/searchlib/src/vespa/searchlib/common/idocumentmetastore.h index 2187c3f96a7..6fc8b9f43b5 100644 --- a/searchlib/src/vespa/searchlib/common/idocumentmetastore.h +++ b/searchlib/src/vespa/searchlib/common/idocumentmetastore.h @@ -143,10 +143,10 @@ struct IDocumentMetaStore { virtual LidUsageStats getLidUsageStats() const = 0; /** - * Creates a black list blueprint that returns a search iterator - * that gives hits for all documents that should not be visible. + * Creates a white list blueprint that returns a search iterator + * that gives hits for all documents that should be visible. **/ - virtual std::unique_ptr createBlackListBlueprint() const = 0; + virtual std::unique_ptr createWhiteListBlueprint() const = 0; /** * Give read access to the current generation of the metastore. -- cgit v1.2.3