[ https://issues.apache.org/jira/browse/HDFS-17068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742467#comment-17742467 ]
ASF GitHub Bot commented on HDFS-17068: --------------------------------------- ayushtkn commented on code in PR #5809: URL: https://github.com/apache/hadoop/pull/5809#discussion_r1261357967 ########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java: ########## @@ -1304,6 +1305,23 @@ public void testLocalReplicaUpdateWithReplica() throws Exception { assertEquals(realBlkFile, localReplica.getBlockFile()); } + @Test(timeout = 60000) + public void testLastDirScannerFinishTimeIsUpdated() throws Exception { + Configuration conf = getConfiguration(); + conf.setLong(DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEY, 3L); + cluster = new MiniDFSCluster.Builder(conf).build(); + try { + cluster.waitActive(); + bpid = cluster.getNamesystem().getBlockPoolId(); + fds = DataNodeTestUtils.getFSDataset(cluster.getDataNodes().get(0)); + assertEquals(fds.getLastDirScannerFinishTime(), 0L); + Thread.sleep(4000); + assertNotEquals(0L, fds.getLastDirScannerFinishTime()); + } finally { + cluster.shutdown(); + } + } + Review Comment: can we rather than doing this sleep thing, have a test like this ``` @Test(timeout = 60000) public void testLastDirScannerFinishTimeIsUpdated() throws Exception { Configuration conf = getConfiguration(); cluster = new MiniDFSCluster.Builder(conf).build(); try { cluster.waitActive(); bpid = cluster.getNamesystem().getBlockPoolId(); final DataNode dn = cluster.getDataNodes().get(0); fds = DataNodeTestUtils.getFSDataset(dn); long lastDirScannerFinishTime = fds.getLastDirScannerFinishTime(); dn.getDirectoryScanner().run(); assertNotEquals(lastDirScannerFinishTime, fds.getLastDirScannerFinishTime()); } finally { cluster.shutdown(); } } ``` > Datanode should record last directory scan time. > ------------------------------------------------ > > Key: HDFS-17068 > URL: https://issues.apache.org/jira/browse/HDFS-17068 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: farmmamba > Assignee: farmmamba > Priority: Minor > Labels: pull-request-available > > I think it is useful for us to record last directory scan time for one > datanode. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org