LuciferYang commented on code in PR #8927:
URL: https://github.com/apache/hadoop/pull/8927#discussion_r4572866472
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java:
##########
@@ -2298,17 +2299,17 @@ private static void checkDependencies(Path qualSrc,
Path qualDst)
}
/**
- * Are qualSrc and qualDst of the same file system?
+ * Are qualPath1 and qualPath2 on the same file system, i.e. do they have
+ * the same scheme and authority?
* @param qualPath1 - fully qualified path
* @param qualPath2 - fully qualified path
- * @return is same fs true,not false.
+ * @return true if the two paths are on the same file system, else false.
*/
private static boolean isSameFS(Path qualPath1, Path qualPath2) {
URI srcUri = qualPath1.toUri();
URI dstUri = qualPath2.toUri();
- return (srcUri.getScheme().equals(dstUri.getScheme()) &&
- !(srcUri.getAuthority() != null && dstUri.getAuthority() != null &&
srcUri
- .getAuthority().equals(dstUri.getAuthority())));
+ return srcUri.getScheme().equals(dstUri.getScheme())
+ && Objects.equals(srcUri.getAuthority(), dstUri.getAuthority());
Review Comment:
Fixed. `isSameFS` now asks the file system that serves the source to
`checkPath()` the destination, so a host in a different case or an omitted
default port counts as the same file system. The self/subdirectory check
compares only the URI paths. Added tests for `hdfs://nn/a/b` and
`hdfs://NN:8020/a/b`; both failed before the change.
--
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]