svn merge -c 160639 FIXES: YARN-2167. LeveldbIterator should get closed in NMLeveldbStateStoreService#loadLocalizationState() within finally block. Contributed by Junping Du

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1603040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason Darrell Lowe 2014-06-17 02:14:29 +00:00
parent 771e157b66
commit 0873304b90
2 changed files with 10 additions and 1 deletions

View File

@ -240,6 +240,10 @@ Release 2.5.0 - UNRELEASED
to NMs where the completed applications previously ran in case of RM restart. to NMs where the completed applications previously ran in case of RM restart.
(Wangda Tan via jianhe) (Wangda Tan via jianhe)
YARN-2167. LeveldbIterator should get closed in
NMLeveldbStateStoreService#loadLocalizationState() within finally block
(Junping Du via jlowe)
Release 2.4.1 - 2014-06-23 Release 2.4.1 - 2014-06-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -95,8 +95,9 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
throws IOException { throws IOException {
RecoveredLocalizationState state = new RecoveredLocalizationState(); RecoveredLocalizationState state = new RecoveredLocalizationState();
LeveldbIterator iter = null;
try { try {
LeveldbIterator iter = new LeveldbIterator(db); iter = new LeveldbIterator(db);
iter.seek(bytes(LOCALIZATION_PUBLIC_KEY_PREFIX)); iter.seek(bytes(LOCALIZATION_PUBLIC_KEY_PREFIX));
state.publicTrackerState = loadResourceTrackerState(iter, state.publicTrackerState = loadResourceTrackerState(iter,
LOCALIZATION_PUBLIC_KEY_PREFIX); LOCALIZATION_PUBLIC_KEY_PREFIX);
@ -122,6 +123,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
} }
} catch (DBException e) { } catch (DBException e) {
throw new IOException(e.getMessage(), e); throw new IOException(e.getMessage(), e);
} finally {
if (iter != null) {
iter.close();
}
} }
return state; return state;