diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 039743729b1..7ef995c49ff 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -686,6 +686,8 @@ Release 0.23.3 - UNRELEASED HADOOP-8635. Cannot cancel paths registered deleteOnExit (daryn via bobby) + HADOOP-8637. FilterFileSystem#setWriteChecksum is broken (daryn via bobby) + Release 0.23.2 - UNRELEASED NEW FEATURES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java index 38ddb6c5f58..956ef368dad 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java @@ -376,7 +376,7 @@ public class FilterFileSystem extends FileSystem { @Override public void setWriteChecksum(boolean writeChecksum) { - fs.setVerifyChecksum(writeChecksum); + fs.setWriteChecksum(writeChecksum); } @Override diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java index 727986dcd12..d195c143fa3 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java @@ -286,6 +286,30 @@ public class TestFilterFileSystem { checkFsConf(flfs, conf, 3); } + @Test + public void testVerifyChecksumPassthru() { + FileSystem mockFs = mock(FileSystem.class); + FileSystem fs = new FilterFileSystem(mockFs); + + fs.setVerifyChecksum(false); + verify(mockFs).setVerifyChecksum(eq(false)); + reset(mockFs); + fs.setVerifyChecksum(true); + verify(mockFs).setVerifyChecksum(eq(true)); + } + + @Test + public void testWriteChecksumPassthru() { + FileSystem mockFs = mock(FileSystem.class); + FileSystem fs = new FilterFileSystem(mockFs); + + fs.setWriteChecksum(false); + verify(mockFs).setWriteChecksum(eq(false)); + reset(mockFs); + fs.setWriteChecksum(true); + verify(mockFs).setWriteChecksum(eq(true)); + } + private void checkInit(FilterFileSystem fs, boolean expectInit) throws Exception { URI uri = URI.create("filter:/");