HDFS-6197. Merging change r1585586 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-04-07 21:26:42 +00:00
parent 45e26bae05
commit 58d9479140
3 changed files with 10 additions and 4 deletions

View File

@ -81,6 +81,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

View File

@ -512,11 +512,13 @@ 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) {
// 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;
}

View File

@ -195,6 +195,7 @@ public class TestRollingUpgrade {
Assert.assertEquals(info1, dfs.rollingUpgrade(RollingUpgradeAction.QUERY));
dfs.mkdirs(bar);
cluster.shutdown();
}
// cluster2 takes over QJM