HDFS-5719. FSImage#doRollback() should close prevState before return. Contributed by Ted Yu

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1556057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-01-06 22:58:18 +00:00
parent 8deb7a6057
commit bfd227bf09
2 changed files with 56 additions and 49 deletions

View File

@ -465,6 +465,9 @@ Trunk (Unreleased)
HDFS-5705. TestSecondaryNameNodeUpgrade#testChangeNsIDFails may fail due HDFS-5705. TestSecondaryNameNodeUpgrade#testChangeNsIDFails may fail due
to ConcurrentModificationException. (Ted Yu via brandonli) to ConcurrentModificationException. (Ted Yu via brandonli)
HDFS-5719. FSImage#doRollback() should close prevState before return
(Ted Yu via brandonli)
BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS
HDFS-4985. Add storage type to the protocol and expose it in block report HDFS-4985. Add storage type to the protocol and expose it in block report

View File

@ -405,6 +405,7 @@ public class FSImage implements Closeable {
// Directories that don't have previous state do not rollback // Directories that don't have previous state do not rollback
boolean canRollback = false; boolean canRollback = false;
FSImage prevState = new FSImage(conf); FSImage prevState = new FSImage(conf);
try {
prevState.getStorage().layoutVersion = HdfsConstants.LAYOUT_VERSION; prevState.getStorage().layoutVersion = HdfsConstants.LAYOUT_VERSION;
for (Iterator<StorageDirectory> it = storage.dirIterator(); it.hasNext();) { for (Iterator<StorageDirectory> it = storage.dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next(); StorageDirectory sd = it.next();
@ -459,6 +460,9 @@ public class FSImage implements Closeable {
LOG.info("Rollback of " + sd.getRoot()+ " is complete."); LOG.info("Rollback of " + sd.getRoot()+ " is complete.");
} }
isUpgradeFinalized = true; isUpgradeFinalized = true;
} finally {
prevState.close();
}
} }
private void doFinalize(StorageDirectory sd) throws IOException { private void doFinalize(StorageDirectory sd) throws IOException {