This is an automated email from the ASF dual-hosted git repository.
czy006 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new fe49db5f9 [AMORO-3459][Improvement]: Obtain the master's service
address based on service discovery, which requires writing the HTTP port to
ZooKeeper (#3462)
fe49db5f9 is described below
commit fe49db5f91946b9fc1518ea55b931bde97bf31ba
Author: ConradJam <[email protected]>
AuthorDate: Sun Apr 27 09:55:27 2025 +0800
[AMORO-3459][Improvement]: Obtain the master's service address based on
service discovery, which requires writing the HTTP port to ZooKeeper (#3462)
[AMORO-3459][Improvement]: Obtain the master's service address based on
service discovery, which requires writing the HTTP port to ZooKeeper(#3459)
---
.../apache/amoro/server/HighAvailabilityContainer.java | 11 +++++++----
.../java/org/apache/amoro/client/AmsServerInfo.java | 18 +++++++++++++-----
.../org/apache/amoro/properties/AmsHAProperties.java | 2 +-
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
b/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
index 873370733..a758718a9 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
@@ -73,11 +73,13 @@ public class HighAvailabilityContainer implements
LeaderLatchListener {
this.tableServiceServerInfo =
buildServerInfo(
serviceConfig.getString(AmoroManagementConf.SERVER_EXPOSE_HOST),
-
serviceConfig.getInteger(AmoroManagementConf.TABLE_SERVICE_THRIFT_BIND_PORT));
+
serviceConfig.getInteger(AmoroManagementConf.TABLE_SERVICE_THRIFT_BIND_PORT),
+ serviceConfig.getInteger(AmoroManagementConf.HTTP_SERVER_PORT));
this.optimizingServiceServerInfo =
buildServerInfo(
serviceConfig.getString(AmoroManagementConf.SERVER_EXPOSE_HOST),
-
serviceConfig.getInteger(AmoroManagementConf.OPTIMIZING_SERVICE_THRIFT_BIND_PORT));
+
serviceConfig.getInteger(AmoroManagementConf.TABLE_SERVICE_THRIFT_BIND_PORT),
+ serviceConfig.getInteger(AmoroManagementConf.HTTP_SERVER_PORT));
} else {
leaderLatch = null;
zkClient = null;
@@ -148,10 +150,11 @@ public class HighAvailabilityContainer implements
LeaderLatchListener {
followerLath.countDown();
}
- private AmsServerInfo buildServerInfo(String host, int port) {
+ private AmsServerInfo buildServerInfo(String host, int thriftBindPort, int
restBindPort) {
AmsServerInfo amsServerInfo = new AmsServerInfo();
amsServerInfo.setHost(host);
- amsServerInfo.setThriftBindPort(port);
+ amsServerInfo.setRestBindPort(restBindPort);
+ amsServerInfo.setThriftBindPort(thriftBindPort);
return amsServerInfo;
}
diff --git
a/amoro-common/src/main/java/org/apache/amoro/client/AmsServerInfo.java
b/amoro-common/src/main/java/org/apache/amoro/client/AmsServerInfo.java
index 4039cd03d..727a3c2c9 100644
--- a/amoro-common/src/main/java/org/apache/amoro/client/AmsServerInfo.java
+++ b/amoro-common/src/main/java/org/apache/amoro/client/AmsServerInfo.java
@@ -22,6 +22,7 @@ import java.util.Objects;
public class AmsServerInfo {
private String host;
+ private Integer restBindPort;
private Integer thriftBindPort;
public String getHost() {
@@ -40,21 +41,28 @@ public class AmsServerInfo {
this.thriftBindPort = thriftBindPort;
}
+ public Integer getRestBindPort() {
+ return restBindPort;
+ }
+
+ public void setRestBindPort(Integer restBindPort) {
+ this.restBindPort = restBindPort;
+ }
+
@Override
public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
if (o == null || getClass() != o.getClass()) {
return false;
}
AmsServerInfo that = (AmsServerInfo) o;
- return Objects.equals(host, that.host) && Objects.equals(thriftBindPort,
that.thriftBindPort);
+ return Objects.equals(host, that.host)
+ && Objects.equals(restBindPort, that.restBindPort)
+ && Objects.equals(thriftBindPort, that.thriftBindPort);
}
@Override
public int hashCode() {
- return Objects.hash(host, thriftBindPort);
+ return Objects.hash(host, thriftBindPort, restBindPort);
}
@Override
diff --git
a/amoro-common/src/main/java/org/apache/amoro/properties/AmsHAProperties.java
b/amoro-common/src/main/java/org/apache/amoro/properties/AmsHAProperties.java
index 25d8368ca..e794b520d 100644
---
a/amoro-common/src/main/java/org/apache/amoro/properties/AmsHAProperties.java
+++
b/amoro-common/src/main/java/org/apache/amoro/properties/AmsHAProperties.java
@@ -21,7 +21,7 @@ package org.apache.amoro.properties;
import org.apache.amoro.shade.guava32.com.google.common.base.Strings;
public class AmsHAProperties {
- private static final String ROOT_PATH = "/arctic/ams";
+ private static final String ROOT_PATH = "/amoro/ams";
private static final String LEADER_PATH = "/leader";
private static final String TABLE_SERVICE_MASTER_PATH = "/master";
private static final String OPTIMIZING_SERVICE_MASTER_PATH =
"/optimizing-service-master";