HDFS-16324. Fix error log in BlockManagerSafeMode (#3661)
Reviewed-by: tomscut <litao@bigo.sg> Reviewed-by: Ayush Saxena <ayushsaxena@apache.org> Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
parent
7ba91c1235
commit
00d483d6de
|
@ -649,7 +649,7 @@ class BlockManagerSafeMode {
|
|||
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_DEFAULT);
|
||||
if (recheckInterval < 1) {
|
||||
LOG.warn("Invalid value for " +
|
||||
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_DEFAULT +
|
||||
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_KEY +
|
||||
". Should be greater than 0, but is {}", recheckInterval);
|
||||
recheckInterval = DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_DEFAULT;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
import org.apache.hadoop.test.Whitebox;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -242,6 +243,20 @@ public class TestBlockManagerSafeMode {
|
|||
assertTrue(content.contains("Using 3000 as SafeModeMonitor Interval"));
|
||||
}
|
||||
|
||||
@Test(timeout = 20000)
|
||||
public void testCheckSafeMode10(){
|
||||
Configuration conf = new HdfsConfiguration();
|
||||
conf.setLong(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_KEY, -1);
|
||||
GenericTestUtils.LogCapturer logs =
|
||||
GenericTestUtils.LogCapturer.captureLogs(BlockManagerSafeMode.LOG);
|
||||
BlockManagerSafeMode blockManagerSafeMode = new BlockManagerSafeMode(bm,
|
||||
fsn, true, conf);
|
||||
String content = logs.getOutput();
|
||||
Assertions.assertThat(content).contains("Invalid value for " +
|
||||
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_RECHECK_INTERVAL_KEY +
|
||||
". Should be greater than 0, but is -1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the block safe increases up to block threshold.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue