aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-12 10:18:21 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-12 10:18:21 +0000
commit8a0fc71d26790955ef72c166fd46af00439c1272 (patch)
tree13ad297ea44b2cb85cd2b6f4d9cd61c5f315d700
parentcaeec93d81f88de278a7b324a6e023ee4449ee7b (diff)
Consider retirement on every cluster change and reconfig.
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp41
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h1
3 files changed, 32 insertions, 16 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index b4fc20d0c44..032be9e1dc8 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -575,7 +575,7 @@ AttributeManager::asyncForEachAttribute(std::shared_ptr<IConstAttributeFunctor>
{
for (const auto &attr : _attributes) {
if (attr.second.isExtra()) {
- // TODO Why skip extra ?
+ // We must skip extra attributes as they must be handled in other threads. (DocumentMetaStore)
continue;
}
AttributeVector::SP attrsp = attr.second.getAttribute();
@@ -588,6 +588,10 @@ void
AttributeManager::asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> func) const
{
for (const auto &attr : _attributes) {
+ if (attr.second.isExtra()) {
+ // We must skip extra attributes as they must be handled in other threads.(DocumentMetaStore)
+ continue;
+ }
AttributeVector::SP attrsp = attr.second.getAttribute();
_attributeFieldWriter.execute(_attributeFieldWriter.getExecutorIdFromName(attrsp->getNamePrefix()),
[attrsp, func]() { (*func)(*attrsp); });
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index 1dbda17855b..5b1b547fcfc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -113,6 +113,7 @@ StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx)
_dmsShrinkTarget(),
_pendingLidsForCommit(std::make_shared<PendingLidTracker>()),
_nodeRetired(false),
+ _lastConfiguredCompactionStrategy(),
_subDbId(cfg._subDbId),
_subDbType(cfg._subDbType),
_fileHeaderContext(ctx._fileHeaderContext, _docTypeName, _baseDir),
@@ -282,6 +283,7 @@ StoreOnlyDocSubDB::setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP
_dmsShrinkTarget = std::make_shared<ShrinkLidSpaceFlushTarget>("documentmetastore.shrink", Type::GC,
Component::ATTRIBUTE, _flushedDocumentMetaStoreSerialNum,
_dmsFlushTarget->getLastFlushTime(), dms);
+ _lastConfiguredCompactionStrategy = dms->getConfig().getCompactionStrategy();
}
DocumentSubDbInitializer::UP
@@ -415,19 +417,6 @@ StoreOnlyDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const
return IReprocessingTask::List();
}
-void
-StoreOnlyDocSubDB::reconfigure(const search::LogDocumentStore::Config & config, const AllocStrategy& alloc_strategy)
-{
- 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());
- cfg.setGrowStrategy(grow);
- cfg.setCompactionStrategy(alloc_strategy.get_compaction_strategy());
- _dms->update_config(cfg); // Update grow and compaction config
- _rSummaryMgr->reconfigure(config);
-}
-
namespace {
constexpr double RETIRED_DEAD_RATIO = 0.5;
@@ -443,15 +432,37 @@ struct UpdateConfig : public search::attribute::IAttributeFunctor {
}
};
+search::CompactionStrategy
+computeCompactionStrategy(search::CompactionStrategy strategy, bool isNodeRetired) {
+ return isNodeRetired
+ ? search::CompactionStrategy(RETIRED_DEAD_RATIO, RETIRED_DEAD_RATIO)
+ : strategy;
+}
+
+}
+
+void
+StoreOnlyDocSubDB::reconfigure(const search::LogDocumentStore::Config & config, const AllocStrategy& alloc_strategy)
+{
+ _lastConfiguredCompactionStrategy = alloc_strategy.get_compaction_strategy();
+ 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());
+ cfg.setGrowStrategy(grow);
+ cfg.setCompactionStrategy(computeCompactionStrategy(alloc_strategy.get_compaction_strategy(), isNodeRetired()));
+ _dms->update_config(cfg); // Update grow and compaction config
+ _rSummaryMgr->reconfigure(config);
}
void
StoreOnlyDocSubDB::setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> & calc)
{
+ bool wasNodeRetired = isNodeRetired();
_nodeRetired = calc->nodeRetired();
- if (isNodeRetired()) {
+ if (wasNodeRetired != isNodeRetired()) {
auto cfg = _dms->getConfig();
- cfg.setCompactionStrategy(search::CompactionStrategy(RETIRED_DEAD_RATIO, RETIRED_DEAD_RATIO));
+ cfg.setCompactionStrategy(computeCompactionStrategy(_lastConfiguredCompactionStrategy, isNodeRetired()));
_dms->update_config(cfg);
auto attrMan = getAttributeManager();
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 3dbf6dfdf07..ddb6522493f 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -153,6 +153,7 @@ private:
std::shared_ptr<ShrinkLidSpaceFlushTarget> _dmsShrinkTarget;
std::shared_ptr<PendingLidTrackerBase> _pendingLidsForCommit;
bool _nodeRetired;
+ search::CompactionStrategy _lastConfiguredCompactionStrategy;
IFlushTargetList getFlushTargets() override;
protected: