diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-20 15:04:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 15:04:26 +0200 |
commit | b52b470664185e67347b63ee010dedf2ebc34d1f (patch) | |
tree | 36ef4c42458fd94f6312431ffa65844aebb69212 /searchlib | |
parent | eeb88e3b57c9127c1f2d305345c325c4b02871ed (diff) | |
parent | dc1230606e52ee691fa5784ddcfba33479bdaaa5 (diff) |
Merge pull request #17504 from vespa-engine/toregge/compact-posting-store-pass-4
Wire in compaction of posting lists.
Diffstat (limited to 'searchlib')
5 files changed, 43 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h b/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h index 4876f43cd5d..3936ed381be 100644 --- a/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h +++ b/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h @@ -4,6 +4,8 @@ #include <vespa/searchcommon/attribute/iattributevector.h> +namespace search { class CompactionStrategy; } + namespace vespalib { class MemoryUsage; } namespace search::attribute { @@ -23,6 +25,8 @@ public: virtual void forwardedShrinkLidSpace(uint32_t newSize) = 0; virtual vespalib::MemoryUsage getMemoryUsage() const = 0; + virtual bool consider_compact_worst_btree_nodes(const CompactionStrategy& compaction_strategy) = 0; + virtual bool consider_compact_worst_buffers(const CompactionStrategy& compaction_strategy) = 0; }; } // namespace search::attribute diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp index a512f707c23..6646446c3a7 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp @@ -7,6 +7,7 @@ #include "multienumattributesaver.h" #include "load_utils.h" #include "enum_store_loaders.h" +#include "ipostinglistattributebase.h" #include <vespa/vespalib/stllike/hashtable.hpp> #include <vespa/vespalib/datastore/unique_store_remapper.h> @@ -187,6 +188,17 @@ MultiValueEnumAttribute<B, M>::onCommit() this->incGeneration(); this->updateStat(true); } + auto *pab = this->getIPostingListAttributeBase(); + if (pab != nullptr) { + if (pab->consider_compact_worst_btree_nodes(this->getConfig().getCompactionStrategy())) { + this->incGeneration(); + this->updateStat(true); + } + if (pab->consider_compact_worst_buffers(this->getConfig().getCompactionStrategy())) { + this->incGeneration(); + this->updateStat(true); + } + } } template <typename B, typename M> diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp index 5b57b577926..9a431be5a02 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp @@ -180,6 +180,20 @@ PostingListAttributeBase<P>::getMemoryUsage() const return _postingList.getMemoryUsage(); } +template <typename P> +bool +PostingListAttributeBase<P>::consider_compact_worst_btree_nodes(const CompactionStrategy& compaction_strategy) +{ + return _postingList.consider_compact_worst_btree_nodes(compaction_strategy); +} + +template <typename P> +bool +PostingListAttributeBase<P>::consider_compact_worst_buffers(const CompactionStrategy& compaction_strategy) +{ + return _postingList.consider_compact_worst_buffers(compaction_strategy); +} + template <typename P, typename LoadedVector, typename LoadedValueType, typename EnumStoreType> PostingListAttributeSubBase<P, LoadedVector, LoadedValueType, EnumStoreType>:: diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h index 29c4846edd4..8cd9d1d6bbd 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h @@ -68,6 +68,8 @@ protected: void forwardedShrinkLidSpace(uint32_t newSize) override; vespalib::MemoryUsage getMemoryUsage() const override; + bool consider_compact_worst_btree_nodes(const CompactionStrategy& compaction_strategy) override; + bool consider_compact_worst_buffers(const CompactionStrategy& compaction_strategy) override; public: const PostingList & getPostingList() const { return _postingList; } diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index b72f2d16b15..39a12cb57d5 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -106,6 +106,17 @@ SingleValueEnumAttribute<B>::onCommit() this->incGeneration(); this->updateStat(true); } + auto *pab = this->getIPostingListAttributeBase(); + if (pab != nullptr) { + if (pab->consider_compact_worst_btree_nodes(this->getConfig().getCompactionStrategy())) { + this->incGeneration(); + this->updateStat(true); + } + if (pab->consider_compact_worst_buffers(this->getConfig().getCompactionStrategy())) { + this->incGeneration(); + this->updateStat(true); + } + } } template <typename B> |