aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-04-30 14:16:35 +0000
committerGeir Storli <geirst@verizonmedia.com>2021-04-30 14:16:35 +0000
commitd29cc5c3eb67ec5059a180bb23f089a4ba63ccd5 (patch)
treee334e3f9521284c00712602c8ed29bd1ee6a628a
parentbcdf9c503f9b93d9949c09fbd9e3a1239f592e0b (diff)
Move function for getting storage node up states to a common place.
-rw-r--r--storage/src/vespa/storage/distributor/bucketdbupdater.cpp6
-rw-r--r--storage/src/vespa/storage/distributor/distributor_component.h5
-rw-r--r--storage/src/vespa/storage/distributor/distributor_operation_context.h4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe.h8
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_component.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_component.h4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_interface.h1
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/putoperation.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/storage_node_up_states.h14
-rw-r--r--storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp8
11 files changed, 28 insertions, 32 deletions
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
index 3af39bd6797..ee36259bdd3 100644
--- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
+++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
@@ -108,7 +108,7 @@ BucketDBUpdater::remove_superfluous_buckets(
const lib::ClusterStateBundle& new_state,
bool is_distribution_config_change)
{
- const char* up_states = _op_ctx.storage_node_up_states();
+ const char* up_states = storage_node_up_states();
// TODO STRIPE explicit space -> config mapping, don't get via repo
// ... but we need to get the current cluster state per space..!
for (auto& elem : _op_ctx.bucket_space_repo()) {
@@ -189,7 +189,7 @@ BucketDBUpdater::storage_distribution_changed(const BucketSpaceDistributionConfi
auto clusterInfo = std::make_shared<const SimpleClusterInformation>(
_node_ctx.node_index(),
_active_state_bundle,
- _op_ctx.storage_node_up_states());
+ storage_node_up_states());
_pending_cluster_state = PendingClusterState::createForDistributionChange(
_node_ctx.clock(),
std::move(clusterInfo),
@@ -246,7 +246,7 @@ BucketDBUpdater::onSetSystemState(
auto clusterInfo = std::make_shared<const SimpleClusterInformation>(
_node_ctx.node_index(),
_active_state_bundle,
- _op_ctx.storage_node_up_states());
+ storage_node_up_states());
_pending_cluster_state = PendingClusterState::createForClusterStateChange(
_node_ctx.clock(),
std::move(clusterInfo),
diff --git a/storage/src/vespa/storage/distributor/distributor_component.h b/storage/src/vespa/storage/distributor/distributor_component.h
index dabc927aa00..e01efeddf3f 100644
--- a/storage/src/vespa/storage/distributor/distributor_component.h
+++ b/storage/src/vespa/storage/distributor/distributor_component.h
@@ -61,10 +61,7 @@ public:
const storage::DistributorConfiguration& distributor_config() const noexcept override {
return _distributor.config();
}
- const char* storage_node_up_states() const override {
- // TODO STRIPE: Move to a common place.
- return "uri";
- }
+
};
diff --git a/storage/src/vespa/storage/distributor/distributor_operation_context.h b/storage/src/vespa/storage/distributor/distributor_operation_context.h
index 470a2f0f788..aa598835cdb 100644
--- a/storage/src/vespa/storage/distributor/distributor_operation_context.h
+++ b/storage/src/vespa/storage/distributor/distributor_operation_context.h
@@ -2,6 +2,7 @@
#pragma once
+#include "storage_node_up_states.h"
#include <vespa/storageapi/defs.h>
namespace storage { class DistributorConfiguration; }
@@ -24,9 +25,6 @@ public:
virtual const DistributorBucketSpaceRepo& read_only_bucket_space_repo() const noexcept = 0;
virtual DistributorBucketSpaceRepo& read_only_bucket_space_repo() noexcept = 0;
virtual const DistributorConfiguration& distributor_config() const noexcept = 0;
-
- // TODO STRIPE: Move to a common place.
- virtual const char* storage_node_up_states() const = 0;
};
}
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.cpp b/storage/src/vespa/storage/distributor/distributor_stripe.cpp
index 03f3a181a48..1f6a5b318fd 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_stripe.cpp
@@ -295,7 +295,7 @@ DistributorStripe::enableClusterStateBundle(const lib::ClusterStateBundle& state
const uint16_t new_node_count = baseline_state.getNodeCount(lib::NodeType::STORAGE);
for (uint16_t i = 0; i < std::max(old_node_count, new_node_count); ++i) {
const auto& node_state = baseline_state.getNodeState(lib::Node(lib::NodeType::STORAGE, i)).getState();
- if (!node_state.oneOf(getStorageNodeUpStates())) {
+ if (!node_state.oneOf(storage_node_up_states())) {
std::vector<uint64_t> msgIds = _pendingMessageTracker.clearMessagesForNode(i);
LOG(debug, "Node %u is down, clearing %zu pending maintenance operations", i, msgIds.size());
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.h b/storage/src/vespa/storage/distributor/distributor_stripe.h
index 1885fa79341..7b34367cecb 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe.h
+++ b/storage/src/vespa/storage/distributor/distributor_stripe.h
@@ -133,14 +133,6 @@ public:
const lib::ClusterStateBundle& getClusterStateBundle() const override;
/**
- * @return Returns the states in which the distributors consider
- * storage nodes to be up.
- */
- const char* getStorageNodeUpStates() const override {
- return "uri";
- }
-
- /**
* Called by bucket db updater after a merge has finished, and all the
* request bucket info operations have been performed as well. Passes the
* merge back to the operation that created it.
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
index 8302e0d9684..59029dec66a 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
@@ -49,7 +49,7 @@ DistributorStripeComponent::enumerateUnavailableNodes(
const document::Bucket& bucket,
const std::vector<BucketCopy>& candidates) const
{
- const auto* up_states = _distributor.getStorageNodeUpStates();
+ const auto* up_states = storage_node_up_states();
for (uint32_t i = 0; i < candidates.size(); ++i) {
const BucketCopy& copy(candidates[i]);
const lib::NodeState& ns(
@@ -273,7 +273,7 @@ DistributorStripeComponent::storage_node_is_up(document::BucketSpace bucket_spac
const lib::NodeState& ns = cluster_state_bundle().getDerivedClusterState(bucket_space)->getNodeState(
lib::Node(lib::NodeType::STORAGE, node_index));
- return ns.getState().oneOf(_distributor.getStorageNodeUpStates());
+ return ns.getState().oneOf(storage_node_up_states());
}
std::unique_ptr<document::select::Node>
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.h b/storage/src/vespa/storage/distributor/distributor_stripe_component.h
index 38fcb4ffef3..48aef90be8a 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_component.h
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.h
@@ -158,10 +158,6 @@ public:
*/
bool storage_node_is_up(document::BucketSpace bucket_space, uint32_t node_index) const override;
- const char* storage_node_up_states() const override {
- return getDistributor().getStorageNodeUpStates();
- }
-
// 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_interface.h b/storage/src/vespa/storage/distributor/distributor_stripe_interface.h
index 2f0b74c8a30..bd9a4e1de57 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_interface.h
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_interface.h
@@ -59,7 +59,6 @@ public:
*/
virtual bool initializing() const = 0;
virtual void handleCompletedMerge(const std::shared_ptr<api::MergeBucketReply>&) = 0;
- virtual const char* getStorageNodeUpStates() const = 0;
virtual const DistributorConfiguration& getConfig() const = 0;
virtual ChainedMessageSender& getMessageSender() = 0;
virtual const BucketGcTimeCalculator::BucketIdHasher& getBucketIdHasher() const = 0;
diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
index 1bf81278918..111400f176a 100644
--- a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp
@@ -156,7 +156,7 @@ bool PutOperation::has_unavailable_targets_in_pending_state(const OperationTarge
if (!pending_state) {
return false;
}
- const char* up_states = _op_ctx.storage_node_up_states();
+ const char* up_states = storage_node_up_states();
return std::any_of(targets.begin(), targets.end(), [pending_state, up_states](const auto& target){
return !pending_state->getNodeState(target.getNode()).getState().oneOf(up_states);
});
@@ -176,7 +176,7 @@ PutOperation::onStart(DistributorStripeMessageSender& sender)
bool up = false;
for (uint16_t i = 0; i < systemState.getNodeCount(lib::NodeType::STORAGE); i++) {
if (systemState.getNodeState(lib::Node(lib::NodeType::STORAGE, i))
- .getState().oneOf(_op_ctx.storage_node_up_states()))
+ .getState().oneOf(storage_node_up_states()))
{
up = true;
}
diff --git a/storage/src/vespa/storage/distributor/storage_node_up_states.h b/storage/src/vespa/storage/distributor/storage_node_up_states.h
new file mode 100644
index 00000000000..b159f012421
--- /dev/null
+++ b/storage/src/vespa/storage/distributor/storage_node_up_states.h
@@ -0,0 +1,14 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+namespace storage::distributor {
+
+/**
+ * Returns the states in which the distributors consider storage nodes to be up.
+ */
+constexpr const char* storage_node_up_states() {
+ return "uri";
+}
+
+}
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 61ff11d5ac3..8c24effa616 100644
--- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp
+++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp
@@ -225,7 +225,7 @@ StripeBucketDBUpdater::removeSuperfluousBuckets(
{
assert(_use_legacy_mode);
const bool move_to_read_only_db = shouldDeferStateEnabling();
- const char* up_states = _op_ctx.storage_node_up_states();
+ const char* up_states = storage_node_up_states();
for (auto& elem : _op_ctx.bucket_space_repo()) {
const auto& newDistribution(elem.second->getDistribution());
const auto& oldClusterState(elem.second->getClusterState());
@@ -273,7 +273,7 @@ StripeBucketDBUpdater::remove_superfluous_buckets(
assert(!_use_legacy_mode);
(void)is_distribution_change; // TODO remove if not needed
const bool move_to_read_only_db = shouldDeferStateEnabling();
- const char* up_states = _op_ctx.storage_node_up_states();
+ const char* up_states = storage_node_up_states();
auto& s = _op_ctx.bucket_space_repo().get(bucket_space);
const auto& new_distribution = s.getDistribution();
@@ -377,7 +377,7 @@ StripeBucketDBUpdater::storageDistributionChanged()
auto clusterInfo = std::make_shared<const SimpleClusterInformation>(
_node_ctx.node_index(),
_op_ctx.cluster_state_bundle(),
- _op_ctx.storage_node_up_states());
+ storage_node_up_states());
_pendingClusterState = PendingClusterState::createForDistributionChange(
_node_ctx.clock(),
std::move(clusterInfo),
@@ -489,7 +489,7 @@ StripeBucketDBUpdater::onSetSystemState(
auto clusterInfo = std::make_shared<const SimpleClusterInformation>(
_node_ctx.node_index(),
_op_ctx.cluster_state_bundle(),
- _op_ctx.storage_node_up_states());
+ storage_node_up_states());
_pendingClusterState = PendingClusterState::createForClusterStateChange(
_node_ctx.clock(),
std::move(clusterInfo),