lostluck commented on code in PR #29774:
URL: https://github.com/apache/beam/pull/29774#discussion_r1427350370


##########
sdks/go/pkg/beam/core/runtime/exec/pcollection.go:
##########
@@ -85,8 +86,8 @@ func (w *byteCounter) Write(p []byte) (n int, err error) {
 
 // ProcessElement increments the element count and sometimes takes size 
samples of the elements.
 func (p *PCollection) ProcessElement(ctx context.Context, elm *FullValue, 
values ...ReStream) error {
-       cur := atomic.AddInt64(&p.elementCount, 1)
-       if cur == p.nextSampleIdx {
+       cur := atomic.AddInt64(&p.bundleElementCount, 1)
+       if cur+p.pCollectionElementCount == p.nextSampleIdx {

Review Comment:
   Consider adding a comment here and/or where p.pCollectionElementCount is 
defined about the goal of this variable, and why it's safe to do this (local 
use only, instances aren't shared etc). I'm pretty confident in this change as 
is, but lets make it obvious to the next reader.



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

Reply via email to