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



##########
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:
       I'm a bit concerned with these lines here where one is accessing the 
internal Restrictions. They're being accessed outside of the lock's critical 
section. Should we have a Restriction() interface{} method to get the 
appropriate restriction in a thread safe manner? 
   




----------------------------------------------------------------
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:
[email protected]


Reply via email to