You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by he...@apache.org on 2022/05/24 15:48:04 UTC
[hadoop] branch branch-3.3 updated: HDFS-16588. Backport HDFS-16584 to branch-3.3. (#4342). Contributed by JiangHua Zhu.
This is an automated email from the ASF dual-hosted git repository.
hexiaoqiao pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new fe6b0508578 HDFS-16588. Backport HDFS-16584 to branch-3.3. (#4342). Contributed by JiangHua Zhu.
fe6b0508578 is described below
commit fe6b050857896b20181afc6ff464c4947d0522cd
Author: jianghuazhu <74...@qq.com>
AuthorDate: Tue May 24 23:47:45 2022 +0800
HDFS-16588. Backport HDFS-16584 to branch-3.3. (#4342). Contributed by JiangHua Zhu.
Signed-off-by: litao <to...@gmail.com>
Signed-off-by: He Xiaoqiao <he...@apache.org>
---
.../org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java | 8 ++++++--
.../hadoop/hdfs/server/balancer/TestBalancerWithHANameNodes.java | 5 ++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java
index 7f54c63303c..4e2079298d4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java
@@ -21,6 +21,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
@@ -255,6 +256,7 @@ public class NameNodeConnector implements Closeable {
}
boolean isRequestStandby = false;
NamenodeProtocol nnproxy = null;
+ InetSocketAddress standbyAddress = null;
try {
if (requestToStandby && nsId != null
&& HAUtil.isHAEnabled(config, nsId)) {
@@ -264,8 +266,9 @@ public class NameNodeConnector implements Closeable {
try {
if (proxy.getHAServiceState().equals(
HAServiceProtocol.HAServiceState.STANDBY)) {
+ standbyAddress = RPC.getServerAddress(proxy);
NamenodeProtocol sbn = NameNodeProxies.createNonHAProxy(
- config, RPC.getServerAddress(proxy), NamenodeProtocol.class,
+ config, standbyAddress, NamenodeProtocol.class,
UserGroupInformation.getCurrentUser(), false).getProxy();
nnproxy = sbn;
isRequestStandby = true;
@@ -287,7 +290,8 @@ public class NameNodeConnector implements Closeable {
return nnproxy.getBlocks(datanode, size, minBlockSize);
} finally {
if (isRequestStandby) {
- LOG.info("Request #getBlocks to Standby NameNode success.");
+ LOG.info("Request #getBlocks to Standby NameNode success. " +
+ "remoteAddress: {}", standbyAddress.getHostString());
}
}
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerWithHANameNodes.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerWithHANameNodes.java
index 8241f25e4af..cdfa76a9d1f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerWithHANameNodes.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerWithHANameNodes.java
@@ -199,13 +199,16 @@ public class TestBalancerWithHANameNodes {
try {
cluster.waitActive();
cluster.transitionToActive(0);
+ String standbyNameNode = cluster.getNameNode(1).
+ getNameNodeAddress().getHostString();
Thread.sleep(500);
client = NameNodeProxies.createProxy(conf, FileSystem.getDefaultUri(conf),
ClientProtocol.class).getProxy();
doTest(conf);
// Check getBlocks request to Standby NameNode.
assertTrue(log.getOutput().contains(
- "Request #getBlocks to Standby NameNode success."));
+ "Request #getBlocks to Standby NameNode success. remoteAddress: " +
+ standbyNameNode));
} finally {
cluster.shutdown();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org