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
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
HDFS-4985. Add storage type to the protocol and expose it in block report

View File

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