HDFS-5721. sharedEditsImage in Namenode#initializeSharedEdits() should be closed before method returns. Contributed by Ted Yu.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1561389 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c7a4463fd
commit
6266273c61
|
@ -310,6 +310,9 @@ Release 2.4.0 - UNRELEASED
|
||||||
HDFS-5719. FSImage#doRollback() should close prevState before return
|
HDFS-5719. FSImage#doRollback() should close prevState before return
|
||||||
(Ted Yu via todd)
|
(Ted Yu via todd)
|
||||||
|
|
||||||
|
HDFS-5721. sharedEditsImage in Namenode#initializeSharedEdits() should be
|
||||||
|
closed before method returns (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
|
||||||
|
|
|
@ -604,8 +604,14 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
||||||
|
|
||||||
long loadStart = now();
|
long loadStart = now();
|
||||||
String nameserviceId = DFSUtil.getNamenodeNameServiceId(conf);
|
String nameserviceId = DFSUtil.getNamenodeNameServiceId(conf);
|
||||||
|
try {
|
||||||
namesystem.loadFSImage(startOpt, fsImage,
|
namesystem.loadFSImage(startOpt, fsImage,
|
||||||
HAUtil.isHAEnabled(conf, nameserviceId));
|
HAUtil.isHAEnabled(conf, nameserviceId));
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOG.warn("Encountered exception loading fsimage", ioe);
|
||||||
|
fsImage.close();
|
||||||
|
throw ioe;
|
||||||
|
}
|
||||||
long timeTakenToLoadFSImage = now() - loadStart;
|
long timeTakenToLoadFSImage = now() - loadStart;
|
||||||
LOG.info("Finished loading FSImage in " + timeTakenToLoadFSImage + " msecs");
|
LOG.info("Finished loading FSImage in " + timeTakenToLoadFSImage + " msecs");
|
||||||
NameNodeMetrics nnMetrics = NameNode.getNameNodeMetrics();
|
NameNodeMetrics nnMetrics = NameNode.getNameNodeMetrics();
|
||||||
|
|
|
@ -818,6 +818,7 @@ public class NameNode implements NameNodeStatusMXBean {
|
||||||
System.out.println("Formatting using clusterid: " + clusterId);
|
System.out.println("Formatting using clusterid: " + clusterId);
|
||||||
|
|
||||||
FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat);
|
FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat);
|
||||||
|
try {
|
||||||
FSNamesystem fsn = new FSNamesystem(conf, fsImage);
|
FSNamesystem fsn = new FSNamesystem(conf, fsImage);
|
||||||
fsImage.getEditLog().initJournalsForWrite();
|
fsImage.getEditLog().initJournalsForWrite();
|
||||||
|
|
||||||
|
@ -826,6 +827,11 @@ public class NameNode implements NameNodeStatusMXBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
fsImage.format(fsn, clusterId);
|
fsImage.format(fsn, clusterId);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOG.warn("Encountered exception during format: ", ioe);
|
||||||
|
fsImage.close();
|
||||||
|
throw ioe;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,6 +905,7 @@ public class NameNode implements NameNodeStatusMXBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
NNStorage existingStorage = null;
|
NNStorage existingStorage = null;
|
||||||
|
FSImage sharedEditsImage = null;
|
||||||
try {
|
try {
|
||||||
FSNamesystem fsns =
|
FSNamesystem fsns =
|
||||||
FSNamesystem.loadFromDisk(getConfigurationWithoutSharedEdits(conf));
|
FSNamesystem.loadFromDisk(getConfigurationWithoutSharedEdits(conf));
|
||||||
|
@ -908,7 +915,7 @@ public class NameNode implements NameNodeStatusMXBean {
|
||||||
|
|
||||||
List<URI> sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf);
|
List<URI> sharedEditsDirs = FSNamesystem.getSharedEditsDirs(conf);
|
||||||
|
|
||||||
FSImage sharedEditsImage = new FSImage(conf,
|
sharedEditsImage = new FSImage(conf,
|
||||||
Lists.<URI>newArrayList(),
|
Lists.<URI>newArrayList(),
|
||||||
sharedEditsDirs);
|
sharedEditsDirs);
|
||||||
sharedEditsImage.getEditLog().initJournalsForWrite();
|
sharedEditsImage.getEditLog().initJournalsForWrite();
|
||||||
|
@ -936,6 +943,13 @@ public class NameNode implements NameNodeStatusMXBean {
|
||||||
LOG.error("Could not initialize shared edits dir", ioe);
|
LOG.error("Could not initialize shared edits dir", ioe);
|
||||||
return true; // aborted
|
return true; // aborted
|
||||||
} finally {
|
} finally {
|
||||||
|
if (sharedEditsImage != null) {
|
||||||
|
try {
|
||||||
|
sharedEditsImage.close();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOG.warn("Could not close sharedEditsImage", ioe);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Have to unlock storage explicitly for the case when we're running in a
|
// Have to unlock storage explicitly for the case when we're running in a
|
||||||
// unit test, which runs in the same JVM as NNs.
|
// unit test, which runs in the same JVM as NNs.
|
||||||
if (existingStorage != null) {
|
if (existingStorage != null) {
|
||||||
|
|
|
@ -190,6 +190,7 @@ public class BootstrapStandby implements Tool, Configurable {
|
||||||
// Load the newly formatted image, using all of the directories (including shared
|
// Load the newly formatted image, using all of the directories (including shared
|
||||||
// edits)
|
// edits)
|
||||||
FSImage image = new FSImage(conf);
|
FSImage image = new FSImage(conf);
|
||||||
|
try {
|
||||||
image.getStorage().setStorageInfo(storage);
|
image.getStorage().setStorageInfo(storage);
|
||||||
image.initEditLog();
|
image.initEditLog();
|
||||||
assert image.getEditLog().isOpenForRead() :
|
assert image.getEditLog().isOpenForRead() :
|
||||||
|
@ -208,6 +209,10 @@ public class BootstrapStandby implements Tool, Configurable {
|
||||||
otherHttpAddr, imageTxId,
|
otherHttpAddr, imageTxId,
|
||||||
storage, true);
|
storage, true);
|
||||||
image.saveDigestAndRenameCheckpointImage(imageTxId, hash);
|
image.saveDigestAndRenameCheckpointImage(imageTxId, hash);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
image.close();
|
||||||
|
throw ioe;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue