From 3d31f8967fc8970835b14a615f393ec4acda3394 Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Tue, 23 Nov 2021 15:46:19 +0000 Subject: 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. --- .../proton/documentdb/buckethandler/buckethandler_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp') diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp index 82410d28610..cadfa8cd72f 100644 --- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp @@ -281,6 +281,19 @@ TEST_F("node going from maintenance to up state deactivates all buckets", Fixtur EXPECT_FALSE(f._bucketInfo.getInfo().isActive()); } +TEST_F("node going from maintenance to down state deactivates all buckets", Fixture) +{ + f._handler.handleSetCurrentState(f._ready.bucket(2), + BucketInfo::ACTIVE, f._genResult); + f.sync(); + f.setNodeMaintenance(true); + f.sync(); + f.setNodeUp(false); + f.sync(); + f.handleGetBucketInfo(f._ready.bucket(2)); + EXPECT_FALSE(f._bucketInfo.getInfo().isActive()); +} + TEST_MAIN() { TEST_RUN_ALL(); -- cgit v1.2.3