diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-23 14:42:33 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-23 14:42:33 +0000 |
commit | e616307a9e1c50582cecaaf58f9c4997491e3ae9 (patch) | |
tree | 4933e7370e62cbd4b1d3917e4f750cd4905f6857 /searchcore | |
parent | 9609b36966918ed7e8a58a3b169dd061b15880eb (diff) |
Warn about bad config, and cap searchable copies at redundancy
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp b/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp index 2f915846331..f4dc21bba43 100644 --- a/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/alloc_config.cpp @@ -4,6 +4,9 @@ #include "subdbtype.h" #include <algorithm> +#include <vespa/log/log.h> +LOG_SETUP(".searchcore.proton.common.alloc_config"); + using search::GrowStrategy; using vespalib::datastore::CompactionStrategy; @@ -13,8 +16,13 @@ AllocConfig::AllocConfig(const AllocStrategy& alloc_strategy, uint32_t redundancy, uint32_t searchable_copies) : _alloc_strategy(alloc_strategy), _redundancy(redundancy), - _searchable_copies(searchable_copies) + _searchable_copies(std::min(searchable_copies, redundancy)) { + if (searchable_copies > redundancy) { + LOG(error, "searchablecopies(%d) larger than redundancy(%d)." + "Internal configuration issue that must be fixed. Capped for now", + searchable_copies, redundancy); + } } AllocConfig::~AllocConfig() = default; @@ -45,7 +53,7 @@ AllocConfig::make_alloc_strategy(SubDbType sub_db_type) const break; } 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()); + return {grow_strategy, _alloc_strategy.get_compaction_strategy(), _alloc_strategy.get_amortize_count()}; } } |