You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2020/01/20 16:26:53 UTC
[hadoop] branch branch-3.2 updated: HADOOP-16785. followup to abfs
close() fix.
This is an automated email from the ASF dual-hosted git repository.
stevel pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new 429d5db HADOOP-16785. followup to abfs close() fix.
429d5db is described below
commit 429d5db3d977d07a415e0f6f3e425525e3fb1e26
Author: Steve Loughran <st...@cloudera.com>
AuthorDate: Mon Jan 20 16:23:41 2020 +0000
HADOOP-16785. followup to abfs close() fix.
Adds one extra test to the ABFS close logic, to explicitly
verify that the close sequence of FilterOutputStream is
not going to fail.
This is just a due-diligence patch, but it helps ensure
that no regressions creep in in future.
Contributed by Steve Loughran.
Change-Id: Ifd33a8c322d32513411405b15f50a1aebcfa6e48
---
.../azurebfs/ITestAzureBlobFileSystemCreate.java | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java
index d9ac03e..94368a4 100644
--- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java
+++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java
@@ -19,6 +19,7 @@
package org.apache.hadoop.fs.azurebfs;
import java.io.FileNotFoundException;
+import java.io.FilterOutputStream;
import java.io.IOException;
import java.util.EnumSet;
@@ -155,4 +156,32 @@ public class ITestAzureBlobFileSystemCreate extends
GenericTestUtils.assertExceptionContains(fnfe.getMessage(), inner);
}
}
+
+ /**
+ * Attempts to write to the azure stream after it is closed will raise
+ * an IOException.
+ */
+ @Test
+ public void testFilterFSWriteAfterClose() throws Throwable {
+ final AzureBlobFileSystem fs = getFileSystem();
+ Path testPath = new Path(TEST_FOLDER_PATH, TEST_CHILD_FILE);
+ FSDataOutputStream out = fs.create(testPath);
+ intercept(FileNotFoundException.class,
+ () -> {
+ try (FilterOutputStream fos = new FilterOutputStream(out)) {
+ fos.write('a');
+ fos.flush();
+ out.hsync();
+ fs.delete(testPath, false);
+ // trigger the first failure
+ throw intercept(FileNotFoundException.class,
+ () -> {
+ fos.write('b');
+ out.hsync();
+ return "hsync didn't raise an IOE";
+ });
+ }
+ });
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org