diff options
author | Geir Storli <geirst@verizonmedia.com> | 2021-04-29 14:13:33 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2021-04-29 14:13:33 +0000 |
commit | fa62d22df911dbdaa32e5dab02c527ee6698d52f (patch) | |
tree | de8a0cd3502e8b3f635407f917711a7e3020129e /storage | |
parent | 94fd404a04ce2fec36f184daa12aadacc28d645e (diff) |
Make the top-level BucketDBUpdater independent of the single distributor stripe.
Diffstat (limited to 'storage')
5 files changed, 24 insertions, 11 deletions
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index 44df64e467e..3af39bd6797 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -30,7 +30,6 @@ namespace storage::distributor { BucketDBUpdater::BucketDBUpdater(const DistributorNodeContext& node_ctx, DistributorOperationContext& op_ctx, DistributorInterface& distributor_interface, - DistributorMessageSender& sender, ChainedMessageSender& chained_sender, std::shared_ptr<const lib::Distribution> bootstrap_distribution, StripeAccessor& stripe_accessor) @@ -42,7 +41,7 @@ BucketDBUpdater::BucketDBUpdater(const DistributorNodeContext& node_ctx, _distributor_interface(distributor_interface), _pending_cluster_state(), _history(), - _sender(sender), + _sender(distributor_interface), _chained_sender(chained_sender), _outdated_nodes_map(), _transition_timer(_node_ctx.clock()), diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index cd78e0ac5b2..f5f5c7f0c2d 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -40,7 +40,6 @@ public: BucketDBUpdater(const DistributorNodeContext& node_ctx, DistributorOperationContext& op_ctx, DistributorInterface& distributor_interface, - DistributorMessageSender& sender, ChainedMessageSender& chained_sender, std::shared_ptr<const lib::Distribution> bootstrap_distribution, StripeAccessor& stripe_accessor); diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp index d49cecf76b6..6f093f538ab 100644 --- a/storage/src/vespa/storage/distributor/distributor.cpp +++ b/storage/src/vespa/storage/distributor/distributor.cpp @@ -73,10 +73,9 @@ Distributor::Distributor(DistributorComponentRegister& compReg, _component.registerMetricUpdateHook(_metricUpdateHook, framework::SecondTime(0)); if (num_distributor_stripes > 0) { LOG(info, "Setting up distributor with %u stripes", num_distributor_stripes); // TODO STRIPE remove once legacy gone - // TODO STRIPE: Avoid passing the singular stripe as DistributorMessageSender. _bucket_db_updater = std::make_unique<BucketDBUpdater>(_component, _component, - *this, *_stripe, - *this, _component.getDistribution(), + *this, *this, + _component.getDistribution(), *_stripe_accessor); } _hostInfoReporter.enableReporting(getConfig().getEnableHostInfoReporting()); @@ -285,6 +284,18 @@ Distributor::config() const return *_total_config; } +void +Distributor::sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) +{ + sendUp(cmd); +} + +void +Distributor::sendReply(const std::shared_ptr<api::StorageReply>& reply) +{ + sendUp(reply); +} + const lib::ClusterStateBundle& Distributor::getClusterStateBundle() const { diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index db9656eb09b..71d71290bb5 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -66,9 +66,6 @@ public: ~Distributor() override; - const ClusterContext& cluster_context() const { - return _component.cluster_context(); - } void onOpen() override; void onClose() override; bool onDown(const std::shared_ptr<api::StorageMessage>&) override; @@ -77,10 +74,15 @@ public: DistributorMetricSet& getMetrics() { return *_metrics; } - // Implements DistributorInterface, + // Implements DistributorInterface and DistributorMessageSender. DistributorMetricSet& metrics() override { return getMetrics(); } const DistributorConfiguration& config() const override; + void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override; + void sendReply(const std::shared_ptr<api::StorageReply>& reply) override; + int getDistributorIndex() const override { return _component.node_index(); } + const ClusterContext& cluster_context() const override { return _component.cluster_context(); } + /** * Enables a new cluster state. Called after the bucket db updater has * retrieved all bucket info related to the change. diff --git a/storage/src/vespa/storage/distributor/distributor_interface.h b/storage/src/vespa/storage/distributor/distributor_interface.h index 38f212ba911..aa9dfd37909 100644 --- a/storage/src/vespa/storage/distributor/distributor_interface.h +++ b/storage/src/vespa/storage/distributor/distributor_interface.h @@ -1,6 +1,8 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "distributormessagesender.h" + namespace storage { class DistributorConfiguration; } namespace storage::distributor { @@ -10,7 +12,7 @@ class DistributorMetricSet; /** * Simple interface to access metrics and config for the top-level distributor. */ -class DistributorInterface { +class DistributorInterface : public DistributorMessageSender { public: virtual ~DistributorInterface() {} virtual DistributorMetricSet& metrics() = 0; |