Hexiaoqiao commented on code in PR #5855: URL: https://github.com/apache/hadoop/pull/5855#discussion_r1286669004
########## hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java: ########## @@ -2957,6 +2957,22 @@ public boolean processReport(final DatanodeID nodeID, return !node.hasStaleStorages(); } + /** + * Remove the DN lease only when we have received block reports + * for all storages for a particular DN. Review Comment: Fix checkstyle. ########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportLease.java: ########## @@ -269,4 +271,85 @@ private StorageBlockReport[] createReports(DatanodeStorage[] dnStorages, } return storageBlockReports; } + + @Test(timeout = 360000) + public void testFirstIncompleteBlockReport() throws Exception { + HdfsConfiguration conf = new HdfsConfiguration(); + Random rand = new Random(); + + try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf) + .numDataNodes(1).build()) { + cluster.waitActive(); + + FSNamesystem fsn = cluster.getNamesystem(); + + NameNode nameNode = cluster.getNameNode(); + // pretend to be in safemode Review Comment: The first letter need to be uppercase and end with period at the end of sentence. ########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportLease.java: ########## @@ -269,4 +271,85 @@ private StorageBlockReport[] createReports(DatanodeStorage[] dnStorages, } return storageBlockReports; } + + @Test(timeout = 360000) + public void testFirstIncompleteBlockReport() throws Exception { + HdfsConfiguration conf = new HdfsConfiguration(); + Random rand = new Random(); + + try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf) + .numDataNodes(1).build()) { + cluster.waitActive(); + + FSNamesystem fsn = cluster.getNamesystem(); + + NameNode nameNode = cluster.getNameNode(); + // pretend to be in safemode + NameNodeAdapter.enterSafeMode(nameNode, false); + + BlockManager blockManager = fsn.getBlockManager(); + BlockManager spyBlockManager = spy(blockManager); + fsn.setBlockManagerForTesting(spyBlockManager); + String poolId = cluster.getNamesystem().getBlockPoolId(); + + NamenodeProtocols rpcServer = cluster.getNameNodeRpc(); + + // Test based on one DataNode report to Namenode + DataNode dn = cluster.getDataNodes().get(0); + DatanodeDescriptor datanodeDescriptor = spyBlockManager + .getDatanodeManager().getDatanode(dn.getDatanodeId()); Review Comment: Keep the same align format as the define. Here we should leave four blank space only (the same issue at other lines should update too). -- 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