diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-26 13:19:04 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-26 13:23:23 +0000 |
commit | 9b7fbd40636763509335a93df7d9611441b1ceaf (patch) | |
tree | 33aeaa67e495ee42ae29ccbabb72d1e3b604b655 /searchcore | |
parent | fd13f73b5ef66dcc81f60a6319be4f01b5e1d68e (diff) |
Inherit from vespalib::GrowStrategy
Diffstat (limited to 'searchcore')
4 files changed, 11 insertions, 12 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec_factory.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec_factory.cpp index da1b733ca0a..663491e9c64 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec_factory.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec_factory.cpp @@ -2,15 +2,14 @@ #include "attribute_collection_spec_factory.h" #include <vespa/searchlib/attribute/configconverter.h> +#include <vespa/searchcommon/attribute/config.h> using search::attribute::ConfigConverter; using search::GrowStrategy; namespace proton { -AttributeCollectionSpecFactory::AttributeCollectionSpecFactory( - const AllocStrategy &alloc_strategy, - bool fastAccessOnly) +AttributeCollectionSpecFactory::AttributeCollectionSpecFactory(const AllocStrategy &alloc_strategy, bool fastAccessOnly) : _alloc_strategy(alloc_strategy), _fastAccessOnly(fastAccessOnly) { @@ -18,7 +17,7 @@ AttributeCollectionSpecFactory::AttributeCollectionSpecFactory( AttributeCollectionSpecFactory::~AttributeCollectionSpecFactory() = default; -AttributeCollectionSpec::UP +std::unique_ptr<AttributeCollectionSpec> AttributeCollectionSpecFactory::create(const AttributesConfig &attrCfg, uint32_t docIdLimit, search::SerialNum serialNum) const @@ -27,18 +26,18 @@ AttributeCollectionSpecFactory::create(const AttributesConfig &attrCfg, // Amortize memory spike cost over N docs const size_t skew = _alloc_strategy.get_amortize_count()/(attrCfg.attribute.size()+1); GrowStrategy grow = _alloc_strategy.get_grow_strategy(); - grow.setDocsInitialCapacity(std::max(grow.getDocsInitialCapacity(),docIdLimit)); + grow.setInitialCapacity(std::max(grow.getInitialCapacity(), size_t(docIdLimit))); for (const auto &attr : attrCfg.attribute) { search::attribute::Config cfg = ConfigConverter::convert(attr); if (_fastAccessOnly && !cfg.fastAccess()) { continue; } - grow.setDocsGrowDelta(grow.getDocsGrowDelta() + skew); + grow.setGrowDelta(grow.getGrowDelta() + skew); cfg.setGrowStrategy(grow); cfg.setCompactionStrategy(_alloc_strategy.get_compaction_strategy()); attrs.push_back(AttributeSpec(attr.name, cfg)); } - return std::make_unique<AttributeCollectionSpec>(attrs, docIdLimit, serialNum); + return std::make_unique<AttributeCollectionSpec>(std::move(attrs), docIdLimit, serialNum); } } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp b/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp index 8525b0ea779..1c8eae81949 100644 --- a/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp @@ -31,7 +31,7 @@ AllocStrategy AllocConfig::make_alloc_strategy(SubDbType sub_db_type) const { auto &baseline = _alloc_strategy.get_grow_strategy(); - size_t initial_capacity = baseline.getDocsInitialCapacity(); + size_t initial_capacity = baseline.getInitialCapacity(); switch (sub_db_type) { case SubDbType::READY: initial_capacity *= _searchable_copies; @@ -44,7 +44,7 @@ AllocConfig::make_alloc_strategy(SubDbType sub_db_type) const initial_capacity = std::max(1024ul, initial_capacity / 100); break; } - GrowStrategy grow_strategy(initial_capacity, baseline.getDocsGrowFactor(), baseline.getDocsGrowDelta(), initial_capacity, baseline.getMultiValueAllocGrowFactor()); + GrowStrategy grow_strategy(initial_capacity, baseline.getGrowFactor(), baseline.getGrowDelta(), initial_capacity, baseline.getMultiValueAllocGrowFactor()); return AllocStrategy(grow_strategy, _alloc_strategy.get_compaction_strategy(), _alloc_strategy.get_amortize_count()); } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index dafb0affc0f..c0d291ca695 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -416,7 +416,7 @@ DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, const GrowStrategy &grow, SubDbType subDbType) : DocumentMetaStoreAttribute(name), - _metaDataStore(grow.to_generic_strategy(), getGenerationHolder()), + _metaDataStore(grow, getGenerationHolder()), _gidToLidMap(), _gid_to_lid_map_write_itr(vespalib::datastore::EntryRef(), _gidToLidMap.getAllocator()), _gid_to_lid_map_write_itr_prepare_serial_num(0u), diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index 9f8afa0ad19..c3f9bba24e6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -253,7 +253,7 @@ createDocumentMetaStoreInitializer(const AllocStrategy& alloc_strategy, { GrowStrategy grow = alloc_strategy.get_grow_strategy(); // Amortize memory spike cost over N docs - grow.setDocsGrowDelta(grow.getDocsGrowDelta() + alloc_strategy.get_amortize_count()); + grow.setGrowDelta(grow.getGrowDelta() + alloc_strategy.get_amortize_count()); vespalib::string baseDir(_baseDir + "/documentmetastore"); vespalib::string name = DocumentMetaStore::getFixedName(); vespalib::string attrFileName = baseDir + "/" + name; // XXX: Wrong @@ -457,7 +457,7 @@ StoreOnlyDocSubDB::reconfigure(const search::LogDocumentStore::Config & config, auto cfg = _dms->getConfig(); GrowStrategy grow = alloc_strategy.get_grow_strategy(); // Amortize memory spike cost over N docs - grow.setDocsGrowDelta(grow.getDocsGrowDelta() + alloc_strategy.get_amortize_count()); + grow.setGrowDelta(grow.getGrowDelta() + alloc_strategy.get_amortize_count()); cfg.setGrowStrategy(grow); cfg.setCompactionStrategy(computeCompactionStrategy(alloc_strategy.get_compaction_strategy())); _dms->update_config(cfg); // Update grow and compaction config |