riteshghorse commented on a change in pull request #15657:
URL: https://github.com/apache/beam/pull/15657#discussion_r732071146



##########
File path: sdks/go/pkg/beam/core/metrics/store.go
##########
@@ -174,36 +174,35 @@ type executionTracker struct {
        numberOfTransitions       int64
        millisSinceLastTransition time.Duration
        transitionsAtLastSample   int64
-}
-
-// executionState is used to store as atomic.Value in Store.
-type pTransformState struct {
-       pid   string
-       state bundleProcState
-}
-
-func newPTransformState(pid string, state bundleProcState) *pTransformState {
-       return &pTransformState{pid: pid, state: state}
+       currentState              bundleProcState
+       pid                       string
 }
 
 func SetPTransformState(ctx context.Context, state bundleProcState) {
        if bctx, ok := ctx.(*beamCtx); ok {
-               ps := newPTransformState(bctx.ptransformID, state)
-               bctx.pStore.Store(ps)
-               atomic.AddInt64(&bctx.transitions, 1)
+               pid := bctx.ptransformID
+               bctx.store.mu.Lock()
+               bctx.store.executionStore.pid = pid
+               bctx.store.executionStore.currentState = state
+               bctx.store.mu.Unlock()
+               atomic.AddInt64(&bctx.store.executionStore.numberOfTransitions, 
1)

Review comment:
       After having a separate lock, we are back at 2 allocs/op




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