scwhittle commented on code in PR #33073:
URL: https://github.com/apache/beam/pull/33073#discussion_r1836938485
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/ReadFromKafkaDoFn.java:
##########
@@ -665,6 +665,9 @@ private Map<String, Object> overrideBootstrapServersConfig(
return config;
}
+ // TODO: Collapse the two moving average trackers into a single accumulator
using a single Guava
+ // AtomicDouble. Note that this requires that a single thread will call
update and that while get
+ // may be called by multiple threads the method must only load the
accumulator itself.
Review Comment:
I think my confusion is due to getTotalSize taking param named numRecords.
It seems to instead be the partition backlog bytes and then the math makes more
sense.
Can we rename it and rename it at the call-site where it is also numRecords?
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/ReadFromKafkaDoFn.java:
##########
@@ -665,6 +665,9 @@ private Map<String, Object> overrideBootstrapServersConfig(
return config;
}
+ // TODO: Collapse the two moving average trackers into a single accumulator
using a single Guava
+ // AtomicDouble. Note that this requires that a single thread will call
update and that while get
+ // may be called by multiple threads the method must only load the
accumulator itself.
private static class AverageRecordSize {
private MovingAvg avgRecordSize;
Review Comment:
annotate these with GuardedBy("this")
--
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]