chungen0126 commented on code in PR #11674:
URL: https://github.com/apache/ozone/pull/11674#discussion_r4358361190


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequest.java:
##########
@@ -76,6 +76,14 @@ public OMRequest preExecute(OzoneManager ozoneManager) 
throws IOException {
         .getRenameKeyRequest();
     Objects.requireNonNull(renameKeyRequest, "renameKeyRequest == null");
 
+    // Checked before Ratis only: preExecute does not run when the request is 
applied. The request was created for the
+    // link-resolved layout, and the OBJECT_STORE request class also serves 
LEGACY, so test the layout itself.
+    if (renameKeyRequest.getRequireFileSystemOptimized() && 
!getBucketLayout().isFileSystemOptimized()) {
+      throw new OMException("Bucket: " + 
renameKeyRequest.getKeyArgs().getBucketName()
+          + " has layout: " + getBucketLayout() + ", but the rename requires "
+          + BucketLayout.FILE_SYSTEM_OPTIMIZED + ".", 
OMException.ResultCodes.NOT_SUPPORTED_OPERATION);
+    }
+

Review Comment:
   Not directly related to this PR, just noting down for the record: if the 
operation fails in preExecute, it won't be recorded in the audit log.



##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java:
##########
@@ -537,6 +537,27 @@ void rename(OzoneBucket bucket, String path, String 
newPath)
     bucket.renameKey(key, newKey);
   }
 
+  /**
+   * Whether OM rejects a rename that requires a FILE_SYSTEM_OPTIMIZED bucket 
on any other layout (HDDS-16951), so a
+   * file system rename can be sent without fetching the bucket to learn its 
layout.
+   */
+  boolean isRenameRequiringFileSystemOptimizedSupported() {
+    return 
proxy.getOmVersion().compareTo(OzoneManagerVersion.RENAME_KEY_REJECTS_NON_FSO) 
>= 0;

Review Comment:
   Please use `ComponentVersion#isSupportedBy`.



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