This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new b4644ba8f45 fix: improve DataNode reachability check in
ensureNodeStatus (#17446)
b4644ba8f45 is described below
commit b4644ba8f4501b9d2a4736c81c20bcd63206e68f
Author: shuwenwei <[email protected]>
AuthorDate: Wed Apr 8 19:31:06 2026 +0800
fix: improve DataNode reachability check in ensureNodeStatus (#17446)
---
.../iotdb/it/env/cluster/env/AbstractEnv.java | 27 ++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/env/AbstractEnv.java
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/env/AbstractEnv.java
index 3fcbe897f75..0e7eefb3a41 100644
---
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/env/AbstractEnv.java
+++
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/env/AbstractEnv.java
@@ -70,7 +70,9 @@ import org.apache.iotdb.session.TableSessionBuilder;
import org.apache.iotdb.session.pool.SessionPool;
import org.apache.iotdb.session.pool.TableSessionPoolBuilder;
+import org.apache.thrift.TConfiguration;
import org.apache.thrift.TException;
+import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
@@ -1402,7 +1404,7 @@ public abstract class AbstractEnv implements BaseEnv {
@Override
public void ensureNodeStatus(
- final List<BaseNodeWrapper> nodes, final List<NodeStatus> targetStatus)
+ final List<BaseNodeWrapper> nodes, final List<NodeStatus>
targetStatusList)
throws IllegalStateException {
Throwable lastException = null;
for (int i = 0; i < retryCount; i++) {
@@ -1430,7 +1432,9 @@ public abstract class AbstractEnv implements BaseEnv {
+ node.getClientRpcEndPoint().getPort(),
node.getDataNodeId()));
for (int j = 0; j < nodes.size(); j++) {
- final String endpoint = nodes.get(j).getIpAndPortString();
+ BaseNodeWrapper nodeWrapper = nodes.get(j);
+ String ipAndPortString = nodeWrapper.getIpAndPortString();
+ final String endpoint = ipAndPortString;
if (!nodeIds.containsKey(endpoint)) {
// Node not exist
// Notice: Never modify this line, since the NodeLocation might be
modified in IT
@@ -1438,12 +1442,27 @@ public abstract class AbstractEnv implements BaseEnv {
continue;
}
final String status =
showClusterResp.getNodeStatus().get(nodeIds.get(endpoint));
- if (!targetStatus.get(j).getStatus().equals(status)) {
+ final NodeStatus targetStatus = targetStatusList.get(j);
+ if (!targetStatus.getStatus().equals(status)) {
// Error status
errorMessages.add(
String.format(
"Node %s is in status %s, but expected %s",
- endpoint, status, targetStatus.get(j)));
+ endpoint, status, targetStatusList.get(j)));
+ continue;
+ }
+ if (nodeWrapper instanceof DataNodeWrapper &&
targetStatus.equals(NodeStatus.Running)) {
+ final String[] ipPort =
nodeWrapper.getIpAndPortString().split(":");
+ final String ip = ipPort[0];
+ final int port = Integer.parseInt(ipPort[1]);
+ try (TSocket socket = new TSocket(new TConfiguration(), ip, port,
1000)) {
+ socket.open();
+ } catch (final TTransportException e) {
+ errorMessages.add(
+ String.format(
+ "DataNode %s is not reachable: %s",
+ nodeWrapper.getIpAndPortString(), e.getMessage()));
+ }
}
}
if (errorMessages.isEmpty()) {