acrites commented on code in PR #40639:
URL: https://github.com/apache/beam/pull/40639#discussion_r4589669107
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingModeExecutionContext.java:
##########
@@ -798,19 +802,46 @@ private Windmill.WorkItemCommitRequest.Builder
buildWorkItemTruncationRequestBui
return outputBuilder;
}
- private final long computeSourceBytesProcessed(String
sourceBytesCounterName) {
+ @VisibleForTesting
+ long computeSourceBytesProcessed(String sourceBytesCounterName) {
if (!(workExecutor instanceof DataflowMapTaskExecutor)) {
return 0L;
}
- HashMap<String, ElementCounter> counters =
- ((DataflowMapTaskExecutor) workExecutor)
- .getReadOperation()
- .receivers[0]
- .getOutputCounters();
+ // Note this is a problem for both custom source read operators and SDF
ParDos: extracting
+ // the byte count counter values here races with
StreamingWorkerStatusReporter, which also
+ // calls getAndReset on all modified counters to report to Dataflow. We
should find a more
Review Comment:
`StreamingWorkerStatusReporter` runs in a different periodic thread, but
it's not exactly a data-corruption type race. It's also calling `getAndReset`
on *all* of the counters. So we'd need to somehow special case these output
counters deep in the counter set stack to prevent them from being extracted
there, which doesn't seem too feasible. Ideally use something for source bytes
processed that lived outside the counter set and hence wasn't affected by
`StreamingWorkerStatusReporter`.
--
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]