You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/07/10 22:45:32 UTC

[GitHub] [beam] youngoli commented on a change in pull request #12215: [BEAM-10310] Adding thread-safe restriction tracker wrapper.

youngoli commented on a change in pull request #12215:
URL: https://github.com/apache/beam/pull/12215#discussion_r453109313



##########
File path: sdks/go/pkg/beam/io/synthetic/source.go
##########
@@ -124,8 +125,8 @@ func (fn *sourceFn) Setup() {
 // ProcessElement creates a number of random elements based on the restriction
 // tracker received. Each element is a random byte slice key and value, in the
 // form of KV<[]byte, []byte>.
-func (fn *sourceFn) ProcessElement(rt *offsetrange.Tracker, config SourceConfig, emit func([]byte, []byte)) error {
-	for i := rt.Rest.Start; rt.TryClaim(i) == true; i++ {
+func (fn *sourceFn) ProcessElement(rt *sdf.LockRTracker, _ SourceConfig, emit func([]byte, []byte)) error {
+	for i := rt.Rt.(*offsetrange.Tracker).Rest.Start; rt.TryClaim(i) == true; i++ {

Review comment:
       Hmm, that's a good point. I didn't think about it much because it was fine before, but yeah this wouldn't work now. A split could theoretically be happening while that line is being called, and the tracker would be modified. I'll try adding a getter.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org