From 30ba954741f97d08e4ccd94c4295cf621ddc5e63 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Tue, 31 Jul 2012 19:00:03 +0000 Subject: [PATCH] svn merge -c 1367702 FIXES: HADOOP-8637. FilterFileSystem#setWriteChecksum is broken (daryn via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1367703 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop-common/CHANGES.txt | 2 ++ .../apache/hadoop/fs/FilterFileSystem.java | 2 +- .../hadoop/fs/TestFilterFileSystem.java | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) 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:/");