From ff03212145f41326747b81c2a67341ad04e5251a Mon Sep 17 00:00:00 2001 From: GuoPhilipse <46367746+GuoPhilipse@users.noreply.github.com> Date: Sun, 27 Mar 2022 21:23:48 +0800 Subject: [PATCH] HDFS-16355. Improve the description of dfs.block.scanner.volume.bytes.per.second (#3724) Co-authored-by: gf13871 Signed-off-by: Akira Ajisaka (cherry picked from commit 046a6204b4a895b98ccd41dde1c9524a6bb0ea31) --- .../src/main/resources/hdfs-default.xml | 2 +- .../hdfs/server/datanode/TestBlockScanner.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml index 5ac2bfff96f..f304ed0a720 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -1446,7 +1446,7 @@ dfs.block.scanner.volume.bytes.per.second 1048576 - If this is 0, the DataNode's block scanner will be disabled. If this + If this is configured less than or equal to zero, the DataNode's block scanner will be disabled. If this is positive, this is the number of bytes per second that the DataNode's block scanner will try to scan from each volume. 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 ecdd74c5a1f..0decd6f8af4 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 @@ -280,11 +280,17 @@ public void testVolumeIteratorWithCaching() throws Exception { public void testDisableVolumeScanner() throws Exception { Configuration conf = new Configuration(); disableBlockScanner(conf); - TestContext ctx = new TestContext(conf, 1); - try { - Assert.assertFalse(ctx.datanode.getBlockScanner().isEnabled()); - } finally { - ctx.close(); + try(TestContext ctx = new TestContext(conf, 1)) { + assertFalse(ctx.datanode.getBlockScanner().isEnabled()); + } + } + + @Test(timeout=60000) + public void testDisableVolumeScanner2() throws Exception { + Configuration conf = new Configuration(); + conf.setLong(DFS_BLOCK_SCANNER_VOLUME_BYTES_PER_SECOND, -1L); + try(TestContext ctx = new TestContext(conf, 1)) { + assertFalse(ctx.datanode.getBlockScanner().isEnabled()); } }