fengnanli commented on a change in pull request #2605:
URL: https://github.com/apache/hadoop/pull/2605#discussion_r557629878
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterWebHdfsMethods.java
##########
@@ -453,21 +456,25 @@ private DatanodeInfo chooseDatanode(final Router router,
final String path, final HttpOpParam.Op op, final long openOffset,
final String excludeDatanodes) throws IOException {
final RouterRpcServer rpcServer = getRPCServer(router);
- DatanodeInfo[] dns = null;
+ DatanodeInfo[] dns = {};
+ String resolvedNs = "";
try {
dns = rpcServer.getCachedDatanodeReport(DatanodeReportType.LIVE);
+ // for simplicity, just take the first remote location to create the file
+ resolvedNs = rpcServer.getLocationsForPath(path, true)
+ .get(0).getNameserviceId();
Review comment:
Thanks for the review @ayushtkn
For 1, I agree that use `getFileInfo` is more accurate so I add another
filter to limit only CREATE will apply the resolvedNS.
For 2, the first one should be enough since it is the destination with the
highest priority based on the destination order.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]