This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 56b97faff8 Fixed Manager hostname in ServiceLockData (#5306)
56b97faff8 is described below

commit 56b97faff817aa6cee5cdb812ce1b381c2c86061
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Wed Feb 5 10:35:17 2025 -0500

    Fixed Manager hostname in ServiceLockData (#5306)
    
    The changes in #5012 included a new addition to the server
    processes where they call setHostname(). In the Manager
    process this was done too early causing an invalid address
    being put into the ServiceLockData for the Manager.
---
 .../src/main/java/org/apache/accumulo/manager/Manager.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java 
b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
index d659dd2884..3cd671ce7d 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
@@ -1148,7 +1148,6 @@ public class Manager extends AbstractServer
       throw new IllegalStateException("Unable to start server on host " + 
getHostname(), e);
     }
     clientService = sa.server;
-    setHostname(sa.address);
     log.info("Started Manager client service at {}", sa.address);
 
     // block until we can obtain the ZK lock for the manager
@@ -1159,6 +1158,11 @@ public class Manager extends AbstractServer
       throw new IllegalStateException("Exception getting manager lock", e);
     }
 
+    // Set the HostName **after** initially creating the lock. The lock data is
+    // updated below with the correct address. This prevents clients from 
accessing
+    // the Manager until all of the internal processes are started.
+    setHostname(sa.address);
+
     MetricsInfo metricsInfo = getContext().getMetricsInfo();
     ManagerMetrics managerMetrics = new ManagerMetrics(getConfiguration(), 
this);
     var producers = managerMetrics.getProducers(getConfiguration(), this);
@@ -1314,12 +1318,12 @@ public class Manager extends AbstractServer
       log.info("AuthenticationTokenSecretManager is initialized");
     }
 
-    String address = sa.address.toString();
     UUID uuid = sld.getServerUUID(ThriftService.MANAGER);
     ServiceDescriptors descriptors = new ServiceDescriptors();
     for (ThriftService svc : new ThriftService[] {ThriftService.MANAGER, 
ThriftService.COORDINATOR,
         ThriftService.FATE}) {
-      descriptors.addService(new ServiceDescriptor(uuid, svc, address, 
this.getResourceGroup()));
+      descriptors
+          .addService(new ServiceDescriptor(uuid, svc, getHostname(), 
this.getResourceGroup()));
     }
 
     sld = new ServiceLockData(descriptors);

Reply via email to