aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-12-04 10:07:03 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-12-04 10:07:03 +0000
commit269abb3011a0b7ee85760b497421ac241fca9891 (patch)
treeba08ffc4285f49fa071d478132128a7b3fe3fddf /storage
parentd5b2fa84e187bf17b675f4601acdbd9b142fbc78 (diff)
Remove dependency between ExternalOperationHandler and Distributor.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/common/messagesender.h9
-rw-r--r--storage/src/vespa/storage/distributor/distributor.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor.h5
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.cpp23
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.h4
5 files changed, 29 insertions, 16 deletions
diff --git a/storage/src/vespa/storage/common/messagesender.h b/storage/src/vespa/storage/common/messagesender.h
index 48020bf053e..839dbcb91dc 100644
--- a/storage/src/vespa/storage/common/messagesender.h
+++ b/storage/src/vespa/storage/common/messagesender.h
@@ -43,4 +43,13 @@ struct ChainedMessageSender {
virtual void sendDown(const std::shared_ptr<api::StorageMessage>&) = 0;
};
+/**
+ * Interface to send messages "up" that bypasses message tracking.
+ */
+class NonTrackingMessageSender {
+public:
+ virtual ~NonTrackingMessageSender() = default;
+ virtual void send_up_without_tracking(const std::shared_ptr<api::StorageMessage>&) = 0;
+};
+
} // storage
diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp
index 3f42e9801cc..235384c9473 100644
--- a/storage/src/vespa/storage/distributor/distributor.cpp
+++ b/storage/src/vespa/storage/distributor/distributor.cpp
@@ -85,8 +85,8 @@ Distributor::Distributor(DistributorComponentRegister& compReg,
_bucketDBStatusDelegate(compReg, *this, _bucketDBUpdater),
_idealStateManager(*this, *_bucketSpaceRepo, *_readOnlyBucketSpaceRepo, compReg, manageActiveBucketCopies),
_messageSender(messageSender),
- _externalOperationHandler(*this, _component, _component,
- getMetrics(), getMessageSender(), _component,
+ _externalOperationHandler(_component, _component,
+ getMetrics(), getMessageSender(), *this, _component,
_idealStateManager, _operationOwner),
_threadPool(threadPool),
_initializingIsUp(true),
diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h
index 9a74f25fffd..e95df863210 100644
--- a/storage/src/vespa/storage/distributor/distributor.h
+++ b/storage/src/vespa/storage/distributor/distributor.h
@@ -44,7 +44,8 @@ class Distributor : public StorageLink,
public framework::StatusReporter,
public framework::TickingThread,
public MinReplicaProvider,
- public BucketSpacesStatsProvider
+ public BucketSpacesStatsProvider,
+ public NonTrackingMessageSender
{
public:
Distributor(DistributorComponentRegister&,
@@ -63,7 +64,7 @@ public:
void sendUp(const std::shared_ptr<api::StorageMessage>&) override;
void sendDown(const std::shared_ptr<api::StorageMessage>&) override;
// Bypasses message tracker component. Thread safe.
- void send_up_without_tracking(const std::shared_ptr<api::StorageMessage>&);
+ void send_up_without_tracking(const std::shared_ptr<api::StorageMessage>&) override;
ChainedMessageSender& getMessageSender() override {
return (_messageSender == 0 ? *this : *_messageSender);
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
index 3d464579824..5d2189bdb59 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
@@ -29,35 +29,38 @@ LOG_SETUP(".distributor.manager");
namespace storage::distributor {
class DirectDispatchSender : public DistributorMessageSender {
- Distributor& _distributor;
+ DistributorNodeContext& _node_ctx;
+ NonTrackingMessageSender& _msg_sender;
public:
- explicit DirectDispatchSender(Distributor& distributor)
- : _distributor(distributor)
+ explicit DirectDispatchSender(DistributorNodeContext& node_ctx,
+ NonTrackingMessageSender& msg_sender)
+ : _node_ctx(node_ctx),
+ _msg_sender(msg_sender)
{}
~DirectDispatchSender() override = default;
void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override {
- _distributor.send_up_without_tracking(cmd);
+ _msg_sender.send_up_without_tracking(cmd);
}
void sendReply(const std::shared_ptr<api::StorageReply>& reply) override {
- _distributor.send_up_without_tracking(reply);
+ _msg_sender.send_up_without_tracking(reply);
}
int getDistributorIndex() const override {
- return _distributor.getDistributorIndex(); // Thread safe
+ return _node_ctx.node_index();
}
const vespalib::string& getClusterName() const override {
- return _distributor.getClusterName(); // Thread safe
+ return _node_ctx.cluster_name();
}
const PendingMessageTracker& getPendingMessageTracker() const override {
abort(); // Never called by the messages using this component.
}
};
-ExternalOperationHandler::ExternalOperationHandler(Distributor& owner,
- DistributorNodeContext& node_ctx,
+ExternalOperationHandler::ExternalOperationHandler(DistributorNodeContext& node_ctx,
DistributorOperationContext& op_ctx,
DistributorMetricSet& metrics,
ChainedMessageSender& msg_sender,
+ NonTrackingMessageSender& non_tracking_sender,
DocumentSelectionParser& parser,
const MaintenanceOperationGenerator& gen,
OperationOwner& operation_owner)
@@ -66,7 +69,7 @@ ExternalOperationHandler::ExternalOperationHandler(Distributor& owner,
_metrics(metrics),
_msg_sender(msg_sender),
_parser(parser),
- _direct_dispatch_sender(std::make_unique<DirectDispatchSender>(owner)),
+ _direct_dispatch_sender(std::make_unique<DirectDispatchSender>(node_ctx, non_tracking_sender)),
_operationGenerator(gen),
_rejectFeedBeforeTimeReached(), // At epoch
_distributor_operation_owner(operation_owner),
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.h b/storage/src/vespa/storage/distributor/externaloperationhandler.h
index 6e91f31db9c..0b6e9d970aa 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.h
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.h
@@ -40,11 +40,11 @@ public:
bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) override;
bool onGetBucketList(const std::shared_ptr<api::GetBucketListCommand>&) override;
- ExternalOperationHandler(Distributor& owner,
- DistributorNodeContext& node_ctx,
+ ExternalOperationHandler(DistributorNodeContext& node_ctx,
DistributorOperationContext& op_ctx,
DistributorMetricSet& metrics,
ChainedMessageSender& msg_sender,
+ NonTrackingMessageSender& non_tracking_sender,
DocumentSelectionParser& parser,
const MaintenanceOperationGenerator& gen,
OperationOwner& operation_owner);