summaryrefslogtreecommitdiffstats
path: root/persistence/src/tests/spi/clusterstatetest.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2021-11-23 15:46:19 +0000
committerTor Brede Vekterli <vekterli@yahooinc.com>2021-11-23 15:46:19 +0000
commit3d31f8967fc8970835b14a615f393ec4acda3394 (patch)
treefd9091e27653b6775a26680f25a13bb867748709 /persistence/src/tests/spi/clusterstatetest.cpp
parent85af738b99995cc04e87e45983a3c333f1274728 (diff)
Handle case where bucket spaces have differing maintenance state for a node
Only skip deactivating buckets if the entire _node_ is marked as maintenance state, i.e. the node has maintenance state across all bucket spaces provided in the bundle. Otherwise treat the state transition as if the node goes down, deactivating all buckets. Also ensure that the bucket deactivation logic above the SPI is identical to that within Proton. This avoids bucket DBs getting out of sync between the two.
Diffstat (limited to 'persistence/src/tests/spi/clusterstatetest.cpp')
-rw-r--r--persistence/src/tests/spi/clusterstatetest.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp
index 9f7507c992b..ac67903244f 100644
--- a/persistence/src/tests/spi/clusterstatetest.cpp
+++ b/persistence/src/tests/spi/clusterstatetest.cpp
@@ -238,26 +238,26 @@ namespace {
bool
node_marked_as_maintenance_in_state(const std::string& stateStr,
const lib::Distribution& d,
- uint16_t node)
+ uint16_t node,
+ bool maintenance_in_all_spaces)
{
lib::ClusterState s(stateStr);
- ClusterState state(s, node, d);
+ ClusterState state(s, node, d, maintenance_in_all_spaces);
return state.nodeMaintenance();
}
}
-TEST(ClusterStateTest, can_infer_own_node_maintenance_state)
+// We want to track the maintenance state for the _node_, not just the _bucket space_.
+TEST(ClusterStateTest, node_maintenance_state_is_set_independent_of_bucket_space_state_string)
{
lib::Distribution d(lib::Distribution::getDefaultDistributionConfig(3, 3));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3", d, 0));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:i", d, 0));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:d", d, 0));
- EXPECT_TRUE( node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:m", d, 0));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:r", d, 0));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:m", d, 1));
- EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .1.s:m", d, 0));
+ // Note: it doesn't actually matter what the cluster state string itself says here
+ EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3", d, 0, false));
+ EXPECT_TRUE(node_marked_as_maintenance_in_state("distributor:3 storage:3", d, 0, true));
+ EXPECT_TRUE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:d", d, 0, true));
+ EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:m", d, 0, false));
}
}