From 454de3b543c8b00a9ab566c7d1c64d7e4cffee0f Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Wed, 16 May 2018 19:23:02 -0700 Subject: [PATCH] HDFS-13559. TestBlockScanner does not close TestContext properly. Contributed by Anbang Hu. --- .../apache/hadoop/hdfs/server/datanode/TestBlockScanner.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java index b627800391..1e92a5db4f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java @@ -125,6 +125,7 @@ public void close() throws IOException { if (cluster != null) { for (int i = 0; i < numNameServices; i++) { dfs[i].delete(new Path("/test"), true); + dfs[i].close(); } cluster.shutdown(); } @@ -817,6 +818,7 @@ public Boolean get() { "in recentSuspectBlocks.", info.goodBlocks.contains(first)); info.blocksScanned = 0; } + ctx.close(); } /** @@ -873,6 +875,7 @@ public Boolean get() { info.blocksScanned = 0; } info.sem.release(1); + ctx.close(); } /** @@ -933,12 +936,12 @@ public void testAppendWhileScanning() throws Exception { os.write(bytes); os.hflush(); os.close(); - fs.close(); // verify that volume scanner does not find bad blocks after append. waitForRescan(info, numExpectedBlocks); GenericTestUtils.setLogLevel(DataNode.LOG, Level.INFO); + ctx.close(); } private void waitForRescan(final TestScanResultHandler.Info info,