diff options
author | Arnstein Ressem <aressem@gmail.com> | 2019-01-07 21:24:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 21:24:20 +0100 |
commit | 0d69f9fa258df33f00b708f1ee9af58a8f33917c (patch) | |
tree | abfc76398a10cebc8ba584c98a073a25e83eafab /searchlib | |
parent | 8191ade44977f2874d60fc6811bbb9427a60510d (diff) |
Revert "Compact lid space on source selector."
Diffstat (limited to 'searchlib')
5 files changed, 12 insertions, 52 deletions
diff --git a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp index 75a0ccf6ab9..a223b87a73f 100644 --- a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp +++ b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp @@ -41,7 +41,7 @@ private: void requireThatSelectorCanCloneAndSubtract(); void requireThatSelectorCanCloneAndSubtract(); template <typename SelectorType> - void requireThatSelectorCanSaveAndLoad(bool compactLidSpace); + void requireThatSelectorCanSaveAndLoad(); void requireThatSelectorCanSaveAndLoad(); template <typename SelectorType> void requireThatCompleteSourceRangeIsHandled(); @@ -49,7 +49,6 @@ private: template <typename SelectorType> void requireThatSourcesAreCountedCorrectly(); void requireThatSourcesAreCountedCorrectly(); - void requireThatDocIdLimitIsCorrect(); }; int @@ -65,7 +64,6 @@ Test::Main() TEST_DO(requireThatSelectorCanSaveAndLoad()); TEST_DO(requireThatCompleteSourceRangeIsHandled()); TEST_DO(requireThatSourcesAreCountedCorrectly()); - TEST_DO(requireThatDocIdLimitIsCorrect()); TEST_DONE(); } @@ -142,15 +140,12 @@ Test::requireThatSelectorCanCloneAndSubtract() template <typename SelectorType> void -Test::requireThatSelectorCanSaveAndLoad(bool compactLidSpace) +Test::requireThatSelectorCanSaveAndLoad() { SelectorType selector(default_source, base_file_name2); setSources(selector); selector.setBaseId(base_id); selector.setSource(maxDocId + 1, default_source); - if (compactLidSpace) { - selector.compactLidSpace(maxDocId - 4); - } FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str()); FastOS_FileInterface::MakeDirIfNotPresentOrExit(index_dir.c_str()); @@ -160,13 +155,9 @@ Test::requireThatSelectorCanSaveAndLoad(bool compactLidSpace) save_info->save(TuneFileAttributes(), DummyFileHeaderContext()); typename SelectorType::UP selector2(SelectorType::load(base_file_name)); - testSourceSelector(docs, arraysize(docs) - compactLidSpace, default_source, *selector2); + testSourceSelector(docs, arraysize(docs), default_source, *selector2); EXPECT_EQUAL(base_id, selector2->getBaseId()); - if (compactLidSpace) { - EXPECT_EQUAL(maxDocId - 4, selector2->getDocIdLimit()); - } else { - EXPECT_EQUAL(maxDocId + 2, selector2->getDocIdLimit()); - } + EXPECT_EQUAL(maxDocId + 2, selector2->getDocIdLimit()); FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str()); } @@ -174,8 +165,7 @@ Test::requireThatSelectorCanSaveAndLoad(bool compactLidSpace) void Test::requireThatSelectorCanSaveAndLoad() { - requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(false); - requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(true); + requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(); } template <typename SelectorType> @@ -221,21 +211,6 @@ Test::requireThatSourcesAreCountedCorrectly() requireThatSourcesAreCountedCorrectly<FixedSourceSelector>(); } -void -Test::requireThatDocIdLimitIsCorrect() -{ - FixedSourceSelector selector(default_source, base_file_name); - EXPECT_EQUAL(0u, selector.getDocIdLimit()); - selector.setSource(8, 10); - EXPECT_EQUAL(9u, selector.getDocIdLimit()); - selector.compactLidSpace(4); - EXPECT_EQUAL(4u, selector.getDocIdLimit()); - selector.setSource(6, 10); - EXPECT_EQUAL(7u, selector.getDocIdLimit()); - auto selector2 = selector.cloneAndSubtract(base_file_name2, 3); - EXPECT_EQUAL(7u, selector2->getDocIdLimit()); -} - } // namespace TEST_APPHOOK(Test); diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index 1e8dfd6658a..ab590f807bf 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -256,6 +256,12 @@ protected: EnumModifier getEnumModifier(); ValueModifier getValueModifier() { return ValueModifier(*this); } + void updateUncommittedDocIdLimit(DocId doc) { + if (_uncommittedDocIdLimit <= doc) { + _uncommittedDocIdLimit = doc + 1; + } + } + void updateCommittedDocIdLimit() { if (_uncommittedDocIdLimit != 0) { if (_uncommittedDocIdLimit > _committedDocIdLimit) { @@ -407,11 +413,6 @@ public: void setCommittedDocIdLimit(uint32_t committedDocIdLimit) { _committedDocIdLimit = committedDocIdLimit; } - void updateUncommittedDocIdLimit(DocId doc) { - if (_uncommittedDocIdLimit <= doc) { - _uncommittedDocIdLimit = doc + 1; - } - } const Status & getStatus() const { return _status; } Status & getStatus() { return _status; } diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp index 2ee35e3403f..ae2f0234e60 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp @@ -45,7 +45,6 @@ FixedSourceSelector::cloneAndSubtract(const vespalib::string & attrBaseFileName, } selector->_source.commit(); selector->setBaseId(getBaseId() + diff); - selector->_source.setCommittedDocIdLimit(_source.getCommittedDocIdLimit()); return selector; } @@ -86,14 +85,7 @@ FixedSourceSelector::setSource(uint32_t docId, queryeval::Source source) **/ reserve(docId+1); _source.update(docId, source); - _source.updateUncommittedDocIdLimit(docId + 1); _source.commit(); } -void -FixedSourceSelector::compactLidSpace(uint32_t lidLimit) -{ - _source.compactLidSpace(lidLimit + 1); -} - } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h index f92bb1e0eb2..4dbfc22c270 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h @@ -38,9 +38,8 @@ public: // Inherit doc from ISourceSelector void setSource(uint32_t docId, queryeval::Source source) final override; uint32_t getDocIdLimit() const final override { - return _source.getCommittedDocIdLimit() - 1; + return _source.getNumDocs() - 1; } - void compactLidSpace(uint32_t lidLimit) override; std::unique_ptr<IIterator> createIterator() const final override { return std::make_unique<Iterator>(*this); } diff --git a/searchlib/src/vespa/searchlib/queryeval/isourceselector.h b/searchlib/src/vespa/searchlib/queryeval/isourceselector.h index 7151a785c26..88a3cb57a8a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/isourceselector.h +++ b/searchlib/src/vespa/searchlib/queryeval/isourceselector.h @@ -73,13 +73,6 @@ public: virtual uint32_t getDocIdLimit() const = 0; /** - * Sets the lid limit in this selector. - * - * @param lidLimit the new lid limit (one above highest valid doc id). - */ - virtual void compactLidSpace(uint32_t lidLimit) = 0; - - /** * Create a new iterator over the data held by this source * selector. * |