aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-05-12 15:16:09 +0000
committerGeir Storli <geirst@verizonmedia.com>2021-05-14 14:06:24 +0000
commit16fe3070bed5420510f96d69730458f6e4f3fd28 (patch)
tree5afa8a0eecdf779e9714339429895f27004a1584 /storage
parente53079c4bf7968197d1e9ad2319d132e0d0f48c9 (diff)
Reduce direct use of DistributorStripeComponent.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/distributor/distributortestutil.cpp12
-rw-r--r--storage/src/tests/distributor/distributortestutil.h5
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp2
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp6
-rw-r--r--storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp2
-rw-r--r--storage/src/tests/distributor/removelocationtest.cpp6
-rw-r--r--storage/src/tests/distributor/removeoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/statecheckerstest.cpp36
-rw-r--r--storage/src/tests/distributor/statoperationtest.cpp2
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/updateoperationtest.cpp3
-rw-r--r--storage/src/tests/distributor/visitoroperationtest.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_component.h4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_operation_context.h2
-rw-r--r--storage/src/vespa/storage/distributor/idealstatemanager.cpp12
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/getoperation.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/getoperation.h4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/putoperation.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/putoperation.h2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp8
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h12
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/removeoperation.h4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h8
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/updateoperation.h4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/visitoroperation.h4
-rw-r--r--storage/src/vespa/storage/distributor/persistencemessagetracker.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/persistencemessagetracker.h2
-rw-r--r--storage/src/vespa/storage/distributor/statechecker.cpp14
-rw-r--r--storage/src/vespa/storage/distributor/statechecker.h9
-rw-r--r--storage/src/vespa/storage/distributor/statecheckers.cpp18
-rw-r--r--storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp14
-rw-r--r--storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h8
37 files changed, 129 insertions, 104 deletions
diff --git a/storage/src/tests/distributor/distributortestutil.cpp b/storage/src/tests/distributor/distributortestutil.cpp
index e92ba0374bc..a2f32d8faa2 100644
--- a/storage/src/tests/distributor/distributortestutil.cpp
+++ b/storage/src/tests/distributor/distributortestutil.cpp
@@ -295,7 +295,7 @@ DistributorTestUtil::insertBucketInfo(document::BucketId id,
if (active) {
info2.setActive();
}
- BucketCopy copy(distributor_component().getUniqueTimestamp(), node, info2);
+ BucketCopy copy(operation_context().generate_unique_timestamp(), node, info2);
entry->addNode(copy.setTrusted(trusted), toVector<uint16_t>(0));
@@ -355,9 +355,8 @@ DistributorTestUtil::getExternalOperationHandler() {
return _distributor->external_operation_handler();
}
-storage::distributor::DistributorStripeComponent&
-DistributorTestUtil::distributor_component() {
- // TODO STRIPE tests use this to indirectly access bucket space repos/DBs!
+const storage::distributor::DistributorNodeContext&
+DistributorTestUtil::node_context() const {
return _distributor->distributor_component();
}
@@ -366,6 +365,11 @@ DistributorTestUtil::operation_context() {
return _distributor->distributor_component();
}
+const DocumentSelectionParser&
+DistributorTestUtil::doc_selection_parser() const {
+ return _distributor->distributor_component();
+}
+
bool
DistributorTestUtil::tick() {
framework::ThreadWaitInfo res(
diff --git a/storage/src/tests/distributor/distributortestutil.h b/storage/src/tests/distributor/distributortestutil.h
index 63ca47755e6..6664b8d823d 100644
--- a/storage/src/tests/distributor/distributortestutil.h
+++ b/storage/src/tests/distributor/distributortestutil.h
@@ -20,10 +20,12 @@ namespace distributor {
class Distributor;
class DistributorBucketSpace;
class DistributorBucketSpaceRepo;
+class DistributorNodeContext;
class DistributorStripe;
class DistributorStripeComponent;
class DistributorStripeOperationContext;
class DistributorStripePool;
+class DocumentSelectionParser;
class ExternalOperationHandler;
class IdealStateManager;
class Operation;
@@ -116,8 +118,9 @@ public:
StripeBucketDBUpdater& getBucketDBUpdater();
IdealStateManager& getIdealStateManager();
ExternalOperationHandler& getExternalOperationHandler();
- storage::distributor::DistributorStripeComponent& distributor_component();
+ const storage::distributor::DistributorNodeContext& node_context() const;
storage::distributor::DistributorStripeOperationContext& operation_context();
+ const DocumentSelectionParser& doc_selection_parser() const;
Distributor& getDistributor() noexcept { return *_distributor; }
const Distributor& getDistributor() const noexcept { return *_distributor; }
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index cb671bb07f5..c853dd692a0 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -57,7 +57,7 @@ struct GetOperationTest : Test, DistributorTestUtil {
void sendGet(api::InternalReadConsistency consistency = api::InternalReadConsistency::Strong) {
auto msg = std::make_shared<api::GetCommand>(makeDocumentBucket(BucketId(0)), docId, document::AllFields::NAME);
op = std::make_unique<GetOperation>(
- distributor_component(), getDistributorBucketSpace(),
+ node_context(), getDistributorBucketSpace(),
getDistributorBucketSpace().getBucketDatabase().acquire_read_guard(),
msg, getDistributor().getMetrics().gets,
consistency);
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index ffd07ad9d60..b75751c1270 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -74,8 +74,8 @@ public:
}
void sendPut(std::shared_ptr<api::PutCommand> msg) {
- op = std::make_unique<PutOperation>(distributor_component(),
- distributor_component(),
+ op = std::make_unique<PutOperation>(node_context(),
+ operation_context(),
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
@@ -402,7 +402,7 @@ TEST_F(PutOperationTest, do_not_send_CreateBucket_if_already_pending) {
// Manually shove sent messages into pending message tracker, since
// this isn't done automatically.
for (size_t i = 0; i < _sender.commands().size(); ++i) {
- distributor_component().getDistributor().getPendingMessageTracker()
+ operation_context().pending_message_tracker()
.insert(_sender.command(i));
}
diff --git a/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp b/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp
index 478f20796d0..e6f86f56d47 100644
--- a/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp
+++ b/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp
@@ -84,7 +84,7 @@ struct ReadForWriteVisitorOperationStarterTest : Test, DistributorTestUtil {
cmd->addBucketToBeVisited(BucketId()); // Will be inferred to first sub-bucket in DB
}
return std::make_shared<VisitorOperation>(
- distributor_component(), distributor_component(),
+ node_context(), operation_context(),
getDistributorBucketSpace(), cmd, _default_config,
getDistributor().getMetrics().visits);
}
diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp
index 7ba2995d8e3..02164d67a46 100644
--- a/storage/src/tests/distributor/removelocationtest.cpp
+++ b/storage/src/tests/distributor/removelocationtest.cpp
@@ -28,9 +28,9 @@ struct RemoveLocationOperationTest : Test, DistributorTestUtil {
auto msg = std::make_shared<api::RemoveLocationCommand>(selection, makeDocumentBucket(document::BucketId(0)));
op = std::make_unique<RemoveLocationOperation>(
- distributor_component(),
- distributor_component(),
- distributor_component(),
+ node_context(),
+ operation_context(),
+ doc_selection_parser(),
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp
index c4892f342e7..77ecb5d7aeb 100644
--- a/storage/src/tests/distributor/removeoperationtest.cpp
+++ b/storage/src/tests/distributor/removeoperationtest.cpp
@@ -36,8 +36,8 @@ struct RemoveOperationTest : Test, DistributorTestUtil {
auto msg = std::make_shared<api::RemoveCommand>(makeDocumentBucket(document::BucketId(0)), dId, 100);
op = std::make_unique<RemoveOperation>(
- distributor_component(),
- distributor_component(),
+ node_context(),
+ operation_context(),
getDistributorBucketSpace(),
msg,
getDistributor().getMetrics().
diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp
index 8310e4e38e0..e4ecb672171 100644
--- a/storage/src/tests/distributor/statecheckerstest.cpp
+++ b/storage/src/tests/distributor/statecheckerstest.cpp
@@ -240,7 +240,8 @@ struct StateCheckersTest : Test, DistributorTestUtil {
tick(); // Trigger command processing and pending state setup.
}
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(),
+ StateChecker::Context c(node_context(),
+ operation_context(),
getBucketSpaceRepo().get(params._bucket_space),
statsTracker,
bucket);
@@ -292,7 +293,8 @@ std::string StateCheckersTest::testSplit(uint32_t splitCount,
SplitBucketStateChecker checker;
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
getConfig().setSplitSize(splitSize);
getConfig().setSplitCount(splitCount);
getConfig().setMinimalBucketSplit(minSplitBits);
@@ -377,7 +379,8 @@ StateCheckersTest::testInconsistentSplit(const document::BucketId& bid,
{
SplitInconsistentStateChecker checker;
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, true,
PendingMessage(), includePriority);
}
@@ -435,7 +438,8 @@ StateCheckersTest::testJoin(uint32_t joinCount,
getConfig().setMinimalBucketSplit(minSplitBits);
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, true, blocker, includePriority);
}
@@ -588,7 +592,8 @@ StateCheckersTest::testSynchronizeAndMove(const std::string& bucketInfo,
enableDistributorClusterState(clusterState);
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, false, blocker, includePriority);
}
@@ -822,7 +827,8 @@ StateCheckersTest::testDeleteExtraCopies(
}
DeleteExtraCopiesStateChecker checker;
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, false, blocker, includePriority);
}
@@ -939,7 +945,8 @@ std::string StateCheckersTest::testBucketState(
BucketStateStateChecker checker;
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, false, PendingMessage(),
includePriority);
}
@@ -1099,7 +1106,8 @@ std::string StateCheckersTest::testBucketStatePerGroup(
BucketStateStateChecker checker;
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bid));
return testStateChecker(checker, c, false, PendingMessage(),
includePriority);
}
@@ -1286,7 +1294,8 @@ std::string StateCheckersTest::testGarbageCollection(
getConfig().setGarbageCollection("music", std::chrono::seconds(checkInterval));
getConfig().setLastGarbageCollectionChangeTime(vespalib::steady_time(std::chrono::seconds(lastChangeTime)));
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker,
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker,
makeDocumentBucket(e.getBucketId()));
getClock().setAbsoluteTimeInSeconds(nowTimestamp);
return testStateChecker(checker, c, false, PendingMessage(),
@@ -1359,7 +1368,8 @@ TEST_F(StateCheckersTest, gc_inhibited_when_ideal_node_in_maintenance) {
getConfig().setGarbageCollection("music", 3600s);
getConfig().setLastGarbageCollectionChangeTime(vespalib::steady_time(vespalib::duration::zero()));
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker,
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker,
makeDocumentBucket(bucket));
getClock().setAbsoluteTimeInSeconds(4000);
// Would normally (in a non-maintenance case) trigger GC due to having
@@ -1503,7 +1513,8 @@ TEST_F(StateCheckersTest, context_populates_ideal_state_containers) {
setupDistributor(2, 100, "distributor:1 storage:4");
NodeMaintenanceStatsTracker statsTracker;
- StateChecker::Context c(distributor_component(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket({17, 0}));
+ StateChecker::Context c(node_context(), operation_context(),
+ getDistributorBucketSpace(), statsTracker, makeDocumentBucket({17, 0}));
ASSERT_THAT(c.idealState, ElementsAre(1, 3));
// TODO replace with UnorderedElementsAre once we can build gmock without issues
@@ -1546,7 +1557,8 @@ public:
// NOTE: resets the bucket database!
void runFor(const document::BucketId& bid) {
Checker checker;
- StateChecker::Context c(_fixture.distributor_component(), _fixture.getDistributorBucketSpace(), _statsTracker, makeDocumentBucket(bid));
+ StateChecker::Context c(_fixture.node_context(), _fixture.operation_context(),
+ _fixture.getDistributorBucketSpace(), _statsTracker, makeDocumentBucket(bid));
_result = _fixture.testStateChecker(
checker, c, false, StateCheckersTest::PendingMessage(), false);
}
diff --git a/storage/src/tests/distributor/statoperationtest.cpp b/storage/src/tests/distributor/statoperationtest.cpp
index a80eb9533bb..be4fe414b8b 100644
--- a/storage/src/tests/distributor/statoperationtest.cpp
+++ b/storage/src/tests/distributor/statoperationtest.cpp
@@ -73,7 +73,7 @@ TEST_F(StatOperationTest, bucket_list) {
StatBucketListOperation op(
getDistributorBucketSpace().getBucketDatabase(),
getIdealStateManager(),
- distributor_component().getIndex(),
+ node_context().node_index(),
msg);
op.start(_sender, framework::MilliSecTime(0));
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index dae94e41b46..ea170441a13 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -332,9 +332,9 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState,
msg->setCondition(options._condition);
msg->setTransportContext(std::make_unique<DummyTransportContext>());
- auto& comp = distributor_component();
return std::make_shared<TwoPhaseUpdateOperation>(
- comp, comp, comp, getDistributorBucketSpace(), msg, getDistributor().getMetrics());
+ node_context(), operation_context(), doc_selection_parser(),
+ getDistributorBucketSpace(), msg, getDistributor().getMetrics());
}
TEST_F(TwoPhaseUpdateOperationTest, simple) {
diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp
index 6620cf58571..e31a5f0a768 100644
--- a/storage/src/tests/distributor/updateoperationtest.cpp
+++ b/storage/src/tests/distributor/updateoperationtest.cpp
@@ -66,9 +66,8 @@ UpdateOperationTest::sendUpdate(const std::string& bucketState, bool create_if_m
auto msg = std::make_shared<api::UpdateCommand>(makeDocumentBucket(document::BucketId(0)), update, 100);
- auto& comp = distributor_component();
return std::make_shared<UpdateOperation>(
- comp, comp, getDistributorBucketSpace(), msg, std::vector<BucketDatabase::Entry>(),
+ node_context(), operation_context(), getDistributorBucketSpace(), msg, std::vector<BucketDatabase::Entry>(),
getDistributor().getMetrics().updates);
}
diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp
index f9a4e6dbe0f..011bf0e81fd 100644
--- a/storage/src/tests/distributor/visitoroperationtest.cpp
+++ b/storage/src/tests/distributor/visitoroperationtest.cpp
@@ -104,8 +104,8 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
const VisitorOperation::Config& config)
{
return std::make_unique<VisitorOperation>(
- distributor_component(),
- distributor_component(),
+ node_context(),
+ operation_context(),
getDistributorBucketSpace(),
msg,
config,
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.cpp b/storage/src/vespa/storage/distributor/distributor_stripe.cpp
index 1373eb27249..5c6c529fe69 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_stripe.cpp
@@ -54,7 +54,7 @@ DistributorStripe::DistributorStripe(DistributorComponentRegister& compReg,
_maintenanceOperationOwner(*this, _component.getClock()),
_operation_sequencer(std::make_unique<OperationSequencer>()),
_pendingMessageTracker(compReg),
- _bucketDBUpdater(*this, *_bucketSpaceRepo, *_readOnlyBucketSpaceRepo, *this, compReg, use_legacy_mode),
+ _bucketDBUpdater(_component, _component, *this, *this, use_legacy_mode),
_distributorStatusDelegate(compReg, *this, *this),
_bucketDBStatusDelegate(compReg, *this, _bucketDBUpdater),
_idealStateManager(*this, *_bucketSpaceRepo, *_readOnlyBucketSpaceRepo, compReg),
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.h b/storage/src/vespa/storage/distributor/distributor_stripe_component.h
index 48aef90be8a..31ee9ca88d2 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_component.h
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.h
@@ -158,6 +158,10 @@ public:
*/
bool storage_node_is_up(document::BucketSpace bucket_space, uint32_t node_index) const override;
+ const BucketGcTimeCalculator::BucketIdHasher& bucket_id_hasher() const override {
+ return getDistributor().getBucketIdHasher();
+ }
+
// Implements DocumentSelectionParser
std::unique_ptr<document::select::Node> parse_selection(const vespalib::string& selection) const override;
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_operation_context.h b/storage/src/vespa/storage/distributor/distributor_stripe_operation_context.h
index e4086374ad9..8419abeadaa 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_operation_context.h
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_operation_context.h
@@ -2,6 +2,7 @@
#pragma once
+#include "bucketgctimecalculator.h"
#include "bucketownership.h"
#include "distributor_operation_context.h"
#include "operation_routing_snapshot.h"
@@ -46,6 +47,7 @@ public:
virtual const lib::ClusterState* pending_cluster_state_or_null(const document::BucketSpace& bucket_space) const = 0;
virtual const lib::ClusterStateBundle& cluster_state_bundle() const = 0;
virtual bool storage_node_is_up(document::BucketSpace bucket_space, uint32_t node_index) const = 0;
+ virtual const BucketGcTimeCalculator::BucketIdHasher& bucket_id_hasher() const = 0;
};
}
diff --git a/storage/src/vespa/storage/distributor/idealstatemanager.cpp b/storage/src/vespa/storage/distributor/idealstatemanager.cpp
index 867a8adf2ba..7bebe4c001a 100644
--- a/storage/src/vespa/storage/distributor/idealstatemanager.cpp
+++ b/storage/src/vespa/storage/distributor/idealstatemanager.cpp
@@ -61,7 +61,7 @@ IdealStateManager::print(std::ostream& out, bool verbose,
bool
IdealStateManager::iAmUp() const
{
- Node node(NodeType::DISTRIBUTOR, _distributorComponent.getIndex());
+ Node node(NodeType::DISTRIBUTOR, node_context().node_index());
// Assume that derived cluster states agree on distributor node being up
const auto &state = *operation_context().cluster_state_bundle().getBaselineClusterState();
const lib::State &nodeState = state.getNodeState(node).getState();
@@ -121,7 +121,7 @@ IdealStateManager::runStateCheckers(StateChecker::Context& c) const
// We go through _all_ active state checkers so that statistics can be
// collected across all checkers, not just the ones that are highest pri.
for (uint32_t i = 0; i < _stateCheckers.size(); i++) {
- if (!_distributorComponent.getDistributor().getConfig().stateCheckerIsActive(
+ if (!operation_context().distributor_config().stateCheckerIsActive(
_stateCheckers[i]->getName()))
{
LOG(spam, "Skipping state checker %s",
@@ -164,7 +164,7 @@ IdealStateManager::generateHighestPriority(
NodeMaintenanceStatsTracker& statsTracker) const
{
auto &distributorBucketSpace(_bucketSpaceRepo.get(bucket.getBucketSpace()));
- StateChecker::Context c(_distributorComponent, distributorBucketSpace, statsTracker, bucket);
+ StateChecker::Context c(node_context(), operation_context(), distributorBucketSpace, statsTracker, bucket);
fillParentAndChildBuckets(c);
fillSiblingBucket(c);
@@ -201,7 +201,7 @@ IdealStateManager::generateInterceptingSplit(BucketSpace bucketSpace,
NodeMaintenanceStatsTracker statsTracker;
document::Bucket bucket(bucketSpace, e.getBucketId());
auto &distributorBucketSpace(_bucketSpaceRepo.get(bucket.getBucketSpace()));
- StateChecker::Context c(_distributorComponent, distributorBucketSpace, statsTracker, bucket);
+ StateChecker::Context c(node_context(), operation_context(), distributorBucketSpace, statsTracker, bucket);
if (e.valid()) {
c.entry = e;
@@ -236,7 +236,7 @@ IdealStateManager::generateAll(const document::Bucket &bucket,
NodeMaintenanceStatsTracker& statsTracker) const
{
auto &distributorBucketSpace(_bucketSpaceRepo.get(bucket.getBucketSpace()));
- StateChecker::Context c(_distributorComponent, distributorBucketSpace, statsTracker, bucket);
+ StateChecker::Context c(node_context(), operation_context(), distributorBucketSpace, statsTracker, bucket);
fillParentAndChildBuckets(c);
fillSiblingBucket(c);
BucketDatabase::Entry* e(getEntryForPrimaryBucket(c));
@@ -293,7 +293,7 @@ void IdealStateManager::dump_bucket_space_db_status(document::BucketSpace bucket
void IdealStateManager::getBucketStatus(std::ostream& out) const {
LOG(debug, "Dumping bucket database valid at cluster state version %u",
- _distributorComponent.getDistributor().getClusterStateBundle().getVersion());
+ operation_context().cluster_state_bundle().getVersion());
for (auto& space : _bucketSpaceRepo) {
out << "<h2>" << document::FixedBucketSpaces::to_string(space.first) << " - " << space.first << "</h2>\n";
diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
index 94bddc4d0c4..db84575db31 100644
--- a/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
@@ -45,7 +45,7 @@ GetOperation::GroupId::operator==(const GroupId& other) const
&& _node == other._node);
}
-GetOperation::GetOperation(DistributorNodeContext& node_ctx,
+GetOperation::GetOperation(const DistributorNodeContext& node_ctx,
const DistributorBucketSpace &bucketSpace,
std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
std::shared_ptr<api::GetCommand> msg,
diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.h b/storage/src/vespa/storage/distributor/operations/external/getoperation.h
index 18309643754..10d457922c9 100644
--- a/storage/src/vespa/storage/distributor/operations/external/getoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.h
@@ -26,7 +26,7 @@ class DistributorBucketSpace;
class GetOperation : public Operation
{
public:
- GetOperation(DistributorNodeContext& node_ctx,
+ GetOperation(const DistributorNodeContext& node_ctx,
const DistributorBucketSpace &bucketSpace,
std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
std::shared_ptr<api::GetCommand> msg,
@@ -97,7 +97,7 @@ private:
// within that bucket.
std::map<GroupId, GroupVector> _responses;
- DistributorNodeContext& _node_ctx;
+ const DistributorNodeContext& _node_ctx;
const DistributorBucketSpace &_bucketSpace;
std::shared_ptr<api::GetCommand> _msg;
diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
index 111400f176a..9d9a04e9dcc 100644
--- a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
@@ -21,7 +21,7 @@ using namespace storage::distributor;
using namespace storage;
using document::BucketSpace;
-PutOperation::PutOperation(DistributorNodeContext& node_ctx,
+PutOperation::PutOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::PutCommand> msg,
diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.h b/storage/src/vespa/storage/distributor/operations/external/putoperation.h
index fa793e578d2..57ae2e3ba9f 100644
--- a/storage/src/vespa/storage/distributor/operations/external/putoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.h
@@ -23,7 +23,7 @@ class OperationTargetList;
class PutOperation : public SequencedOperation
{
public:
- PutOperation(DistributorNodeContext& node_ctx,
+ PutOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::PutCommand> msg,
diff --git a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp
index 26aca41eaa2..54bc6782893 100644
--- a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp
@@ -18,9 +18,9 @@ using namespace storage;
using document::BucketSpace;
RemoveLocationOperation::RemoveLocationOperation(
- DistributorNodeContext& node_ctx,
+ const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
- DocumentSelectionParser& parser,
+ const DocumentSelectionParser& parser,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::RemoveLocationCommand> msg,
PersistenceOperationMetricSet& metric)
@@ -41,8 +41,8 @@ RemoveLocationOperation::~RemoveLocationOperation() = default;
int
RemoveLocationOperation::getBucketId(
- DistributorNodeContext& node_ctx,
- DocumentSelectionParser& parser,
+ const DistributorNodeContext& node_ctx,
+ const DocumentSelectionParser& parser,
const api::RemoveLocationCommand& cmd, document::BucketId& bid)
{
document::BucketSelector bucketSel(node_ctx.bucket_id_factory());
diff --git a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h
index a635f7b697c..8cac26c5669 100644
--- a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h
@@ -15,17 +15,17 @@ class DistributorBucketSpace;
class RemoveLocationOperation : public Operation
{
public:
- RemoveLocationOperation(DistributorNodeContext& node_ctx,
+ RemoveLocationOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
- DocumentSelectionParser& parser,
+ const DocumentSelectionParser& parser,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::RemoveLocationCommand> msg,
PersistenceOperationMetricSet& metric);
~RemoveLocationOperation() override;
- static int getBucketId(DistributorNodeContext& node_ctx,
- DocumentSelectionParser& parser,
+ static int getBucketId(const DistributorNodeContext& node_ctx,
+ const DocumentSelectionParser& parser,
const api::RemoveLocationCommand& cmd,
document::BucketId& id);
void onStart(DistributorStripeMessageSender& sender) override;
@@ -39,8 +39,8 @@ private:
std::shared_ptr<api::RemoveLocationCommand> _msg;
- DistributorNodeContext& _node_ctx;
- DocumentSelectionParser& _parser;
+ const DistributorNodeContext& _node_ctx;
+ const DocumentSelectionParser& _parser;
DistributorBucketSpace &_bucketSpace;
};
diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp
index 07f37680ad2..6626e6f7171 100644
--- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp
@@ -12,7 +12,7 @@ using namespace storage::distributor;
using namespace storage;
using document::BucketSpace;
-RemoveOperation::RemoveOperation(DistributorNodeContext& node_ctx,
+RemoveOperation::RemoveOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::RemoveCommand> msg,
diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.h b/storage/src/vespa/storage/distributor/operations/external/removeoperation.h
index 2d3bea157fa..2ac26b0d719 100644
--- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.h
@@ -15,7 +15,7 @@ class DistributorBucketSpace;
class RemoveOperation : public SequencedOperation
{
public:
- RemoveOperation(DistributorNodeContext& node_ctx,
+ RemoveOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::RemoveCommand> msg,
@@ -36,7 +36,7 @@ private:
std::shared_ptr<api::RemoveCommand> _msg;
- DistributorNodeContext& _node_ctx;
+ const DistributorNodeContext& _node_ctx;
DistributorBucketSpace &_bucketSpace;
};
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index f0c15935b81..9077f3dc288 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -25,9 +25,9 @@ namespace storage::distributor {
TwoPhaseUpdateOperation::TwoPhaseUpdateOperation(
- DistributorNodeContext& node_ctx,
+ const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
- DocumentSelectionParser& parser,
+ const DocumentSelectionParser& parser,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::UpdateCommand> msg,
DistributorMetricSet& metrics,
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h
index 32b15cc7edf..ff49e2068a6 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h
@@ -55,9 +55,9 @@ class GetOperation;
class TwoPhaseUpdateOperation : public SequencedOperation
{
public:
- TwoPhaseUpdateOperation(DistributorNodeContext& node_ctx,
+ TwoPhaseUpdateOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
- DocumentSelectionParser& parser,
+ const DocumentSelectionParser& parser,
DistributorBucketSpace &bucketSpace,
std::shared_ptr<api::UpdateCommand> msg,
DistributorMetricSet& metrics,
@@ -145,9 +145,9 @@ private:
PersistenceOperationMetricSet& _metadata_get_metrics;
std::shared_ptr<api::UpdateCommand> _updateCmd;
std::shared_ptr<api::StorageReply> _updateReply;
- DistributorNodeContext& _node_ctx;
+ const DistributorNodeContext& _node_ctx;
DistributorStripeOperationContext& _op_ctx;
- DocumentSelectionParser& _parser;
+ const DocumentSelectionParser& _parser;
DistributorBucketSpace &_bucketSpace;
SentMessageMap _sentMessageMap;
SendState _sendState;
diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp
index 69baf9df452..fbdd26b9eff 100644
--- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp
@@ -18,7 +18,7 @@ using document::BucketSpace;
namespace storage::distributor {
-UpdateOperation::UpdateOperation(DistributorNodeContext& node_ctx,
+UpdateOperation::UpdateOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace& bucketSpace,
const std::shared_ptr<api::UpdateCommand>& msg,
diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h
index 7da6f48c333..533992e926c 100644
--- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h
@@ -23,7 +23,7 @@ class DistributorBucketSpace;
class UpdateOperation : public Operation
{
public:
- UpdateOperation(DistributorNodeContext& node_ctx,
+ UpdateOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace& bucketSpace,
const std::shared_ptr<api::UpdateCommand>& msg,
@@ -48,7 +48,7 @@ private:
const api::Timestamp _new_timestamp;
const bool _is_auto_create_update;
- DistributorNodeContext& _node_ctx;
+ const DistributorNodeContext& _node_ctx;
DistributorBucketSpace &_bucketSpace;
std::pair<document::BucketId, uint16_t> _newestTimestampLocation;
api::BucketInfo _infoAtSendTime; // Should be same across all replicas
diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
index 06f43b8759e..7679d4bc0e5 100644
--- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
@@ -63,7 +63,7 @@ matches_visitor_library(vespalib::stringref input, vespalib::stringref expected)
}
VisitorOperation::VisitorOperation(
- DistributorNodeContext& node_ctx,
+ const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
const api::CreateVisitorCommand::SP& m,
diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h
index 6fdee031549..9ea4cdfc4ae 100644
--- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h
@@ -35,7 +35,7 @@ public:
uint32_t maxVisitorsPerNodePerVisitor;
};
- VisitorOperation(DistributorNodeContext& node_ctx,
+ VisitorOperation(const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
DistributorBucketSpace &bucketSpace,
const std::shared_ptr<api::CreateVisitorCommand>& msg,
@@ -152,7 +152,7 @@ private:
*/
vespalib::duration timeLeft() const noexcept;
- DistributorNodeContext& _node_ctx;
+ const DistributorNodeContext& _node_ctx;
DistributorStripeOperationContext& _op_ctx;
DistributorBucketSpace &_bucketSpace;
SentMessagesMap _sentMessages;
diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
index 9328a43cc6b..746a0012d0d 100644
--- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
+++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
@@ -15,7 +15,7 @@ namespace storage::distributor {
PersistenceMessageTrackerImpl::PersistenceMessageTrackerImpl(
PersistenceOperationMetricSet& metric,
std::shared_ptr<api::BucketInfoReply> reply,
- DistributorNodeContext& node_ctx,
+ const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
api::Timestamp revertTimestamp)
: MessageTracker(node_ctx),
diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.h b/storage/src/vespa/storage/distributor/persistencemessagetracker.h
index 57d0a77364b..3d7838d2a45 100644
--- a/storage/src/vespa/storage/distributor/persistencemessagetracker.h
+++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.h
@@ -36,7 +36,7 @@ private:
public:
PersistenceMessageTrackerImpl(PersistenceOperationMetricSet& metric,
std::shared_ptr<api::BucketInfoReply> reply,
- DistributorNodeContext& node_ctx,
+ const DistributorNodeContext& node_ctx,
DistributorStripeOperationContext& op_ctx,
api::Timestamp revertTimestamp = 0);
~PersistenceMessageTrackerImpl() override;
diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp
index bbbe283077f..82b8371e163 100644
--- a/storage/src/vespa/storage/distributor/statechecker.cpp
+++ b/storage/src/vespa/storage/distributor/statechecker.cpp
@@ -61,19 +61,21 @@ StateChecker::Result::createStoredResult(
return Result(std::unique_ptr<ResultImpl>(new StoredResultImpl(std::move(operation), MaintenancePriority(priority))));
}
-StateChecker::Context::Context(const DistributorStripeComponent& c,
+StateChecker::Context::Context(const DistributorNodeContext& node_ctx_in,
+ const DistributorStripeOperationContext& op_ctx_in,
const DistributorBucketSpace &distributorBucketSpace,
NodeMaintenanceStatsTracker& statsTracker,
const document::Bucket &bucket_)
: bucket(bucket_),
- siblingBucket(c.get_sibling(bucket.getBucketId())),
+ siblingBucket(op_ctx_in.get_sibling(bucket.getBucketId())),
systemState(distributorBucketSpace.getClusterState()),
- pending_cluster_state(c.getDistributor().pendingClusterStateOrNull(bucket_.getBucketSpace())),
- distributorConfig(c.getDistributor().getConfig()),
+ pending_cluster_state(op_ctx_in.pending_cluster_state_or_null(bucket_.getBucketSpace())),
+ distributorConfig(op_ctx_in.distributor_config()),
distribution(distributorBucketSpace.getDistribution()),
- gcTimeCalculator(c.getDistributor().getBucketIdHasher(),
+ gcTimeCalculator(op_ctx_in.bucket_id_hasher(),
std::chrono::duration_cast<std::chrono::seconds>(distributorConfig.getGarbageCollectionInterval())),
- component(c),
+ node_ctx(node_ctx_in),
+ op_ctx(op_ctx_in),
db(distributorBucketSpace.getBucketDatabase()),
stats(statsTracker)
{
diff --git a/storage/src/vespa/storage/distributor/statechecker.h b/storage/src/vespa/storage/distributor/statechecker.h
index 44c45e62ec8..47d5a5b55ed 100644
--- a/storage/src/vespa/storage/distributor/statechecker.h
+++ b/storage/src/vespa/storage/distributor/statechecker.h
@@ -17,8 +17,9 @@ namespace storage { class DistributorConfiguration; }
namespace storage::distributor {
-class DistributorStripeComponent;
class DistributorBucketSpace;
+class DistributorNodeContext;
+class DistributorStripeOperationContext;
class NodeMaintenanceStatsTracker;
/**
@@ -44,7 +45,8 @@ public:
*/
struct Context
{
- Context(const DistributorStripeComponent&,
+ Context(const DistributorNodeContext& node_ctx_in,
+ const DistributorStripeOperationContext& op_ctx_in,
const DistributorBucketSpace &distributorBucketSpace,
NodeMaintenanceStatsTracker&,
const document::Bucket &bucket_);
@@ -76,7 +78,8 @@ public:
std::vector<uint16_t> idealState;
std::unordered_set<uint16_t> unorderedIdealState;
- const DistributorStripeComponent& component;
+ const DistributorNodeContext& node_ctx;
+ const DistributorStripeOperationContext& op_ctx;
const BucketDatabase& db;
NodeMaintenanceStatsTracker& stats;
diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp
index ed3e47fcafb..49b07a6f356 100644
--- a/storage/src/vespa/storage/distributor/statecheckers.cpp
+++ b/storage/src/vespa/storage/distributor/statecheckers.cpp
@@ -85,7 +85,7 @@ SplitBucketStateChecker::generateMinimumBucketSplitOperation(
StateChecker::Context& c)
{
auto so = std::make_unique<SplitOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), c.entry->getNodes()),
c.distributorConfig.getMinimalBucketSplit(),
0,
@@ -103,7 +103,7 @@ SplitBucketStateChecker::generateMaxSizeExceededSplitOperation(
StateChecker::Context& c)
{
auto so = std::make_unique<SplitOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), c.entry->getNodes()),
58,
c.distributorConfig.getSplitCount(),
@@ -466,7 +466,7 @@ JoinBucketsStateChecker::check(StateChecker::Context& c)
}
sourceBuckets.push_back(c.getBucketId());
auto op = std::make_unique<JoinOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(joinedBucket, c.entry->getNodes()),
sourceBuckets);
op->setPriority(c.distributorConfig.getMaintenancePriorities().joinBuckets);
@@ -570,7 +570,7 @@ SplitInconsistentStateChecker::check(StateChecker::Context& c)
}
auto op = std::make_unique<SplitOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), c.entry->getNodes()),
getHighestUsedBits(c.entries),
0,
@@ -1009,7 +1009,7 @@ DeleteExtraCopiesStateChecker::check(StateChecker::Context& c)
if (!removedCopies.empty()) {
auto ro = std::make_unique<RemoveBucketOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), removedCopies));
ro->setPriority(c.distributorConfig.getMaintenancePriorities().deleteBucketCopy);
@@ -1110,7 +1110,7 @@ BucketStateStateChecker::check(StateChecker::Context& c)
activeNodeIndexes.push_back(activeNodes[i]._nodeIndex);
}
auto op = std::make_unique<SetBucketStateOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), operationNodes),
activeNodeIndexes);
@@ -1137,7 +1137,7 @@ GarbageCollectionStateChecker::needsGarbageCollection(const Context& c) const
}
std::chrono::seconds lastRunAt(c.entry->getLastGarbageCollectionTime());
std::chrono::seconds currentTime(
- c.component.getClock().getTimeInSeconds().getTime());
+ c.node_ctx.clock().getTimeInSeconds().getTime());
return c.gcTimeCalculator.shouldGc(c.getBucketId(), currentTime, lastRunAt);
}
@@ -1147,14 +1147,14 @@ GarbageCollectionStateChecker::check(Context& c)
{
if (needsGarbageCollection(c)) {
auto op = std::make_unique<GarbageCollectionOperation>(
- c.component.cluster_context(),
+ c.node_ctx,
BucketAndNodes(c.getBucket(), c.entry->getNodes()));
vespalib::asciistream reason;
reason << "[Needs garbage collection: Last check at "
<< c.entry->getLastGarbageCollectionTime()
<< ", current time "
- << c.component.getClock().getTimeInSeconds().getTime()
+ << c.node_ctx.clock().getTimeInSeconds().getTime()
<< ", configured interval "
<< vespalib::to_s(c.distributorConfig.getGarbageCollectionInterval()) << "]";
diff --git a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp
index 77151da19bc..95272752ace 100644
--- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp
+++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp
@@ -28,17 +28,15 @@ using vespalib::xml::XmlAttribute;
namespace storage::distributor {
-StripeBucketDBUpdater::StripeBucketDBUpdater(DistributorStripeInterface& owner,
- DistributorBucketSpaceRepo& bucketSpaceRepo,
- DistributorBucketSpaceRepo& readOnlyBucketSpaceRepo,
+StripeBucketDBUpdater::StripeBucketDBUpdater(const DistributorNodeContext& node_ctx,
+ DistributorStripeOperationContext& op_ctx,
+ DistributorStripeInterface& owner,
DistributorMessageSender& sender,
- DistributorComponentRegister& compReg,
bool use_legacy_mode)
: framework::StatusReporter("bucketdb", "Bucket DB Updater"),
- _distributorComponent(owner, bucketSpaceRepo, readOnlyBucketSpaceRepo, compReg, "Bucket DB Updater"),
- _node_ctx(_distributorComponent),
- _op_ctx(_distributorComponent),
- _distributor_interface(_distributorComponent.getDistributor()),
+ _node_ctx(node_ctx),
+ _op_ctx(op_ctx),
+ _distributor_interface(owner),
_delayedRequests(),
_sentMessages(),
_pendingClusterState(),
diff --git a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h
index ad367cb95a0..ed059a32d14 100644
--- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h
+++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h
@@ -36,11 +36,10 @@ class StripeBucketDBUpdater final
{
public:
using OutdatedNodesMap = dbtransition::OutdatedNodesMap;
- StripeBucketDBUpdater(DistributorStripeInterface& owner,
- DistributorBucketSpaceRepo& bucketSpaceRepo,
- DistributorBucketSpaceRepo& readOnlyBucketSpaceRepo,
+ StripeBucketDBUpdater(const DistributorNodeContext& node_ctx,
+ DistributorStripeOperationContext& op_ctx,
+ DistributorStripeInterface& owner,
DistributorMessageSender& sender,
- DistributorComponentRegister& compReg,
bool use_legacy_mode);
~StripeBucketDBUpdater() override;
@@ -264,7 +263,6 @@ private:
mutable bool _cachedOwned;
};
- DistributorStripeComponent _distributorComponent;
const DistributorNodeContext& _node_ctx;
DistributorStripeOperationContext& _op_ctx;
DistributorStripeInterface& _distributor_interface;