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 38360f5162 Avoid putting the MAC JVM in server mode when setting goal 
state (#6590)
38360f5162 is described below

commit 38360f51621fdd609e38a6712b4efa2dc8f66c3b
Author: Dom G. <[email protected]>
AuthorDate: Fri Oct 16 09:59:47 2026 -0400

    Avoid putting the MAC JVM in server mode when setting goal state (#6590)
---
 .../accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java      | 10 ++++++++--
 .../java/org/apache/accumulo/manager/state/SetGoalState.java   | 10 +++++-----
 2 files changed, 13 insertions(+), 7 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 fc9d86ec63..5aa6601ce4 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@ -80,6 +80,7 @@ import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
 import org.apache.accumulo.core.manager.thrift.ManagerGoalState;
 import org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo;
 import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
+import org.apache.accumulo.core.singletons.SingletonManager;
 import org.apache.accumulo.core.trace.TraceUtil;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.Timer;
@@ -614,8 +615,13 @@ public class MiniAccumuloClusterImpl implements 
AccumuloCluster {
 
     control.start(ServerType.TABLET_SERVER);
 
-    try {
-      SetGoalState.setGoalState(getServerContext(), ManagerGoalState.NORMAL);
+    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));
+      SetGoalState.setGoalState(zrw, ZooUtil.getRoot(iid), 
ManagerGoalState.NORMAL);
     } catch (KeeperException e) {
       throw new IllegalStateException("Could not set manager goal state", e);
     }
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
index a044f3f950..216451901a 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
@@ -22,6 +22,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.core.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.manager.thrift.ManagerGoalState;
 import org.apache.accumulo.core.singletons.SingletonManager;
@@ -56,7 +57,7 @@ public class SetGoalState {
       var context = new ServerContext(siteConfig);
       RenameMasterDirInZK.renameMasterDirInZK(context);
       context.waitForZookeeperAndHdfs();
-      setGoalState(context, targetGoalState);
+      setGoalState(context.getZooReaderWriter(), context.getZooKeeperRoot(), 
targetGoalState);
     } finally {
       SingletonManager.setMode(Mode.CLOSED);
     }
@@ -65,10 +66,9 @@ public class SetGoalState {
   /**
    * Writes the manager goal state to ZooKeeper, overwriting the current value.
    */
-  public static void setGoalState(ServerContext context, ManagerGoalState 
targetGoalState)
-      throws KeeperException, InterruptedException {
-    context.getZooReaderWriter().putPersistentData(
-        context.getZooKeeperRoot() + Constants.ZMANAGER_GOAL_STATE,
+  public static void setGoalState(ZooReaderWriter zrw, String zkRoot,
+      ManagerGoalState targetGoalState) throws KeeperException, 
InterruptedException {
+    zrw.putPersistentData(zkRoot + Constants.ZMANAGER_GOAL_STATE,
         targetGoalState.name().getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
   }
 

Reply via email to