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 za...@apache.org on 2026/10/14 09:51:34 UTC
(hadoop) branch trunk updated: HDFS-17982. RBF should return StandbyException when no Active NameNode is known (#8760)
This is an automated email from the ASF dual-hosted git repository.
ZanderXu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new f41bb2ebdcf HDFS-17982. RBF should return StandbyException when no Active NameNode is known (#8760)
f41bb2ebdcf is described below
commit f41bb2ebdcf86937c7b732dec40dba48ddb40700
Author: CapMoon <49...@users.noreply.github.com>
AuthorDate: Wed Oct 14 17:51:24 2026 +0800
HDFS-17982. RBF should return StandbyException when no Active NameNode is known (#8760)
---
.../server/federation/router/RouterRpcClient.java | 3 ++-
.../router/async/TestRouterAsyncRpcClient.java | 27 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java
index d70e1d90477..9dbdb91e4f7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java
@@ -612,7 +612,8 @@ protected Object handlerAllNamenodeFail(
LOG.error("{} at {} error: \"{}\"", nnKey, addr, ioe.getMessage());
}
}
- if (exConnect == ioes.size()) {
+ // No RPC was attempted, so an empty exception map is not a connection failure.
+ if (!ioes.isEmpty() && exConnect == ioes.size()) {
throw new ConnectException(msg);
} else {
throw new StandbyException(msg);
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcClient.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcClient.java
index 5a304b31bd3..0d08b83cd7a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcClient.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcClient.java
@@ -29,6 +29,7 @@
import org.apache.hadoop.hdfs.server.federation.RouterConfigBuilder;
import org.apache.hadoop.hdfs.server.federation.metrics.FederationRPCMetrics;
import org.apache.hadoop.hdfs.server.federation.resolver.FederationNamenodeContext;
+import org.apache.hadoop.hdfs.server.federation.resolver.FederationNamenodeServiceState;
import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation;
import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys;
import org.apache.hadoop.hdfs.server.federation.router.RemoteMethod;
@@ -285,6 +286,32 @@ public void testInvokeMethod() throws Exception {
assertEquals(1, rpcMetrics.getProxyOpFailureCommunicate());
}
+ /**
+ * Verify StandbyException is returned when only Observer namenodes are
+ * available but Observer reads are disabled.
+ */
+ @Test
+ public void testInvokeMethodWithOnlyObserverNamenodes() throws Exception {
+ RemoteMethod method = new RemoteMethod("getFileInfo",
+ new Class<?>[] {String.class}, new RemoteParam());
+ UserGroupInformation ugi = RouterRpcServer.getRemoteUser();
+ List<? extends FederationNamenodeContext> namenodes =
+ asyncRpcClient.getOrderedNamenodes(ns0, false);
+ List<FederationNamenodeContext> observerNamenodes = new ArrayList<>();
+ for (FederationNamenodeContext namenode : namenodes) {
+ if (namenode.getState() == FederationNamenodeServiceState.OBSERVER) {
+ observerNamenodes.add(namenode);
+ }
+ }
+ assertEquals(1, observerNamenodes.size());
+
+ asyncRpcClient.invokeMethod(ugi, observerNamenodes, false,
+ method.getProtocol(), method.getMethod(), new String[]{testFile});
+ LambdaTestUtils.intercept(StandbyException.class,
+ "No namenode available to invoke getFileInfo",
+ () -> syncReturn(FileStatus.class));
+ }
+
/**
* Test the functionality of the asynchronous invokeSequential method.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org