ZanderXu commented on code in PR #4719:
URL: https://github.com/apache/hadoop/pull/4719#discussion_r944633782
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -935,19 +935,22 @@ public BatchedDirectoryListing getBatchedListing(String[]
srcs,
public HdfsFileStatus getFileInfo(String src) throws IOException {
rpcServer.checkOperation(NameNode.OperationCategory.READ);
- final List<RemoteLocation> locations =
- rpcServer.getLocationsForPath(src, false, false);
- RemoteMethod method = new RemoteMethod("getFileInfo",
- new Class<?>[] {String.class}, new RemoteParam());
-
HdfsFileStatus ret = null;
- // If it's a directory, we check in all locations
- if (rpcServer.isPathAll(src)) {
- ret = getFileInfoAll(locations, method);
- } else {
- // Check for file information sequentially
- ret = rpcClient.invokeSequential(
- locations, method, HdfsFileStatus.class, null);
+ IOException noLocationException = null;
+ try {
+ final List<RemoteLocation> locations =
rpcServer.getLocationsForPath(src, false, false);
+ RemoteMethod method = new RemoteMethod("getFileInfo",
+ new Class<?>[] {String.class}, new RemoteParam());
+
+ // If it's a directory, we check in all locations
+ if (rpcServer.isPathAll(src)) {
+ ret = getFileInfoAll(locations, method);
+ } else {
+ // Check for file information sequentially
+ ret = rpcClient.invokeSequential(locations, method,
HdfsFileStatus.class, null);
+ }
+ } catch (NoLocationException | RouterResolveException e) {
Review Comment:
Sorry, sir. `MountableResolver.class` may return one null response. So we
still need this NoLocationException.
```
private PathLocation buildLocation(
final String path, final MountTable entry) throws IOException {
String srcPath = entry.getSourcePath();
if (!path.startsWith(srcPath)) {
LOG.error("Cannot build location, {} not a child of {}", path,
srcPath);
return null;
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]