anujmodi2021 commented on code in PR #7914:
URL: https://github.com/apache/hadoop/pull/7914#discussion_r2309688341


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java:
##########
@@ -2236,6 +2238,98 @@ public void 
testFailureInGetPathStatusDuringCreateRecovery() throws Exception {
     }
   }
 
+  /**
+   * Test to simulate a successful create operation followed by a connection 
reset
+   * on the response, triggering a retry.
+   *
+   * This test verifies that the create operation is retried in the event of a
+   * connection reset during the response phase. The test creates a mock
+   * AzureBlobFileSystem and its associated components to simulate the create
+   * operation and the connection reset. It then verifies that the create
+   * operation is retried once before succeeding.
+   *
+   * @throws Exception if an error occurs during the test execution.
+   */
+  @Test
+  public void testCreateIdempotencyForNonHnsBlob() throws Exception {
+    assumeThat(isAppendBlobEnabled()).as("Not valid for APPEND 
BLOB").isFalse();
+    // Create a spy of AzureBlobFileSystem
+    try (AzureBlobFileSystem fs = Mockito.spy(
+        (AzureBlobFileSystem) FileSystem.newInstance(getRawConfiguration()))) {
+      assumeHnsDisabled();
+      // Create a spy of AzureBlobFileSystemStore
+      AzureBlobFileSystemStore store = Mockito.spy(fs.getAbfsStore());
+      assumeBlobServiceType();

Review Comment:
   We can move all assume before any other statement



##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRename.java:
##########
@@ -1702,6 +1705,85 @@ public void testRenamePathRetryIdempotency() throws 
Exception {
     }
   }
 
+  /**
+   * Test to simulate a successful copy blob operation followed by a 
connection reset
+   * on the response, triggering a retry.
+   *
+   * This test verifies that the copy blob operation is retried in the event 
of a
+   * connection reset during the response phase. The test creates a mock
+   * AzureBlobFileSystem and its associated components to simulate the copy 
blob
+   * operation and the connection reset. It then verifies that the create
+   * operation is retried once before succeeding.
+   *
+   * @throws Exception if an error occurs during the test execution.
+   */
+  @Test
+  public void testRenameIdempotencyForNonHnsBlob() throws Exception {
+    assumeThat(isAppendBlobEnabled()).as("Not valid for APPEND 
BLOB").isFalse();
+    // Create a spy of AzureBlobFileSystem
+    try (AzureBlobFileSystem fs = Mockito.spy(
+        (AzureBlobFileSystem) FileSystem.newInstance(getRawConfiguration()))) {
+      assumeHnsDisabled();

Review Comment:
   Same here, move all assume to first few lines



##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java:
##########
@@ -509,9 +509,30 @@ public AbfsRestOperation createPath(final String path,
       final TracingContext tracingContext) throws AzureBlobFileSystemException 
{
     AbfsRestOperation op;
     if (isFileCreation) {
-      // Create a file with the specified parameters
-      op = createFile(path, overwrite, permissions, isAppendBlob, eTag,
-          contextEncryptionAdapter, tracingContext);
+      AbfsRestOperation statusOp = null;
+      try {
+        // Check if the file already exists by calling GetPathStatus
+        statusOp = getPathStatus(path, false, tracingContext, null);

Review Comment:
   In case of override true, flow might come here with already a Head call done 
on path. 
   Can we avoid this head call in that case?



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