[ 
https://issues.apache.org/jira/browse/HADOOP-19448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17924479#comment-17924479
 ] 

ASF GitHub Bot commented on HADOOP-19448:
-----------------------------------------

anmolanmol1234 commented on code in PR #7353:
URL: https://github.com/apache/hadoop/pull/7353#discussion_r1944510643


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java:
##########
@@ -781,6 +980,52 @@ public void testCreateSameFile() throws Exception {
         .isTrue();
   }
 
+  /**
+   * Test the creation of a file without conditional overwrite.
+   * This test sets the configuration 
`fs.azure.enable.conditional.create.overwrite` to false,
+   * creates a directory, and then attempts to create a file at the same path 
with overwrite set to true.
+   * It expects an IOException to be thrown.
+   *
+   * @throws Exception if any exception occurs during the test execution
+   */
+  @Test
+  public void testCreationWithoutConditionalOverwrite()
+      throws Exception {
+    final AzureBlobFileSystem currentFs = getFileSystem();
+    Configuration config = new Configuration(this.getRawConfiguration());
+    config.set("fs.azure.enable.conditional.create.overwrite",
+        String.valueOf(false));
+
+    final AzureBlobFileSystem fs =
+        (AzureBlobFileSystem) FileSystem.newInstance(currentFs.getUri(),
+            config);
+    fs.mkdirs(new Path("a/b/c"));
+    intercept(IOException.class, () -> fs.create(new Path("a/b/c"), true));
+  }
+
+  /**
+   * Test the creation of a file with overwrite set to false without 
conditional overwrite.
+   * This test sets the configuration 
`fs.azure.enable.conditional.create.overwrite` to false,
+   * creates a directory, and then attempts to create a file at the same path 
with overwrite set to false.
+   * It expects an IOException to be thrown.
+   *
+   * @throws Exception if any exception occurs during the test execution
+   */
+  @Test
+  public void testCreationOverwriteFalseWithoutConditionalOverwrite()
+      throws Exception {
+    final AzureBlobFileSystem currentFs = getFileSystem();
+    Configuration config = new Configuration(this.getRawConfiguration());
+    config.set("fs.azure.enable.conditional.create.overwrite",
+        String.valueOf(false));
+
+    final AzureBlobFileSystem fs =
+        (AzureBlobFileSystem) FileSystem.newInstance(currentFs.getUri(),
+            config);
+    fs.mkdirs(new Path("a/b/c"));
+    intercept(IOException.class, () -> fs.create(new Path("a/b/c"), false));

Review Comment:
   taken





> ABFS: [FnsOverBlob][Optimizations] Reduce Network Calls In Create and Mkdir 
> Flow
> --------------------------------------------------------------------------------
>
>                 Key: HADOOP-19448
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19448
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.4.2
>            Reporter: Anuj Modi
>            Assignee: Anmol Asrani
>            Priority: Major
>              Labels: pull-request-available
>
> Implementing Create and Mkdir file system APIs for FNS(HNS Disabled) accounts 
> on Blob Endpoint involves a lot of checks and marker file creations to handle 
> implicit explicit cases of paths involved in these APIs.
> This Jira proposes a few optimizations to reduce the network calls wherever 
> possible and in case where create/mkdir is bound to fail, it should fail 
> faster before doing any post checks,



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to