zhtttylz commented on code in PR #5815: URL: https://github.com/apache/hadoop/pull/5815#discussion_r1255425461
########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFsck.java: ########## @@ -1681,6 +1682,66 @@ public Boolean get() { assertFalse(fsckOut.contains(NamenodeFsck.IN_MAINTENANCE_STATUS)); } + /** + * Test for blockIdCK with datanode staleness. + */ + @Test + public void testBlockIdCKStaleness() throws Exception { + final short replFactor = 1; + short numDn = 1; + final long blockSize = 512; + Configuration conf = new Configuration(); + + // Shorten dfs.namenode.stale.datanode.interval for easier testing. + conf.set(DFS_NAMENODE_STALE_DATANODE_INTERVAL_KEY, String.valueOf(5000)); + conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize); + conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, replFactor); + + String[] racks = {"/rack1", "/rack2"}; + String[] hosts = {"host1", "host2"}; + + File builderBaseDir = new File(GenericTestUtils.getRandomizedTempPath()); + cluster = new MiniDFSCluster.Builder(conf, builderBaseDir) + .numDataNodes(numDn).hosts(hosts).racks(racks).build(); Review Comment: When constructing a new MiniDFSCluster, the default number of dn is 1, you can drop`.numDataNodes(numDn)`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org