alkis commented on code in PR #6025:
URL: https://github.com/apache/hadoop/pull/6025#discussion_r1329934424


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java:
##########
@@ -1858,7 +1895,25 @@ public void storeEmptyLinkFile(String key, String 
tempBlobKey,
       CloudBlobWrapper blob = getBlobReference(key);
       storePermissionStatus(blob, permissionStatus);
       storeLinkAttribute(blob, tempBlobKey);
-      openOutputStream(blob).close();
+      if (eTagCheck && eTag != null) {
+        AccessCondition accessCondition = new AccessCondition();
+        accessCondition.setIfMatch(eTag);

Review Comment:
   I think this logic is incorrect. This method is creating an empty link file 
but we are creating the empty file conditionally if it matches the `eTag` of 
the original file.
   
   The logic for `create` should be the following (pseudocode):
   ```
   eTag = null
   if (overwrite) {
     eTag = readETag(dst)
     storeEmptyLinkFile(tmp)
     ...
     commitTmpFileTo(tmp, dst, eTag)  // should do IfMatch(eTag)
   } else {
     storeEmptyLinkFile(tmp)
     ...
     commitTmpFileTo(tmp, dst, null)  // should do IfNoneMatch("*")
   }
   ```
   and in all cases, inside `storeEmptyLinkFile` we should use 
`IfNoneMatch("*")` because we know we do not want to overwrite the tmp file and 
we guarantee that it is unique by putting a UUID in its name.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to