From 75be1e0e76c5f89754c5da56d6e08c819f8e1340 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Tue, 31 Jul 2012 18:58:43 +0000 Subject: [PATCH] HADOOP-8637. FilterFileSystem#setWriteChecksum is broken (daryn via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1367702 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 cda7817987..482ab20c72 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -867,6 +867,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 INCOMPATIBLE CHANGES 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 38ddb6c5f5..956ef368da 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 void setVerifyChecksum(boolean verifyChecksum) { @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 727986dcd1..d195c143fa 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 void testInitFilterLocalFsSetsEmbedConf() throws Exception { 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:/");