From e2d901f4dabcf1fc3b400bc5d2b4f730104fd042 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Sat, 27 Apr 2013 16:10:31 +0000 Subject: [PATCH] HADOOP-9490. LocalFileSystem#reportChecksumFailure not closing the checksum file handle before rename. Contributed by Ivan Mitic. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1476609 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/LocalFileSystem.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index dfc30e4b577..68f4a0ae9b7 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -525,6 +525,9 @@ Trunk (Unreleased) HADOOP-9500. TestUserGroupInformation#testGetServerSideGroups fails on Windows due to failure to find winutils.exe. (Chris Nauroth via suresh) + + HADOOP-9490. LocalFileSystem#reportChecksumFailure not closing the + checksum file handle before rename. (Ivan Mitic via suresh) Release 2.0.5-beta - UNRELEASED diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java index 7db348c557d..879d7212c89 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java @@ -130,6 +130,8 @@ public class LocalFileSystem extends ChecksumFileSystem { } // move checksum file too File checkFile = ((RawLocalFileSystem)fs).pathToFile(getChecksumFile(p)); + // close the stream before rename to release the file handle + sums.close(); b = checkFile.renameTo(new File(badDir, checkFile.getName()+suffix)); if (!b) { LOG.warn("Ignoring failure of renameTo");