Gargi-jais11 commented on code in PR #11626:
URL: https://github.com/apache/ozone/pull/11626#discussion_r4345454622


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3InitiateMultipartUploadRequest.java:
##########
@@ -90,12 +92,23 @@ public OMRequest preExecute(OzoneManager ozoneManager) 
throws IOException {
     keyPath = validateAndNormalizeKey(ozoneManager.getEnableFileSystemPaths(),
         keyPath, getBucketLayout());
 
+    final OmBucketInfo bucketInfo = ozoneManager
+        .getBucketInfo(keyArgs.getVolumeName(), keyArgs.getBucketName());
+
     KeyArgs.Builder newKeyArgs = keyArgs.toBuilder()
             .setMultipartUploadID(
                 OMMultipartUploadUtils.getMultipartUploadId())
             .setModificationTime(Time.now())
             .setKeyName(keyPath);
 
+    // Stamp the policy only once finalized: an OM without storage policy 
support ignores the field, so stamping it
+    // earlier would make old and new OMs apply this request differently. 
Clearing also drops a client-sent value.
+    if 
(ozoneManager.getVersionManager().isAllowed(OMLayoutFeature.STORAGE_POLICY_SUPPORT))
 {
+      
newKeyArgs.setStoragePolicy(OzoneStoragePolicy.toProto(getStoragePolicy(bucketInfo,
 keyArgs)));
+    } else {
+      newKeyArgs.clearStoragePolicy();
+    }

Review Comment:
   @anuragp010 If the client explicitly asks for a policy before finalization, 
we silently drop it. For example, initiateMultipartUpload(..., COLD) succeeds, 
but the key ends up with no policy and on the default tier, with no error.
   
   I agree skiping the server-resolved policy pre-finalization makes sense. But 
for an explicit one, should we reject with 
**`NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION`**, like 
`disallowInitiateMultiPartUploadWithECReplicationConfig` does for EC? I think 
it shouldn't affect normal clients, since RpcClient only sends the field when a 
policy is passed and S3G never sends it.



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