slfan1989 commented on code in PR #8824:
URL: https://github.com/apache/hadoop/pull/8824#discussion_r4572771545


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java:
##########
@@ -156,6 +157,72 @@ public void testInvalidDirectoryScanThreadsUsesDefault() 
throws Exception {
     }
   }
 
+  /**
+   * HDFS-17995: The scanner should wait the configured interval between the
+   * end of one scan and the start of the next one, so a scan that takes
+   * longer than the interval does not cause scans to run back-to-back.
+   */
+  @Test
+  @Timeout(value = 60)
+  public void testScanScheduledWithFixedDelay() throws Exception {
+    final long intervalMs = 1000L;
+    final long slowScanMs = 1500L;
+    final int expectedScans = 3;
+    Configuration conf = getConfiguration();
+    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();

Review Comment:
   Thanks for adding coverage for the fixed delay.
   
   `MiniDFSCluster` starts its own DirectoryScanner, so both scanners can write 
timestamps to `scans` through the shared fault injector. I reproduced an 
assertion failure by controlling the initial delays so their runs overlapped.
   
   Could we set `dfs.datanode.directoryscan.interval` to `-1` before building 
the cluster, then set it to `1` second before creating the scanner under test?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to