[NO ISSUE][NET] Utilize unresolved NC reg address
Follow on change to https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/4643
which correctly consumes the unresolved NC registration addresses
made available in the previous change.
Change-Id: I316a37cc92da2f4bbb8990a3f0a43dd36095c47f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/4683
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/comm/NetworkAddress.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/comm/NetworkAddress.java
index 4fad59a..d74f500 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/comm/NetworkAddress.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/comm/NetworkAddress.java
@@ -33,7 +33,9 @@
private String address;
// Cached locally, not serialized
- private byte[] ipAddress;
+ private volatile byte[] ipAddress;
+ // Cached locally, not serialized
+ private volatile InetSocketAddress inetSocketAddress;
private int port;
@@ -73,6 +75,13 @@
return ipAddress;
}
+ public InetSocketAddress resolveInetSocketAddress() {
+ if (inetSocketAddress == null) {
+ inetSocketAddress = new InetSocketAddress(address, port);
+ }
+ return inetSocketAddress;
+ }
+
public int getPort() {
return port;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
index fe33bc9..bb0684f 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/RegisterNodeWork.java
@@ -51,7 +51,7 @@
String id = reg.getNodeId();
LOGGER.info("registering node: {}", id);
NodeControllerRemoteProxy nc = new NodeControllerRemoteProxy(ccs.getCcId(),
- ccs.getClusterIPC().getReconnectingHandle(reg.getNodeControllerAddress()));
+ ccs.getClusterIPC().getReconnectingHandle(reg.getNodeControllerPort().resolveInetSocketAddress()));
INodeManager nodeManager = ccs.getNodeManager();
NodeParameters params = new NodeParameters();
params.setClusterControllerInfo(ccs.getClusterControllerInfo());
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
index bcf6d22..5f55513 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NodeRegistration.java
@@ -40,6 +40,7 @@
private static final Logger LOGGER = LogManager.getLogger();
+ @Deprecated
private InetSocketAddress ncAddress;
private NetworkAddress ncPort;
@@ -109,8 +110,8 @@
this.pid = PidHelper.getPid();
}
- public InetSocketAddress getNodeControllerAddress() {
- return ncAddress;
+ public NetworkAddress getNodeControllerPort() {
+ return ncPort;
}
public String getNodeId() {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
index 3c456dd..1ce97a1 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java
@@ -423,7 +423,7 @@
NodeParameters nodeParameters = ccc.getNodeParameters();
// Start heartbeat generator.
heartbeatManagers.computeIfAbsent(ccId, newCcId -> HeartbeatManager.init(this, ccc, hbTask.getHeartbeatData(),
- nodeRegistration.getNodeControllerAddress()));
+ nodeRegistration.getNodeControllerPort().resolveInetSocketAddress()));
if (!ccTimers.containsKey(ccId) && nodeParameters.getProfileDumpPeriod() > 0) {
Timer ccTimer = new Timer("Timer-" + ccId, true);
// Schedule profile dump generator.