HDFS-14721. RBF: ProxyOpComplete is not accurate in FederationRPCPerformanceMonitor. Contributed by xuzq.
This commit is contained in:
parent
8c0759d02a
commit
8e779a151e
@ -432,8 +432,11 @@ private Object invokeMethod(
|
|||||||
if (this.rpcMonitor != null) {
|
if (this.rpcMonitor != null) {
|
||||||
this.rpcMonitor.proxyOpComplete(true);
|
this.rpcMonitor.proxyOpComplete(true);
|
||||||
}
|
}
|
||||||
|
RemoteException re = (RemoteException) ioe;
|
||||||
|
ioe = re.unwrapRemoteException();
|
||||||
|
ioe = getCleanException(ioe);
|
||||||
// RemoteException returned by NN
|
// RemoteException returned by NN
|
||||||
throw (RemoteException) ioe;
|
throw ioe;
|
||||||
} else if (ioe instanceof ConnectionNullException) {
|
} else if (ioe instanceof ConnectionNullException) {
|
||||||
if (this.rpcMonitor != null) {
|
if (this.rpcMonitor != null) {
|
||||||
this.rpcMonitor.proxyOpFailureCommunicate();
|
this.rpcMonitor.proxyOpFailureCommunicate();
|
||||||
@ -553,11 +556,6 @@ private Object invoke(String nsId, int retryCount, final Method method,
|
|||||||
throw new StandbyException(ioe.getMessage());
|
throw new StandbyException(ioe.getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ioe instanceof RemoteException) {
|
|
||||||
RemoteException re = (RemoteException) ioe;
|
|
||||||
ioe = re.unwrapRemoteException();
|
|
||||||
ioe = getCleanException(ioe);
|
|
||||||
}
|
|
||||||
throw ioe;
|
throw ioe;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,6 +188,31 @@ private void testListing(String path) throws IOException {
|
|||||||
requiredPaths.size(), partialListing.length);
|
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
|
@Override
|
||||||
public void testProxyListFiles() throws IOException, InterruptedException,
|
public void testProxyListFiles() throws IOException, InterruptedException,
|
||||||
URISyntaxException, NoSuchMethodException, SecurityException {
|
URISyntaxException, NoSuchMethodException, SecurityException {
|
||||||
|
Loading…
Reference in New Issue
Block a user