raphaelazzolini commented on code in PR #7011:
URL: https://github.com/apache/hadoop/pull/7011#discussion_r1730127202


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/RequestFactoryImpl.java:
##########
@@ -517,12 +518,22 @@ public CreateMultipartUploadRequest.Builder 
newMultipartUploadRequestBuilder(
   public CompleteMultipartUploadRequest.Builder 
newCompleteMultipartUploadRequestBuilder(
       String destKey,
       String uploadId,
-      List<CompletedPart> partETags) {
+      List<CompletedPart> partETags,
+      PutObjectOptions putOptions) {
+
     // a copy of the list is required, so that the AWS SDK doesn't
     // attempt to sort an unmodifiable list.
-    CompleteMultipartUploadRequest.Builder requestBuilder =
-        
CompleteMultipartUploadRequest.builder().bucket(bucket).key(destKey).uploadId(uploadId)
+    CompleteMultipartUploadRequest.Builder requestBuilder;
+    Map<String, String> optionHeaders = putOptions.getHeaders();
+
+    if (optionHeaders != null && optionHeaders.containsKey("If-None-Match")) {
+        requestBuilder = 
CompleteMultipartUploadRequest.builder().bucket(bucket).key(destKey).uploadId(uploadId)
+            .overrideConfiguration(override 
->override.putHeader("If-None-Match", optionHeaders.get("If-None-Match")))

Review Comment:
   SDK has it: 
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/model/PutObjectRequest.html#ifNoneMatch()
   It exists since the [version 
2.27.9](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md#2279-2024-08-20),
 we are using 2.27.12 in pom.xml, so we should have this method.



##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Constants.java:
##########
@@ -1390,6 +1390,13 @@ private Constants() {
    */
   public static final String FS_S3A_CREATE_PERFORMANCE = 
"fs.s3a.create.performance";
 
+  /**
+   * Flag for commit if none match.
+   * This can be set in the {code createFile()} builder.
+   * Value {@value}.
+   */
+  public static final String FS_S3A_CREATE_IF_NONE_MATCH = 
"fs.s3a.create.header.If-None-Match";

Review Comment:
   This property name looks out of pattern, it doesn't look like we use upper 
case letters elsewhere. I think the correct name would be 
`fs.s3a.create.header.if.none.match`



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