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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1561388 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2014-01-25 20:19:28 +00:00
parent e67105e4ce
commit 7c7a4463fd
2 changed files with 56 additions and 49 deletions

View File

@ -307,6 +307,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5728. Block recovery will fail if the metafile does not have crc HDFS-5728. Block recovery will fail if the metafile does not have crc
for all chunks of the block (Vinay via kihwal) for all chunks of the block (Vinay via kihwal)
HDFS-5719. FSImage#doRollback() should close prevState before return
(Ted Yu via todd)
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

@ -408,6 +408,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();
@ -462,6 +463,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 {