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 ay...@apache.org on 2019/08/29 14:49:20 UTC
[hadoop] branch trunk updated: HDFS-14721. RBF: ProxyOpComplete is
not accurate in FederationRPCPerformanceMonitor. Contributed by xuzq.
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena 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 8e779a1 HDFS-14721. RBF: ProxyOpComplete is not accurate in FederationRPCPerformanceMonitor. Contributed by xuzq.
8e779a1 is described below
commit 8e779a151e20528ceda1b5b44812412f4ae7f83d
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Thu Aug 29 20:08:38 2019 +0530
HDFS-14721. RBF: ProxyOpComplete is not accurate in FederationRPCPerformanceMonitor. Contributed by xuzq.
---
.../server/federation/router/RouterRpcClient.java | 10 ++++-----
.../router/TestRouterRpcMultiDestination.java | 25 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 6 deletions(-)
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 2996357..563f3d0 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
@@ -432,8 +432,11 @@ public class RouterRpcClient {
if (this.rpcMonitor != null) {
this.rpcMonitor.proxyOpComplete(true);
}
+ RemoteException re = (RemoteException) ioe;
+ ioe = re.unwrapRemoteException();
+ ioe = getCleanException(ioe);
// RemoteException returned by NN
- throw (RemoteException) ioe;
+ throw ioe;
} else if (ioe instanceof ConnectionNullException) {
if (this.rpcMonitor != null) {
this.rpcMonitor.proxyOpFailureCommunicate();
@@ -553,11 +556,6 @@ public class RouterRpcClient {
throw new StandbyException(ioe.getMessage());
}
} else {
- if (ioe instanceof RemoteException) {
- RemoteException re = (RemoteException) ioe;
- ioe = re.unwrapRemoteException();
- ioe = getCleanException(ioe);
- }
throw ioe;
}
} else {
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java
index 687e578..30a47a4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java
@@ -188,6 +188,31 @@ public class TestRouterRpcMultiDestination extends TestRouterRpc {
requiredPaths.size(), partialListing.length);
}
+ /**
+ * Verify the metric ProxyOp with RemoteException.
+ */
+ @Test
+ public void testProxyOpWithRemoteException() throws IOException {
+ final String testPath = "/proxy_op/remote_exception.txt";
+ final FederationRPCMetrics metrics = getRouterContext().
+ getRouter().getRpcServer().getRPCMetrics();
+ String ns1 = getCluster().getNameservices().get(1);
+ final FileSystem fileSystem1 = getCluster().
+ getNamenode(ns1, null).getFileSystem();
+
+ try {
+ // Create the test file in ns1.
+ createFile(fileSystem1, testPath, 32);
+
+ long beforeProxyOp = metrics.getProxyOps();
+ // First retry nn0 with remoteException then nn1.
+ getRouterProtocol().getBlockLocations(testPath, 0, 1);
+ assertEquals(2, metrics.getProxyOps() - beforeProxyOp);
+ } finally {
+ fileSystem1.delete(new Path(testPath), true);
+ }
+ }
+
@Override
public void testProxyListFiles() throws IOException, InterruptedException,
URISyntaxException, NoSuchMethodException, SecurityException {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org