This is an automated email from the ASF dual-hosted git repository.
DomGarguilo pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 2b2c3c8daa Fail fast in MAC start() when instance is already prepared
for upgrade (#6602)
2b2c3c8daa is described below
commit 2b2c3c8daa4cb9d10115157164aad3b8c02fad9c
Author: Dom G. <[email protected]>
AuthorDate: Tue Oct 20 10:30:21 2026 -0400
Fail fast in MAC start() when instance is already prepared for upgrade
(#6602)
---
.../accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java | 10 ++++++++--
.../org/apache/accumulo/test/upgrade/UpgradeUtilIT.java | 14 ++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
index 5aa6601ce4..6e5af2ad17 100644
---
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@ -613,19 +613,25 @@ public class MiniAccumuloClusterImpl implements
AccumuloCluster {
log.info("Starting MAC against instance {} and zookeeper(s) {}.",
config.getInstanceName(),
config.getZooKeepers());
- control.start(ServerType.TABLET_SERVER);
-
try (var reservation = SingletonManager.getClientReservation()) {
var zrw = new ZooReaderWriter(getSiteConfiguration());
String instanceNamePath =
Constants.ZROOT + Constants.ZINSTANCES + "/" +
config.getInstanceName();
byte[] bytes = zrw.getData(instanceNamePath);
InstanceId iid = InstanceId.of(new String(bytes, UTF_8));
+
+ // fail fast before starting servers - they'll fail to start if this
node exists already
+ final String upgradePrepNode = ZooUtil.getRoot(iid) +
Constants.ZPREPARE_FOR_UPGRADE;
+ if (zrw.exists(upgradePrepNode)) {
+ throw new IllegalStateException(
+ "Cannot start, instance is prepared for upgrade: " +
upgradePrepNode + " exists");
+ }
SetGoalState.setGoalState(zrw, ZooUtil.getRoot(iid),
ManagerGoalState.NORMAL);
} catch (KeeperException e) {
throw new IllegalStateException("Could not set manager goal state", e);
}
+ control.start(ServerType.TABLET_SERVER);
control.start(ServerType.MANAGER);
control.start(ServerType.GARBAGE_COLLECTOR);
diff --git
a/test/src/main/java/org/apache/accumulo/test/upgrade/UpgradeUtilIT.java
b/test/src/main/java/org/apache/accumulo/test/upgrade/UpgradeUtilIT.java
index 89671ff24f..a735b29394 100644
--- a/test/src/main/java/org/apache/accumulo/test/upgrade/UpgradeUtilIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/upgrade/UpgradeUtilIT.java
@@ -99,4 +99,18 @@ public class UpgradeUtilIT extends AccumuloClusterHarness {
}
+ @Test
+ public void testStartWhenAlreadyPrepared() throws Exception {
+ ServerContext ctx = getCluster().getServerContext();
+
+ ctx.getZooReaderWriter().putPersistentData(
+ ctx.getZooKeeperRoot() + Constants.ZPREPARE_FOR_UPGRADE, new byte[0],
+ NodeExistsPolicy.SKIP);
+
+ getCluster().stop();
+ IllegalStateException ise = assertThrows(IllegalStateException.class,
getCluster()::start);
+ assertTrue(ise.getMessage().startsWith("Cannot start, instance is prepared
for upgrade"));
+
+ }
+
}