steveniemitz commented on code in PR #22190:
URL: https://github.com/apache/beam/pull/22190#discussion_r918239379
##########
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/ExecutionStateTracker.java:
##########
@@ -298,7 +304,17 @@ public long getNextLullReportMs() {
return nextLullReportMs;
}
- protected void takeSample(long millisSinceLastSample) {
+ void takeSample(long millisSinceLastSample) {
+ if (SAMPLING_UPDATER.compareAndSet(this, 0, 1)) {
Review Comment:
There's a race now between `removeTracker` removing the tracker from the
concurrent set (and them sampling it) and the sampling thread enumerating it
and sampling it. Previously the synchonrized block would prevent that race.
This is essentially pushing the lock down to the individual tracker instances
to prevent it being sampled concurrently.
--
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]