HDFS-13559. TestBlockScanner does not close TestContext properly. Contributed by Anbang Hu.

This commit is contained in:
Inigo Goiri 2018-05-16 19:23:02 -07:00
parent be53969047
commit 454de3b543
1 changed files with 4 additions and 1 deletions

View File

@ -125,6 +125,7 @@ public class TestBlockScanner {
if (cluster != null) { if (cluster != null) {
for (int i = 0; i < numNameServices; i++) { for (int i = 0; i < numNameServices; i++) {
dfs[i].delete(new Path("/test"), true); dfs[i].delete(new Path("/test"), true);
dfs[i].close();
} }
cluster.shutdown(); cluster.shutdown();
} }
@ -817,6 +818,7 @@ public class TestBlockScanner {
"in recentSuspectBlocks.", info.goodBlocks.contains(first)); "in recentSuspectBlocks.", info.goodBlocks.contains(first));
info.blocksScanned = 0; info.blocksScanned = 0;
} }
ctx.close();
} }
/** /**
@ -873,6 +875,7 @@ public class TestBlockScanner {
info.blocksScanned = 0; info.blocksScanned = 0;
} }
info.sem.release(1); info.sem.release(1);
ctx.close();
} }
/** /**
@ -933,12 +936,12 @@ public class TestBlockScanner {
os.write(bytes); os.write(bytes);
os.hflush(); os.hflush();
os.close(); os.close();
fs.close();
// verify that volume scanner does not find bad blocks after append. // verify that volume scanner does not find bad blocks after append.
waitForRescan(info, numExpectedBlocks); waitForRescan(info, numExpectedBlocks);
GenericTestUtils.setLogLevel(DataNode.LOG, Level.INFO); GenericTestUtils.setLogLevel(DataNode.LOG, Level.INFO);
ctx.close();
} }
private void waitForRescan(final TestScanResultHandler.Info info, private void waitForRescan(final TestScanResultHandler.Info info,