HDFS-5186. TestFileJournalManager fails on Windows due to file handle leaks. Contributed by Chuan Liu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1526615 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-09-26 17:33:07 +00:00
parent 269eb42b2f
commit ae501ceeb7
2 changed files with 19 additions and 13 deletions

View File

@ -351,6 +351,9 @@ Release 2.1.2 - UNRELEASED
HDFS-5258. Skip tests in TestHDFSCLI that are not applicable on Windows. HDFS-5258. Skip tests in TestHDFSCLI that are not applicable on Windows.
(Chuan Liu via cnauroth) (Chuan Liu via cnauroth)
HDFS-5186. TestFileJournalManager fails on Windows due to file handle leaks.
(Chuan Liu via cnauroth)
Release 2.1.1-beta - 2013-09-23 Release 2.1.1-beta - 2013-09-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -86,6 +86,7 @@ static long getNumberOfTransactions(FileJournalManager jm, long fromTxId,
EditLogInputStream elis = null; EditLogInputStream elis = null;
try { try {
while ((elis = allStreams.poll()) != null) { while ((elis = allStreams.poll()) != null) {
try {
elis.skipUntil(txId); elis.skipUntil(txId);
while (true) { while (true) {
FSEditLogOp op = elis.readOp(); FSEditLogOp op = elis.readOp();
@ -93,17 +94,19 @@ static long getNumberOfTransactions(FileJournalManager jm, long fromTxId,
break; break;
} }
if (abortOnGap && (op.getTransactionId() != txId)) { if (abortOnGap && (op.getTransactionId() != txId)) {
LOG.info("getNumberOfTransactions: detected gap at txId " + LOG.info("getNumberOfTransactions: detected gap at txId "
fromTxId); + fromTxId);
return numTransactions; return numTransactions;
} }
txId = op.getTransactionId() + 1; txId = op.getTransactionId() + 1;
numTransactions++; numTransactions++;
} }
} finally {
IOUtils.cleanup(LOG, elis);
}
} }
} finally { } finally {
IOUtils.cleanup(LOG, allStreams.toArray(new EditLogInputStream[0])); IOUtils.cleanup(LOG, allStreams.toArray(new EditLogInputStream[0]));
IOUtils.cleanup(LOG, elis);
} }
return numTransactions; return numTransactions;
} }