shunping commented on code in PR #41074:
URL: https://github.com/apache/beam/pull/41074#discussion_r4747496774


##########
sdks/go/pkg/beam/runners/prism/internal/engine/data.go:
##########
@@ -200,19 +200,17 @@ func (d *TentativeData) AppendMultimapState(stateID 
LinkID, wKey, uKey, mapKey,
 //
 // The stateID has the Transform and Local fields populated, for the Transform 
and UserStateID respectively.
 func (d *TentativeData) ClearMultimapState(stateID LinkID, wKey, uKey, mapKey 
[]byte) {
-       kmap := d.clearState(stateID, wKey)
-       if kmap == nil {
+       kMap := d.clearState(stateID, wKey)
+       if kMap == nil {
                return
        }
-       // Nil the current entry to clear.
-       // Delete makes it difficult to delete the persisted stage state for 
the key.
-       userMap, ok := kmap[string(uKey)]
+       userMap, ok := kMap[string(uKey)]
        if !ok || userMap.Multimap == nil {
                return
        }
-       userMap.Multimap[string(mapKey)] = nil
-       // The Multimap field is aliased to the instance we stored in kmap,
-       // so we don't need to re-assign back to kmap after clearing the data 
from mapKey.
+       delete(userMap.Multimap, string(mapKey))
+       // Keep uKey in kMap so PersistBundle overwrites the stage state.
+       kMap[string(uKey)] = userMap

Review Comment:
   This line looks redundant, since this is where userMap is from.



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