aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2023-11-07 15:11:56 +0000
committerGeir Storli <geirst@yahooinc.com>2023-11-07 15:11:56 +0000
commit57b17fdce27b79ef8b3e48fc45171042a94a1924 (patch)
treee0e383d7df1edbd0a6af74d4bdf226e148fff654
parent08dacb85e24dbd059122c082c48607ab30d46d42 (diff)
Also tune or turn off background jobs when content node is in maintenance.
Previously the following has been adjusted when the node is retired: 1) Lid space compaction - turned off. 2) Flush engine strategy - tuned to reduce disk and CPU usage. 3) Attribute vector compaction - tuned to reduce memory allocations and CPU usage. In a node retirement scenario documents are being removed from the node, and eventually the node is deleted. Without the adjustments above a lot of resources are spent "fixing" the results of removing documents, and the process just takes a lot longer. A similar set of challenges can occur when a node is set in maintenance, especially if the node transitions from retired to maintenance. E.g. this happens when the Vespa version is upgraded in Vespa Cloud. With this change the resource usage of background jobs are kept in check for both a retired node and a node in maintenance.
-rw-r--r--searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp44
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp15
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp8
-rw-r--r--searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h1
16 files changed, 91 insertions, 50 deletions
diff --git a/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp b/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp
index ad38b7220c5..539ee9ce3aa 100644
--- a/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp
@@ -30,8 +30,14 @@ BucketId bucket1(1);
BucketId bucket2(2);
BucketId bucket3(3);
Distribution distribution(Distribution::getDefaultDistributionConfig(3, 3));
-storage::lib::ClusterState rawClusterState("version:1 storage:3 distributor:3");
-ClusterState clusterState(rawClusterState, 0, distribution);
+
+ClusterState make_cluster_state(const vespalib::string& state, uint16_t node_index, bool maintenance_in_all_spaces = false) {
+ return ClusterState(storage::lib::ClusterState(state), node_index, distribution, maintenance_in_all_spaces);
+}
+
+ClusterState basic_state = make_cluster_state("distributor:3 storage:3", 0);
+ClusterState node_retired_state = make_cluster_state("distributor:3 .1.s:d storage:3 .1.s:r", 1);
+ClusterState node_maintenance_state = make_cluster_state("distributor:3 storage:3", 1, true);
struct ClusterStateHandlerTest : testing::Test {
vespalib::ThreadStackExecutor _exec;
@@ -51,18 +57,44 @@ struct ClusterStateHandlerTest : testing::Test {
~ClusterStateHandlerTest() {
_stateHandler.removeClusterStateChangedHandler(&_changedHandler);
}
+ const IBucketStateCalculator& set_cluster_state(const ClusterState& state) {
+ _stateHandler.handleSetClusterState(state, _genericHandler);
+ _exec.sync();
+ EXPECT_TRUE(_changedHandler._calc);
+ return *_changedHandler._calc;
+ }
};
TEST_F(ClusterStateHandlerTest, cluster_state_change_is_notified)
{
- _stateHandler.handleSetClusterState(clusterState, _genericHandler);
- _exec.sync();
- EXPECT_TRUE(_changedHandler._calc);
+ const auto& calc = set_cluster_state(basic_state);
+ EXPECT_TRUE(calc.clusterUp());
+ EXPECT_TRUE(calc.nodeUp());
+ EXPECT_FALSE(calc.nodeInitializing());
+ EXPECT_FALSE(calc.nodeRetired());
+ EXPECT_FALSE(calc.nodeMaintenance());
+ EXPECT_FALSE(calc.node_retired_or_maintenance());
+}
+
+TEST_F(ClusterStateHandlerTest, node_in_retired_state)
+{
+ const auto &calc = set_cluster_state(node_retired_state);
+ EXPECT_TRUE(calc.nodeRetired());
+ EXPECT_FALSE(calc.nodeMaintenance());
+ EXPECT_TRUE(calc.node_retired_or_maintenance());
+}
+
+TEST_F(ClusterStateHandlerTest, node_in_maintenance_state)
+{
+ const auto &calc = set_cluster_state(node_maintenance_state);
+ EXPECT_FALSE(calc.nodeRetired());
+ EXPECT_TRUE(calc.nodeMaintenance());
+ EXPECT_TRUE(calc.node_retired_or_maintenance());
}
TEST_F(ClusterStateHandlerTest, modified_buckets_are_returned)
{
- _stateHandler.handleSetClusterState(clusterState, _genericHandler);
+ _stateHandler.handleSetClusterState(basic_state, _genericHandler);
_exec.sync();
// notify 2 buckets
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index b5096a4c046..596ebb933a4 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -620,30 +620,35 @@ TEST_F("require that attribute manager can be reconfigured", SearchableFixture)
requireThatAttributeManagerCanBeReconfigured(f);
}
-TEST_F("require that subdb reflect retirement", FastAccessFixture)
+TEST_F("require that subdb reflect retirement or maintenance", FastAccessFixture)
{
CompactionStrategy cfg(0.1, 0.3);
- EXPECT_FALSE(f._subDb.isNodeRetired());
+ EXPECT_FALSE(f._subDb.is_node_retired_or_maintenance());
auto unretired_cfg = f._subDb.computeCompactionStrategy(cfg);
EXPECT_TRUE(cfg == unretired_cfg);
auto calc = std::make_shared<proton::test::BucketStateCalculator>();
calc->setNodeRetired(true);
f.setBucketStateCalculator(calc);
- EXPECT_TRUE(f._subDb.isNodeRetired());
+ EXPECT_TRUE(f._subDb.is_node_retired_or_maintenance());
auto retired_cfg = f._subDb.computeCompactionStrategy(cfg);
EXPECT_TRUE(cfg != retired_cfg);
EXPECT_TRUE(CompactionStrategy(0.5, 0.5) == retired_cfg);
calc->setNodeRetired(false);
+ calc->setNodeMaintenance(true);
f.setBucketStateCalculator(calc);
- EXPECT_FALSE(f._subDb.isNodeRetired());
+ EXPECT_TRUE(f._subDb.is_node_retired_or_maintenance());
+
+ calc->setNodeMaintenance(false);
+ f.setBucketStateCalculator(calc);
+ EXPECT_FALSE(f._subDb.is_node_retired_or_maintenance());
unretired_cfg = f._subDb.computeCompactionStrategy(cfg);
EXPECT_TRUE(cfg == unretired_cfg);
}
-TEST_F("require that attribute compaction config reflect retirement", FastAccessFixture) {
+TEST_F("require that attribute compaction config reflect retirement or maintenance", FastAccessFixture) {
CompactionStrategy default_cfg(0.05, 0.2);
CompactionStrategy retired_cfg(0.5, 0.5);
diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
index d4d2a6dc377..eea523870c3 100644
--- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
+++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
@@ -44,7 +44,7 @@ JobTestBase::init(uint32_t allowedLidBloat,
double allowedLidBloatFactor,
double resourceLimitFactor,
vespalib::duration interval,
- bool nodeRetired,
+ bool node_retired_or_maintenance,
uint32_t maxOutstandingMoveOps)
{
_handler = std::make_shared<MyHandler>(maxOutstandingMoveOps != MAX_OUTSTANDING_MOVE_OPS, true);
@@ -57,7 +57,7 @@ JobTestBase::init(uint32_t allowedLidBloat,
_master = std::make_unique<proton::SyncableExecutorThreadService> (*_singleExecutor);
_bucketExecutor = std::make_unique<storage::spi::dummy::DummyBucketExecutor>(4);
_job = lidspace::CompactionJob::create(compactCfg, RetainGuard(_refCount), _handler, _storer, *_master, *_bucketExecutor,
- _diskMemUsageNotifier, blockableCfg, _clusterStateHandler, nodeRetired,
+ _diskMemUsageNotifier, blockableCfg, _clusterStateHandler, node_retired_or_maintenance,
document::BucketSpace::placeHolder());
}
@@ -180,10 +180,10 @@ JobTest::init(uint32_t allowedLidBloat,
double allowedLidBloatFactor,
double resourceLimitFactor,
vespalib::duration interval,
- bool nodeRetired,
+ bool node_retired_or_maintenance,
uint32_t maxOutstandingMoveOps)
{
- JobTestBase::init(allowedLidBloat, allowedLidBloatFactor, resourceLimitFactor, interval, nodeRetired, maxOutstandingMoveOps);
+ JobTestBase::init(allowedLidBloat, allowedLidBloatFactor, resourceLimitFactor, interval, node_retired_or_maintenance, maxOutstandingMoveOps);
_jobRunner = std::make_unique<MyDirectJobRunner>(*_job);
}
diff --git a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
index ec135800fde..79b4b4a3627 100644
--- a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
+++ b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
@@ -69,8 +69,8 @@ struct Fixture
void notifyDiskMemUsage(const ResourceUsageState &diskState, const ResourceUsageState &memoryState) {
updater.notifyDiskMemUsage(DiskMemUsageState(diskState, memoryState));
}
- void setNodeRetired(bool nodeRetired) {
- updater.setNodeRetired(nodeRetired);
+ void set_node_retired_or_maintenance(bool value) {
+ updater.set_node_retired_or_maintenance(value);
}
};
@@ -226,12 +226,12 @@ TEST_F("require that we must go below low watermark for memory usage before usin
TEST_DO(f.assertStrategyConfig(4, 1, 20));
}
-TEST_F("require that more disk bloat is allowed while node state is retired", Fixture)
+TEST_F("require that more disk bloat is allowed while node state is retired or maintenance", Fixture)
{
constexpr double DEFAULT_DISK_BLOAT = 0.25;
f.notifyDiskMemUsage(ResourceUsageState(0.7, 0.3), belowLimit());
TEST_DO(f.assertStrategyDiskConfig(DEFAULT_DISK_BLOAT, DEFAULT_DISK_BLOAT));
- f.setNodeRetired(true);
+ f.set_node_retired_or_maintenance(true);
TEST_DO(f.assertStrategyDiskConfig((0.8 - ((0.3/0.7)*(1 - DEFAULT_DISK_BLOAT))) / 0.8, 1.0));
f.notifyDiskMemUsage(belowLimit(), belowLimit());
TEST_DO(f.assertStrategyDiskConfig(DEFAULT_DISK_BLOAT, DEFAULT_DISK_BLOAT));
diff --git a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
index 0870d854234..34a57badd29 100644
--- a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
@@ -47,6 +47,7 @@ public:
bool nodeInitializing() const override { return _nodeInitializing; }
bool nodeRetired() const override { return _nodeRetired; }
bool nodeMaintenance() const noexcept override { return _nodeMaintenance; }
+ bool node_retired_or_maintenance() const noexcept override { return _nodeRetired || _nodeMaintenance; }
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
index 43bdc764a2f..a2d68ad8920 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
@@ -272,7 +272,7 @@ FastAccessDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const
reconfigureAttributeMetrics(*newMgr, *oldMgr);
}
_iFeedView.set(_fastAccessFeedView.get());
- if (isNodeRetired()) {
+ if (is_node_retired_or_maintenance()) {
// TODO Should probably ahve a similar OnDone callback to applyConfig too.
vespalib::Gate gate;
reconfigureAttributesConsideringNodeState(std::make_shared<vespalib::GateCallback>(gate));
diff --git a/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
index a2790979212..90277089034 100644
--- a/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
+++ b/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
@@ -16,6 +16,7 @@ struct IBucketStateCalculator
virtual bool nodeInitializing() const = 0;
virtual bool nodeRetired() const = 0;
virtual bool nodeMaintenance() const noexcept = 0;
+ virtual bool node_retired_or_maintenance() const noexcept = 0;
virtual ~IBucketStateCalculator() = default;
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
index de583c0b36d..cedc24502fd 100644
--- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
@@ -130,7 +130,7 @@ CompactionJob::CompactionJob(const DocumentDBLidSpaceCompactionConfig &config,
IDiskMemUsageNotifier &diskMemUsageNotifier,
const BlockableMaintenanceJobConfig &blockableConfig,
IClusterStateChangedNotifier &clusterStateChangedNotifier,
- bool nodeRetired,
+ bool node_retired_or_maintenance,
document::BucketSpace bucketSpace)
: BlockableMaintenanceJob("lid_space_compaction." + handler->getName(),
config.getDelay(), config.getInterval(), blockableConfig),
@@ -154,7 +154,7 @@ CompactionJob::CompactionJob(const DocumentDBLidSpaceCompactionConfig &config,
{
_diskMemUsageNotifier.addDiskMemUsageListener(this);
_clusterStateChangedNotifier.addClusterStateChangedHandler(this);
- if (nodeRetired) {
+ if (node_retired_or_maintenance) {
setBlocked(BlockedReason::CLUSTER_STATE);
}
_handler->set_operation_listener(_ops_rate_tracker);
@@ -175,12 +175,12 @@ CompactionJob::create(const DocumentDBLidSpaceCompactionConfig &config,
IDiskMemUsageNotifier &diskMemUsageNotifier,
const BlockableMaintenanceJobConfig &blockableConfig,
IClusterStateChangedNotifier &clusterStateChangedNotifier,
- bool nodeRetired,
+ bool node_retired_or_maintenance,
document::BucketSpace bucketSpace)
{
return std::shared_ptr<CompactionJob>(
new CompactionJob(config, std::move(dbRetainer), std::move(handler), opStorer, master, bucketExecutor,
- diskMemUsageNotifier, blockableConfig, clusterStateChangedNotifier, nodeRetired, bucketSpace),
+ diskMemUsageNotifier, blockableConfig, clusterStateChangedNotifier, node_retired_or_maintenance, bucketSpace),
[&master](auto job) {
auto failed = master.execute(makeLambdaTask([job]() { delete job; }));
assert(!failed);
@@ -303,16 +303,16 @@ void
CompactionJob::notifyClusterStateChanged(const std::shared_ptr<IBucketStateCalculator> &newCalc)
{
// Called by master write thread
- bool nodeRetired = newCalc->nodeRetired();
- if (!nodeRetired) {
+ bool node_retired_or_maintenance = newCalc->node_retired_or_maintenance();
+ if (!node_retired_or_maintenance) {
if (isBlocked(BlockedReason::CLUSTER_STATE)) {
- LOG(info, "%s: Lid space compaction is un-blocked as node is no longer retired", _handler->getName().c_str());
+ LOG(info, "%s: Lid space compaction is un-blocked as node is no longer retired or in maintenance", _handler->getName().c_str());
unBlock(BlockedReason::CLUSTER_STATE);
}
} else if (!isBlocked(BlockedReason::CLUSTER_STATE)) {
- LOG(info, "%s: Lid space compaction is blocked as node is retired", _handler->getName().c_str());
+ LOG(info, "%s: Lid space compaction is blocked as node is retired or in maintenance", _handler->getName().c_str());
setBlocked(BlockedReason::CLUSTER_STATE);
}
}
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp
index 3c66a695323..b9a0abb3c3d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp
@@ -37,7 +37,7 @@ injectLidSpaceCompactionJobs(MaintenanceController &controller,
auto job = lidspace::CompactionJob::create(config.getLidSpaceCompactionConfig(), controller.retainDB(),
std::move(lidHandler), opStorer, controller.masterThread(),
bucketExecutor, diskMemUsageNotifier,config.getBlockableJobConfig(),
- clusterStateChangedNotifier, calc && calc->nodeRetired(), bucketSpace);
+ clusterStateChangedNotifier, calc && calc->node_retired_or_maintenance(), bucketSpace);
controller.registerJob(trackJob(tracker, std::move(job)));
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
index f941209ed1e..b2f40f1c37d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
@@ -34,7 +34,7 @@ MemoryFlushConfigUpdater::considerUseConservativeDiskMode(const LockGuard &guard
_useConservativeDiskMode = true;
} else {
_useConservativeDiskMode = false;
- if (_nodeRetired) {
+ if (_node_retired_or_maintenance) {
considerUseRelaxedDiskMode(guard, newConfig);
}
}
@@ -81,9 +81,9 @@ MemoryFlushConfigUpdater::updateFlushStrategy(const LockGuard &guard, const char
MemoryFlush::Config currentConfig = _flushStrategy->getConfig();
if ( currentConfig != newConfig ) {
_flushStrategy->setConfig(newConfig);
- LOG(info, "Due to %s (conservative-disk=%d, conservative-memory=%d, retired=%d) flush config updated to "
+ LOG(info, "Due to %s (conservative-disk=%d, conservative-memory=%d, retired-or-maintenance=%d) flush config updated to "
"global-disk-bloat(%1.2f), max-tls-size(%" PRIu64 "),max-global-memory(%" PRIu64 "), max-memory-gain(%" PRIu64 ")",
- why, _useConservativeDiskMode, _useConservativeMemoryMode, _nodeRetired,
+ why, _useConservativeDiskMode, _useConservativeMemoryMode, _node_retired_or_maintenance,
newConfig.globalDiskBloatFactor, newConfig.maxGlobalTlsSize,
newConfig.maxGlobalMemory, newConfig.maxMemoryGain);
LOG(debug, "Old config = %s\nNew config = %s", currentConfig.toString().c_str(), newConfig.toString().c_str());
@@ -100,7 +100,7 @@ MemoryFlushConfigUpdater::MemoryFlushConfigUpdater(const MemoryFlush::SP &flushS
_currState(),
_useConservativeDiskMode(false),
_useConservativeMemoryMode(false),
- _nodeRetired(false)
+ _node_retired_or_maintenance(false)
{
}
@@ -121,11 +121,11 @@ MemoryFlushConfigUpdater::notifyDiskMemUsage(DiskMemUsageState newState)
}
void
-MemoryFlushConfigUpdater::setNodeRetired(bool nodeRetired)
+MemoryFlushConfigUpdater::set_node_retired_or_maintenance(bool value)
{
LockGuard guard(_mutex);
- _nodeRetired = nodeRetired;
- updateFlushStrategy(guard, nodeRetired ? "node retired" : "node unretired");
+ _node_retired_or_maintenance = value;
+ updateFlushStrategy(guard, value ? "node retired or in maintenance" : "node NOT retired or in maintenance");
}
namespace {
diff --git a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.h b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.h
index f97b232f13f..7508c2fb90a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.h
+++ b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.h
@@ -28,7 +28,7 @@ private:
DiskMemUsageState _currState;
bool _useConservativeDiskMode;
bool _useConservativeMemoryMode;
- bool _nodeRetired;
+ bool _node_retired_or_maintenance;
void considerUseConservativeDiskMode(const LockGuard &guard, MemoryFlush::Config &newConfig);
@@ -43,7 +43,7 @@ public:
const ProtonConfig::Flush::Memory &config,
const vespalib::HwInfo::Memory &memory);
void setConfig(const ProtonConfig::Flush::Memory &newConfig);
- void setNodeRetired(bool nodeRetired);
+ void set_node_retired_or_maintenance(bool value);
void notifyDiskMemUsage(DiskMemUsageState newState) override;
static MemoryFlush::Config convertConfig(const ProtonConfig::Flush::Memory &config,
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 2fb4d05c8b3..0839117f6ef 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -925,12 +925,13 @@ Proton::setClusterState(BucketSpace bucketSpace, const storage::spi::ClusterStat
// about whether node is supposed to be up or not. Match engine
// needs to know this in order to stop serving queries.
bool nodeUpInBucketSpace(calc.nodeUp()); // TODO rename calculator function to imply bucket space affinity
- bool nodeRetired(calc.nodeRetired());
+ bool nodeRetired = calc.nodeRetired();
+ bool nodeMaintenance = calc.nodeMaintenance();
bool nodeUp = updateNodeUp(bucketSpace, nodeUpInBucketSpace);
_matchEngine->setNodeUp(nodeUp);
- _matchEngine->setNodeMaintenance(calc.nodeMaintenance()); // Note: _all_ bucket spaces in maintenance
+ _matchEngine->setNodeMaintenance(nodeMaintenance); // Note: _all_ bucket spaces in maintenance
if (_memoryFlushConfigUpdater) {
- _memoryFlushConfigUpdater->setNodeRetired(nodeRetired);
+ _memoryFlushConfigUpdater->set_node_retired_or_maintenance(nodeRetired || nodeMaintenance);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index 8d25a09b93c..ed9dfbfe578 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -183,7 +183,7 @@ SearchableDocSubDB::applyFlushConfig(const DocumentDBFlushConfig &flushConfig)
void
SearchableDocSubDB::propagateFlushConfig()
{
- uint32_t maxFlushed = isNodeRetired() ? _flushConfig.getMaxFlushedRetired() : _flushConfig.getMaxFlushed();
+ uint32_t maxFlushed = is_node_retired_or_maintenance() ? _flushConfig.getMaxFlushedRetired() : _flushConfig.getMaxFlushed();
_indexMgr->setMaxFlushed(maxFlushed);
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index 5aa0d926e45..0c217eeeeba 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -113,7 +113,7 @@ StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx)
_dmsFlushTarget(),
_dmsShrinkTarget(),
_pendingLidsForCommit(std::make_shared<PendingLidTracker>()),
- _nodeRetired(false),
+ _node_retired_or_maintenance(false),
_lastConfiguredCompactionStrategy(),
_subDbId(cfg._subDbId),
_subDbType(cfg._subDbType),
@@ -472,7 +472,7 @@ struct UpdateConfig : public search::attribute::IAttributeFunctor {
CompactionStrategy
StoreOnlyDocSubDB::computeCompactionStrategy(CompactionStrategy strategy) const {
- return isNodeRetired()
+ return is_node_retired_or_maintenance()
? CompactionStrategy(RETIRED_DEAD_RATIO, RETIRED_DEAD_RATIO)
: strategy;
}
@@ -493,9 +493,9 @@ StoreOnlyDocSubDB::reconfigure(const search::LogDocumentStore::Config & config,
void
StoreOnlyDocSubDB::setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> & calc, OnDone onDone) {
- bool wasNodeRetired = isNodeRetired();
- _nodeRetired = calc->nodeRetired();
- if (wasNodeRetired != isNodeRetired()) {
+ bool was_node_retired_or_maintenance = is_node_retired_or_maintenance();
+ _node_retired_or_maintenance = calc->node_retired_or_maintenance();
+ if (was_node_retired_or_maintenance != is_node_retired_or_maintenance()) {
CompactionStrategy compactionStrategy = computeCompactionStrategy(_lastConfiguredCompactionStrategy);
auto cfg = _dms->getConfig();
cfg.setCompactionStrategy(compactionStrategy);
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 2d8d517c4d5..d530e44755c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -152,7 +152,7 @@ private:
DocumentMetaStoreFlushTarget::SP _dmsFlushTarget;
std::shared_ptr<ShrinkLidSpaceFlushTarget> _dmsShrinkTarget;
std::shared_ptr<PendingLidTrackerBase> _pendingLidsForCommit;
- bool _nodeRetired;
+ bool _node_retired_or_maintenance;
vespalib::datastore::CompactionStrategy _lastConfiguredCompactionStrategy;
IFlushTargetList getFlushTargets() override;
@@ -239,7 +239,7 @@ public:
void tearDownReferences(IDocumentDBReferenceResolver &resolver) override;
PendingLidTrackerBase & getUncommittedLidsTracker() override { return *_pendingLidsForCommit; }
vespalib::datastore::CompactionStrategy computeCompactionStrategy(vespalib::datastore::CompactionStrategy strategy) const;
- bool isNodeRetired() const { return _nodeRetired; }
+ bool is_node_retired_or_maintenance() const { return _node_retired_or_maintenance; }
TransientResourceUsage get_transient_resource_usage() const override;
};
diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
index 4dc91883bba..f321b70f028 100644
--- a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
+++ b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
@@ -83,6 +83,7 @@ public:
bool nodeRetired() const override { return _nodeRetired; }
bool nodeInitializing() const override { return false; }
bool nodeMaintenance() const noexcept override { return _nodeMaintenance; }
+ bool node_retired_or_maintenance() const noexcept override { return _nodeRetired || _nodeMaintenance; }
};
}