aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2023-06-07 17:26:18 +0200
committerGitHub <noreply@github.com>2023-06-07 17:26:18 +0200
commit59c924d6ad51d19667c86afc072fa67e32066e6a (patch)
tree59f007fc1dbe4db83a562efabc7da3af0a07301b
parent7dd44d8bd4d0d6620151e4a4b80f96107f803c04 (diff)
parent86675148f8d1f915558e1958eb1e125eddfbd11d (diff)
Merge pull request #27335 from vespa-engine/vekterli/must-get-state-version-from-pending-state-if-presentv8.174.17
Check cluster state version in pending state, if present
-rw-r--r--storage/src/tests/distributor/check_condition_test.cpp15
-rw-r--r--storage/src/vespa/storage/distributor/distributor_stripe_component.cpp5
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/check_condition.cpp5
3 files changed, 22 insertions, 3 deletions
diff --git a/storage/src/tests/distributor/check_condition_test.cpp b/storage/src/tests/distributor/check_condition_test.cpp
index d355194ec0d..757a9329ea6 100644
--- a/storage/src/tests/distributor/check_condition_test.cpp
+++ b/storage/src/tests/distributor/check_condition_test.cpp
@@ -242,7 +242,20 @@ TEST_F(CheckConditionTest, check_fails_if_replica_set_changed_between_start_and_
});
}
-TEST_F(CheckConditionTest, check_fails_if_bucket_ownership_changed_between_start_and_completion) {
+TEST_F(CheckConditionTest, check_fails_if_bucket_ownership_changed_between_start_and_completion_pending_transition_case) {
+ test_cond_with_2_gets_sent([&](auto& cond) {
+ cond.handle_reply(_sender, make_matched_reply(0));
+ simulate_set_pending_cluster_state("version:2 storage:1 distributor:1 .0.s:d"); // technically, no distributors own anything
+ cond.handle_reply(_sender, make_matched_reply(1));
+ }, [&](auto& outcome) {
+ EXPECT_FALSE(outcome.matched_condition());
+ EXPECT_FALSE(outcome.not_found());
+ EXPECT_TRUE(outcome.failed());
+ EXPECT_EQ(outcome.error_code().getResult(), api::ReturnCode::BUCKET_NOT_FOUND);
+ });
+}
+
+TEST_F(CheckConditionTest, check_fails_if_bucket_ownership_changed_between_start_and_completion_completed_transition_case) {
test_cond_with_2_gets_sent([&](auto& cond) {
cond.handle_reply(_sender, make_matched_reply(0));
enable_cluster_state("version:2 storage:1 distributor:1 .0.s:d"); // technically, no distributors own anything
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
index b47e0697a91..9a5fd595b1d 100644
--- a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp
@@ -166,7 +166,10 @@ DistributorStripeComponent::update_bucket_database(
}
}
- UpdateBucketDatabaseProcessor processor(getClock(), found_down_node ? up_nodes : changed_nodes, bucketSpace.get_ideal_service_layer_nodes_bundle(bucket.getBucketId()).get_available_nodes(), (update_flags & DatabaseUpdate::RESET_TRUSTED) != 0);
+ UpdateBucketDatabaseProcessor processor(getClock(),
+ found_down_node ? up_nodes : changed_nodes,
+ bucketSpace.get_ideal_service_layer_nodes_bundle(bucket.getBucketId()).get_available_nodes(),
+ (update_flags & DatabaseUpdate::RESET_TRUSTED) != 0);
bucketSpace.getBucketDatabase().process_update(bucket.getBucketId(), processor, (update_flags & DatabaseUpdate::CREATE_IF_NONEXISTING) != 0);
}
diff --git a/storage/src/vespa/storage/distributor/operations/external/check_condition.cpp b/storage/src/vespa/storage/distributor/operations/external/check_condition.cpp
index c5f4788ec51..0e12e3e3019 100644
--- a/storage/src/vespa/storage/distributor/operations/external/check_condition.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/check_condition.cpp
@@ -163,7 +163,10 @@ void CheckCondition::handle_internal_get_operation_reply(std::shared_ptr<api::St
reply->steal_trace());
return;
}
- const auto state_version_now = _bucket_space.getClusterState().getVersion();
+ auto state_version_now = _bucket_space.getClusterState().getVersion();
+ if (_bucket_space.has_pending_cluster_state()) {
+ state_version_now = _bucket_space.get_pending_cluster_state().getVersion();
+ }
if ((state_version_now != _cluster_state_version_at_creation_time)
&& (replica_set_changed_after_get_operation()
|| distributor_no_longer_owns_bucket()))