wenbingshen commented on code in PR #3637:
URL: https://github.com/apache/bookkeeper/pull/3637#discussion_r1102359160
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorPeriodicCheckTest.java:
##########
@@ -751,6 +737,24 @@ CountDownLatch getLatch() {
void setLatch(CountDownLatch latch) {
latchRef.set(latch);
}
+
+ private static class AuditorTestWrapperTask extends AuditorTask {
+ private final AuditorTask innerTask;
+ private final AtomicReference<CountDownLatch> latchRef;
Review Comment:
@horizonzy I think there are several reasons for defining latchRef:
1. Before this PR, the original author has defined latchRef in this test, I
just try to ensure that its content does not change and the unit test can pass
2. latchRef is only wrapped in three tasks: auditorCheckAllLedgersTask,
auditorPlacementPolicyCheckTask and auditorReplicasCheckTask
3. In the unit test, every time any task is tested, the conf will be changed
and the other two tasks will be disabled.
4. LatchRef will countDown() only after the execution of the AuditorTask
core logic of the unit test is completed, so that the unit test can then judge
the correctness of the metrics in the verification operation and whether it
meets expectations.
5. latchRef is used to ensure the execution order among multiple threads
6. If there is no better implementation, we can keep the original author's
latchRef implementation
--
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]