diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 1d491a7470d..5cb1d15f397 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -329,6 +329,9 @@ Release 2.4.1 - UNRELEASED HDFS-6189. Multiple HDFS tests fail on Windows attempting to use a test root path containing a colon. (cnauroth via szetszwo) + HDFS-6197. Rolling upgrade rollback on Windows can fail attempting to rename + edit log segment files to a destination that already exists. (cnauroth) + Release 2.4.0 - 2014-04-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java index 2bce79bfe8d..22d5fab3709 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java @@ -512,10 +512,12 @@ public class FileJournalManager implements JournalManager { private void renameSelf(String newSuffix) throws IOException { File src = file; File dst = new File(src.getParent(), src.getName() + newSuffix); - boolean success = src.renameTo(dst); - if (!success) { - throw new IOException( - "Couldn't rename log " + src + " to " + dst); + // renameTo fails on Windows if the destination file already exists. + if (!src.renameTo(dst)) { + if (!dst.delete() || !src.renameTo(dst)) { + throw new IOException( + "Couldn't rename log " + src + " to " + dst); + } } file = dst; } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java index 321f8843d0f..32f9899ca1a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java @@ -195,6 +195,7 @@ public class TestRollingUpgrade { Assert.assertEquals(info1, dfs.rollingUpgrade(RollingUpgradeAction.QUERY)); dfs.mkdirs(bar); + cluster.shutdown(); } // cluster2 takes over QJM