This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 3f9b0c6597aee49934a850995cccc4322cd2430e Merge: 12530c71da 6636feab60 Author: Christopher Tubbs <ctubb...@apache.org> AuthorDate: Tue Jan 14 15:24:13 2025 -0500 Merge branch '3.1' .../java/org/apache/accumulo/core/lock/ServiceLockSupport.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/lock/ServiceLockSupport.java index eb70d8e84c,3129511b5e..dda14f50c0 --- a/core/src/main/java/org/apache/accumulo/core/lock/ServiceLockSupport.java +++ b/core/src/main/java/org/apache/accumulo/core/lock/ServiceLockSupport.java @@@ -36,30 -31,6 +36,27 @@@ import org.slf4j.LoggerFactory public class ServiceLockSupport { + private static final Logger LOG = LoggerFactory.getLogger(ServiceLockSupport.class); + + /** + * Ensures that the resource group node in ZooKeeper is created for this server + */ + public static void createNonHaServiceLockPath(Type server, ZooReaderWriter zrw, + ServiceLockPath slp) throws KeeperException, InterruptedException { + // The ServiceLockPath contains a resource group in the path which is not created + // at initialization time. If it does not exist, then create it. + String rgPath = slp.toString().substring(0, slp.toString().lastIndexOf("/" + slp.getServer())); + LOG.debug("Creating {} resource group path in zookeeper: {}", server, rgPath); + try { + zrw.mkdirs(rgPath); + zrw.putPersistentData(slp.toString(), new byte[] {}, NodeExistsPolicy.SKIP); - } catch (KeeperException e) { - if (e.code() == KeeperException.Code.NOAUTH) { - LOG.error("Failed to write to ZooKeeper. Ensure that" - + " accumulo.properties, specifically instance.secret, is consistent."); - } ++ } catch (NoAuthException e) { ++ LOG.error("Failed to write to ZooKeeper. Ensure that" ++ + " accumulo.properties, specifically instance.secret, is consistent."); + throw e; + } - + } + /** * Lock Watcher used by Highly Available services. These are services where only instance is * running at a time, but another backup service can be started that will be used if the active