smengcl commented on code in PR #11542:
URL: https://github.com/apache/ozone/pull/11542#discussion_r4278073849


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java:
##########
@@ -524,6 +524,12 @@ public void 
testReconciliationTaskMetrics(ContainerLayoutVersion layout) throws
     ReplicationSupervisorMetrics replicationMetrics =
         ReplicationSupervisorMetrics.create(replicationSupervisor);
 
+    // The latency metric has millisecond resolution, so make each successful 
reconciliation take at least 1 ms.
+    doAnswer(invocation -> {
+      Thread.sleep(1);

Review Comment:
   Thread.sleep(1) does not return early on JDK 21: the JVM re-sleeps until the 
full duration has elapsed on the same clock that Time.monotonicNow() reads, so 
the before and after readings always differ by at least 1 ms. Coarser timer 
granularity only makes the sleep longer, which still satisfies > 0. Nothing 
interrupts this thread (the supervisor uses a direct executor, so the stub runs 
on the test thread), and if it were interrupted the exception would surface as 
a test failure rather than a silent pass. Keeping it at 1 ms.
   



-- 
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