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


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java:
##########
@@ -1242,7 +1242,10 @@ public void setEncodedKey(String anEncodedKey) {
      * when the stream is closed.
      */
     private void restoreKey() throws IOException {
-      store.rename(getEncodedKey(), getKey());
+      String key = getKey();
+      FileMetadata existingMetadata = store.retrieveMetadata(key);

Review Comment:
   Lets not call this call as discussed in the other comment around how to get 
etag.
   +
   By the emptySrc file was created, till this moment some other process would 
have made change to that path and hence etag would change. so, now if we read 
etag here, we will get the wrong etag.



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

Review Comment:
   We can get etag here and pass that till the point where we want to rename. 
No need of metadata call is required.
   
   `blob.getBlob().getProperties().getEtag();` will help. why?
   `blob` here is CloudBlockBlobWrapper. `blob.getBlob()` is CloudBlockBlob.
   Now, in `CloudBlockBlob.commitBlockListImpl.preProcessResponse`, etag and 
LMT will be updated in the CloudBlockBlob obj.



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