aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-21 10:19:43 +0000
committerGeir Storli <geirst@oath.com>2018-02-21 16:01:15 +0000
commit63532725cd0d114fa6ec2719c9283e80ea65943d (patch)
tree3d85f267d792dbc1ef4f01ed5be01a18acb7353f /storage/src
parent59e254a7d8ea61ddfb2adde30b0aecef70913704 (diff)
Make NodeMaintenanceStatsTracker bucket space aware.
Diffstat (limited to 'storage/src')
-rw-r--r--storage/src/tests/distributor/distributortest.cpp10
-rw-r--r--storage/src/tests/distributor/maintenancemocks.h7
-rw-r--r--storage/src/tests/distributor/nodemaintenancestatstrackertest.cpp90
-rw-r--r--storage/src/tests/distributor/simplemaintenancescannertest.cpp16
-rw-r--r--storage/src/tests/distributor/statecheckerstest.cpp51
-rw-r--r--storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h57
-rw-r--r--storage/src/vespa/storage/distributor/statechecker.h1
-rw-r--r--storage/src/vespa/storage/distributor/statecheckers.cpp8
9 files changed, 155 insertions, 87 deletions
diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp
index d585c4d0d32..4d08e4adb71 100644
--- a/storage/src/tests/distributor/distributortest.cpp
+++ b/storage/src/tests/distributor/distributortest.cpp
@@ -630,18 +630,18 @@ Distributor_Test::mergeStatsAreAccumulatedDuringDatabaseIteration()
NodeMaintenanceStats wanted;
wanted.syncing = 1;
wanted.copyingOut = 2;
- CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(0, makeBucketSpace()));
}
{
NodeMaintenanceStats wanted;
wanted.movingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(1, makeBucketSpace()));
}
{
NodeMaintenanceStats wanted;
wanted.syncing = 1;
wanted.copyingIn = 2;
- CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(2));
+ CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(2, makeBucketSpace()));
}
}
@@ -666,12 +666,12 @@ Distributor_Test::statsGeneratedForPreemptedOperations()
{
NodeMaintenanceStats wanted;
wanted.syncing = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(0, makeBucketSpace()));
}
{
NodeMaintenanceStats wanted;
wanted.syncing = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, stats.perNodeStats.forNode(1, makeBucketSpace()));
}
}
diff --git a/storage/src/tests/distributor/maintenancemocks.h b/storage/src/tests/distributor/maintenancemocks.h
index 505a7cece9e..2be74ca1a8b 100644
--- a/storage/src/tests/distributor/maintenancemocks.h
+++ b/storage/src/tests/distributor/maintenancemocks.h
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+#include <vespa/document/test/make_bucket_space.h>
#include <vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h>
#include <vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h>
#include <vespa/storage/distributor/operationstarter.h>
@@ -8,6 +9,8 @@
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <sstream>
+using document::test::makeBucketSpace;
+
namespace storage {
namespace distributor {
@@ -18,8 +21,8 @@ class MockMaintenancePriorityGenerator
const document::Bucket&,
NodeMaintenanceStatsTracker& stats) const override
{
- stats.incMovingOut(1);
- stats.incCopyingIn(2);
+ stats.incMovingOut(1, makeBucketSpace());
+ stats.incCopyingIn(2, makeBucketSpace());
return MaintenancePriorityAndType(
MaintenancePriority(MaintenancePriority::VERY_HIGH),
MaintenanceOperation::MERGE_BUCKET);
diff --git a/storage/src/tests/distributor/nodemaintenancestatstrackertest.cpp b/storage/src/tests/distributor/nodemaintenancestatstrackertest.cpp
index 6da23103e0f..eee52f4d679 100644
--- a/storage/src/tests/distributor/nodemaintenancestatstrackertest.cpp
+++ b/storage/src/tests/distributor/nodemaintenancestatstrackertest.cpp
@@ -1,11 +1,14 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/document/test/make_bucket_space.h>
+#include <vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h>
#include <vespa/vdstestlib/cppunit/macros.h>
+#include <vespa/document/bucket/fixed_bucket_spaces.h>
-#include <vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h>
+namespace storage::distributor {
-namespace storage {
-namespace distributor {
+using document::test::makeBucketSpace;
+using document::BucketSpace;
class NodeMaintenanceStatsTrackerTest : public CppUnit::TestFixture
{
@@ -14,12 +17,17 @@ class NodeMaintenanceStatsTrackerTest : public CppUnit::TestFixture
CPPUNIT_TEST(statsFieldsAffectEqualityComparison);
CPPUNIT_TEST(requestingNonExistingNodeGivesEmptyStats);
CPPUNIT_TEST(statsAreTrackedPerNode);
+ CPPUNIT_TEST(statsAreTrackedPerBucketSpace);
CPPUNIT_TEST_SUITE_END();
void emptyStatsInstancesAreEqual();
void statsFieldsAffectEqualityComparison();
void requestingNonExistingNodeGivesEmptyStats();
void statsAreTrackedPerNode();
+ void statsAreTrackedPerBucketSpace();
+ void assertBucketStats(BucketSpace bucketSpace, const NodeMaintenanceStatsTracker& tracker);
+ void assertBucketStats(uint64_t expMovingOut, uint64_t expSyncing, uint64_t expCopyingIn, uint64_t expCopyingOut,
+ BucketSpace bucketSpace, const NodeMaintenanceStatsTracker& tracker);
};
CPPUNIT_TEST_SUITE_REGISTRATION(NodeMaintenanceStatsTrackerTest);
@@ -64,7 +72,7 @@ NodeMaintenanceStatsTrackerTest::requestingNonExistingNodeGivesEmptyStats()
{
NodeMaintenanceStatsTracker tracker;
NodeMaintenanceStats wanted;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0, makeBucketSpace()));
}
void
@@ -72,30 +80,78 @@ NodeMaintenanceStatsTrackerTest::statsAreTrackedPerNode()
{
NodeMaintenanceStatsTracker tracker;
NodeMaintenanceStats wanted;
+ BucketSpace space(1);
- tracker.incMovingOut(0);
+ tracker.incMovingOut(0, space);
wanted.movingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0, space));
wanted.movingOut = 0;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1, space));
- tracker.incMovingOut(0);
+ tracker.incMovingOut(0, space);
wanted.movingOut = 2;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(0, space));
- tracker.incMovingOut(1);
+ tracker.incMovingOut(1, space);
wanted.movingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1, space));
- tracker.incSyncing(1);
- tracker.incCopyingIn(1);
- tracker.incCopyingOut(1);
+ tracker.incSyncing(1, space);
+ tracker.incCopyingIn(1, space);
+ tracker.incCopyingOut(1, space);
wanted.syncing = 1;
wanted.copyingIn = 1;
wanted.copyingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, tracker.forNode(1, space));
}
-} // distributor
-} // storage
+void
+NodeMaintenanceStatsTrackerTest::statsAreTrackedPerBucketSpace()
+{
+ NodeMaintenanceStatsTracker tracker;
+ BucketSpace fooSpace(3);
+ BucketSpace barSpace(5);
+
+ tracker.incMovingOut(0, fooSpace);
+ assertBucketStats(1, 0, 0, 0, fooSpace, tracker);
+ assertBucketStats(barSpace, tracker);
+
+ tracker.incMovingOut(0, barSpace);
+ assertBucketStats(1, 0, 0, 0, fooSpace, tracker);
+ assertBucketStats(1, 0, 0, 0, barSpace, tracker);
+
+ tracker.incSyncing(0, fooSpace);
+ assertBucketStats(1, 1, 0, 0, fooSpace, tracker);
+ assertBucketStats(1, 0, 0, 0, barSpace, tracker);
+
+ tracker.incCopyingIn(0, fooSpace);
+ assertBucketStats(1, 1, 1, 0, fooSpace, tracker);
+ assertBucketStats(1, 0, 0, 0, barSpace, tracker);
+
+ tracker.incCopyingOut(0, fooSpace);
+ assertBucketStats(1, 1, 1, 1, fooSpace, tracker);
+ assertBucketStats(1, 0, 0, 0, barSpace, tracker);
+}
+
+void
+NodeMaintenanceStatsTrackerTest::assertBucketStats(BucketSpace bucketSpace,
+ const NodeMaintenanceStatsTracker& tracker)
+{
+ NodeMaintenanceStats expStats;
+ CPPUNIT_ASSERT_EQUAL(expStats, tracker.forNode(0, bucketSpace));
+}
+
+void
+NodeMaintenanceStatsTrackerTest::assertBucketStats(uint64_t expMovingOut,
+ uint64_t expSyncing,
+ uint64_t expCopyingIn,
+ uint64_t expCopyingOut,
+ BucketSpace bucketSpace,
+ const NodeMaintenanceStatsTracker& tracker)
+{
+ NodeMaintenanceStats expStats(expMovingOut, expSyncing, expCopyingIn, expCopyingOut);
+ CPPUNIT_ASSERT_EQUAL(expStats, tracker.forNode(0, bucketSpace));
+}
+
+}
diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp
index 394df6024fd..ac4a5bbfb91 100644
--- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp
+++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp
@@ -1,15 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <tests/distributor/maintenancemocks.h>
#include <vespa/document/test/make_bucket_space.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
-#include <vespa/storage/distributor/distributor_bucket_space_repo.h>
#include <vespa/storage/distributor/distributor_bucket_space.h>
-#include <vespa/storage/distributor/maintenance/simplemaintenancescanner.h>
+#include <vespa/storage/distributor/distributor_bucket_space_repo.h>
#include <vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h>
-#include <vespa/storage/bucketdb/mapbucketdatabase.h>
-#include <tests/distributor/maintenancemocks.h>
+#include <vespa/storage/distributor/maintenance/simplemaintenancescanner.h>
+#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/text/stringtokenizer.h>
-#include <algorithm>
namespace storage::distributor {
@@ -225,7 +223,7 @@ SimpleMaintenanceScannerTest::perNodeMaintenanceStatsAreTracked()
{
auto stats(_scanner->getPendingMaintenanceStats());
NodeMaintenanceStats emptyStats;
- CPPUNIT_ASSERT_EQUAL(emptyStats, stats.perNodeStats.forNode(0));
+ CPPUNIT_ASSERT_EQUAL(emptyStats, stats.perNodeStats.forNode(0, makeBucketSpace()));
}
CPPUNIT_ASSERT(scanEntireDatabase(2));
// Mock is currently hardwired to increment movingOut for node 1 and
@@ -234,12 +232,12 @@ SimpleMaintenanceScannerTest::perNodeMaintenanceStatsAreTracked()
{
NodeMaintenanceStats wantedNode1Stats;
wantedNode1Stats.movingOut = 2;
- CPPUNIT_ASSERT_EQUAL(wantedNode1Stats, stats.perNodeStats.forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wantedNode1Stats, stats.perNodeStats.forNode(1, makeBucketSpace()));
}
{
NodeMaintenanceStats wantedNode2Stats;
wantedNode2Stats.copyingIn = 2;
- CPPUNIT_ASSERT_EQUAL(wantedNode2Stats, stats.perNodeStats.forNode(2));
+ CPPUNIT_ASSERT_EQUAL(wantedNode2Stats, stats.perNodeStats.forNode(2, makeBucketSpace()));
}
}
diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp
index 306f92cdd6a..1130a8ae2d2 100644
--- a/storage/src/tests/distributor/statecheckerstest.cpp
+++ b/storage/src/tests/distributor/statecheckerstest.cpp
@@ -1,36 +1,26 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vdstestlib/cppunit/macros.h>
#include <tests/common/dummystoragelink.h>
-#include <vespa/storageapi/message/persistence.h>
-#include <vespa/storage/distributor/bucketdbupdater.h>
-#include <vespa/document/fieldvalue/document.h>
-#include <vespa/storage/common/bucketmessages.h>
-#include <vespa/storage/config/config-stor-distributormanager.h>
-#include <vespa/storage/distributor/idealstatemanager.h>
-#include <vespa/storage/distributor/operations/idealstate/mergeoperation.h>
-#include <vespa/storage/distributor/operations/idealstate/removebucketoperation.h>
-#include <vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h>
-#include <vespa/storage/distributor/operations/idealstate/splitoperation.h>
-#include <vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h>
-#include <vespa/storage/distributor/distributor_bucket_space_repo.h>
-#include <vespa/storage/distributor/distributor_bucket_space.h>
-#include <vespa/storageapi/message/stat.h>
-#include <vespa/storage/storageutil/utils.h>
#include <tests/distributor/distributortestutil.h>
-#include <vespa/storage/distributor/statecheckers.h>
-#include <vespa/storageapi/message/state.h>
#include <vespa/config-stor-distribution.h>
-#include <vespa/storage/distributor/distributor.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/document/test/make_document_bucket.h>
+#include <vespa/storage/distributor/bucketdbupdater.h>
+#include <vespa/storage/distributor/distributor.h>
+#include <vespa/storage/distributor/distributor_bucket_space.h>
+#include <vespa/storage/distributor/distributor_bucket_space_repo.h>
+#include <vespa/storage/distributor/idealstatemanager.h>
+#include <vespa/storage/distributor/operations/idealstate/mergeoperation.h>
+#include <vespa/storage/distributor/statecheckers.h>
+#include <vespa/storageapi/message/persistence.h>
+#include <vespa/storageapi/message/stat.h>
+#include <vespa/vdstestlib/cppunit/macros.h>
using namespace std::literals::string_literals;
using document::test::makeBucketSpace;
using document::test::makeDocumentBucket;
-namespace storage {
-namespace distributor {
+namespace storage::distributor {
struct StateCheckersTest : public CppUnit::TestFixture,
public DistributorTestUtil
@@ -1812,7 +1802,7 @@ StateCheckersTest::statsUpdatedWhenMergingDueToMove()
{
NodeMaintenanceStats wanted;
wanted.copyingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1, makeBucketSpace()));
}
// Moving 1 bucket from nodes {0, 2} into 3.
// Note that we do not at this point in time distinguish _which_ of these
@@ -1820,13 +1810,13 @@ StateCheckersTest::statsUpdatedWhenMergingDueToMove()
{
NodeMaintenanceStats wanted;
wanted.copyingIn = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3, makeBucketSpace()));
}
{
NodeMaintenanceStats wanted;
wanted.movingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(0));
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(2));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(0, makeBucketSpace()));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(2, makeBucketSpace()));
}
}
@@ -1842,12 +1832,12 @@ StateCheckersTest::statsUpdatedWhenMergingDueToMissingCopy()
{
NodeMaintenanceStats wanted;
wanted.copyingIn = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3, makeBucketSpace()));
}
{
NodeMaintenanceStats wanted;
wanted.copyingOut = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1, makeBucketSpace()));
}
}
@@ -1861,10 +1851,9 @@ StateCheckersTest::statsUpdatedWhenMergingDueToOutOfSyncCopies()
{
NodeMaintenanceStats wanted;
wanted.syncing = 1;
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1));
- CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(1, makeBucketSpace()));
+ CPPUNIT_ASSERT_EQUAL(wanted, runner.stats().forNode(3, makeBucketSpace()));
}
}
-} // distributor
-} // storage}
+}
diff --git a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp
index b8fd294d7dc..3a65d2d5336 100644
--- a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp
+++ b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp
@@ -5,7 +5,7 @@
namespace storage::distributor {
-const NodeMaintenanceStats NodeMaintenanceStatsTracker::_emptyStats;
+const NodeMaintenanceStats NodeMaintenanceStatsTracker::_emptyNodeMaintenanceStats;
std::ostream&
operator<<(std::ostream& os, const NodeMaintenanceStats& stats)
diff --git a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h
index b18cdcd37d9..7cf65e4a7d8 100644
--- a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h
+++ b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h
@@ -4,16 +4,25 @@
#include <unordered_map>
#include <iosfwd>
#include <stdint.h>
+#include <vespa/document/bucket/bucketspace.h>
namespace storage {
namespace distributor {
struct NodeMaintenanceStats
{
- uint64_t movingOut {0};
- uint64_t syncing {0};
- uint64_t copyingIn {0};
- uint64_t copyingOut {0};
+ uint64_t movingOut;
+ uint64_t syncing;
+ uint64_t copyingIn;
+ uint64_t copyingOut;
+
+ NodeMaintenanceStats()
+ : movingOut(0), syncing(0), copyingIn(0), copyingOut(0)
+ {}
+
+ NodeMaintenanceStats(uint64_t movingOut_, uint64_t syncing_, uint64_t copyingIn_, uint64_t copyingOut_)
+ : movingOut(movingOut_), syncing(syncing_), copyingIn(copyingIn_), copyingOut(copyingOut_)
+ {}
bool operator==(const NodeMaintenanceStats& other) const noexcept {
return (movingOut == other.movingOut
@@ -27,35 +36,47 @@ std::ostream& operator<<(std::ostream&, const NodeMaintenanceStats&);
class NodeMaintenanceStatsTracker
{
- std::unordered_map<uint16_t, NodeMaintenanceStats> _stats;
- static const NodeMaintenanceStats _emptyStats;
+public:
+ using BucketSpacesStats = std::unordered_map<document::BucketSpace, NodeMaintenanceStats, document::BucketSpace::hash>;
+
+private:
+ std::unordered_map<uint16_t, BucketSpacesStats> _stats;
+ static const NodeMaintenanceStats _emptyNodeMaintenanceStats;
+
public:
NodeMaintenanceStatsTracker();
~NodeMaintenanceStatsTracker();
- void incMovingOut(uint16_t node) {
- ++_stats[node].movingOut;
+ void incMovingOut(uint16_t node, document::BucketSpace bucketSpace) {
+ ++_stats[node][bucketSpace].movingOut;
}
- void incSyncing(uint16_t node) {
- ++_stats[node].syncing;
+ void incSyncing(uint16_t node, document::BucketSpace bucketSpace) {
+ ++_stats[node][bucketSpace].syncing;
}
- void incCopyingIn(uint16_t node) {
- ++_stats[node].copyingIn;
+ void incCopyingIn(uint16_t node, document::BucketSpace bucketSpace) {
+ ++_stats[node][bucketSpace].copyingIn;
}
- void incCopyingOut(uint16_t node) {
- ++_stats[node].copyingOut;
+ void incCopyingOut(uint16_t node, document::BucketSpace bucketSpace) {
+ ++_stats[node][bucketSpace].copyingOut;
}
/**
- * Returned statistics for a given node index, or all zero statistics
+ * Returned statistics for a given node index and bucket space, or all zero statistics
* if none have been recorded yet
*/
- const NodeMaintenanceStats& forNode(uint16_t node) const {
- auto iter = _stats.find(node);
- return (iter != _stats.end() ? iter->second : _emptyStats);
+ const NodeMaintenanceStats& forNode(uint16_t node, document::BucketSpace bucketSpace) const {
+ auto nodeItr = _stats.find(node);
+ if (nodeItr != _stats.end()) {
+ auto bucketSpaceItr = nodeItr->second.find(bucketSpace);
+ if (bucketSpaceItr != nodeItr->second.end()) {
+ return bucketSpaceItr->second;
+ }
+ }
+ return _emptyNodeMaintenanceStats;
}
+
};
} // distributor
diff --git a/storage/src/vespa/storage/distributor/statechecker.h b/storage/src/vespa/storage/distributor/statechecker.h
index e204cf5325a..9c0fe2ef53c 100644
--- a/storage/src/vespa/storage/distributor/statechecker.h
+++ b/storage/src/vespa/storage/distributor/statechecker.h
@@ -86,6 +86,7 @@ public:
document::Bucket getBucket() const { return bucket; }
document::BucketId getBucketId() const { return bucket.getBucketId(); }
+ document::BucketSpace getBucketSpace() const { return bucket.getBucketSpace(); }
std::string toString() const;
};
diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp
index 1f0cb19ef93..4d6e9d8164f 100644
--- a/storage/src/vespa/storage/distributor/statecheckers.cpp
+++ b/storage/src/vespa/storage/distributor/statecheckers.cpp
@@ -737,11 +737,11 @@ addStatisticsForNonIdealNodes(const StateChecker::Context& c,
for (uint32_t j = 0; j < c.entry->getNodeCount(); ++j) {
const uint16_t node(c.entry->getNodeRef(j).getNode());
if (!presentInIdealState(c, node)) {
- c.stats.incMovingOut(node);
+ c.stats.incMovingOut(node, c.getBucketSpace());
} else if (missingReplica) {
// Copy is in ideal location and we're missing a replica. Thus
// we treat all ideal copies as sources to copy from.
- c.stats.incCopyingOut(node);
+ c.stats.incCopyingOut(node, c.getBucketSpace());
}
}
}
@@ -773,7 +773,7 @@ checkForNodesMissingFromIdealState(StateChecker::Context& c)
ret.markMoveToIdealLocation(c.idealState[i],
mp.mergeMoveToIdealNode);
}
- c.stats.incCopyingIn(c.idealState[i]);
+ c.stats.incCopyingIn(c.idealState[i], c.getBucketSpace());
hasMissingReplica = true;
}
}
@@ -788,7 +788,7 @@ addStatisticsForOutOfSyncCopies(StateChecker::Context& c)
const uint32_t n = c.entry->getNodeCount();
for (uint32_t i = 0; i < n; ++i) {
const BucketCopy& cp(c.entry->getNodeRef(i));
- c.stats.incSyncing(cp.getNode());
+ c.stats.incSyncing(cp.getNode(), c.getBucketSpace());
}
}