liuml07 commented on a change in pull request #1861: HADOOP-13230. Optionally 
retain directory markers
URL: https://github.com/apache/hadoop/pull/1861#discussion_r410650058
 
 

 ##########
 File path: 
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
 ##########
 @@ -1411,10 +1440,13 @@ public boolean rename(Path src, Path dst) throws 
IOException {
       LOG.debug("rename: destination path {} not found", dst);
       // Parent must exist
       Path parent = dst.getParent();
-      if (!pathToKey(parent).isEmpty()) {
+      if (!pathToKey(parent).isEmpty()
+          && !parent.equals(src.getParent()) ) {
         try {
-          S3AFileStatus dstParentStatus = innerGetFileStatus(dst.getParent(),
-              false, StatusProbeEnum.ALL);
+          // only look against S3 for directories; saves
+          // a HEAD request on all normal operations.
+          S3AFileStatus dstParentStatus = innerGetFileStatus(parent,
+              false, StatusProbeEnum.DIRECTORIES);
 
 Review comment:
   We do not need to fallback to `StatusProbeEnum.FILE` because we know this 
`innerGetFileStatus` should not throw `FileNotFoundException` - at least dst 
should show in the listing. Is this correct?

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to