sadanand48 commented on code in PR #4478:
URL: https://github.com/apache/ozone/pull/4478#discussion_r1152833154


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -430,8 +430,14 @@ private boolean renameFSO(OzoneBucket bucket,
     // construct src and dst key paths
     String srcKeyPath = srcPath.getNonKeyPathNoPrefixDelim() +
         OZONE_URI_DELIMITER + srcPath.getKeyName();
-    String dstKeyPath = dstPath.getNonKeyPathNoPrefixDelim() +
-        OZONE_URI_DELIMITER + dstPath.getKeyName();
+    String dstKeyPath;
+    if (dstPath.isBucket()) {
+      dstKeyPath = dstPath.getNonKeyPathNoPrefixDelim() +
+          OZONE_URI_DELIMITER + srcPath.getFileName();
+    } else {
+      dstKeyPath = dstPath.getNonKeyPathNoPrefixDelim() +
+          OZONE_URI_DELIMITER + dstPath.getKeyName();

Review Comment:
   >  For OMKeyRenamRequest, we should not allow empty key name, that part is 
ok. Only for OMKeyRenameRequestWithFSO, can remove toKeyName.length() == 0 check
   
   preExecute behaviour is common for both FSO and non-FSO request types. In 
this case we would need to add a separate preExecute method for FSO to overcome 
this check. Also for Non-FSO renames it is the client who handles this part to 
reset the `toKeyName` if empty.   I think it is better to keep the behaviour 
consistent across bucket types . OM should only care about renaming a valid 
source to a valid dest key and not worry about the paths, This is just my 
opinion.
   



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

Reply via email to