Skip to content

Commit

Permalink
Fix mutable state change not persisted bug (#4813)
Browse files Browse the repository at this point in the history
<!-- Describe what has changed in this PR -->
**What changed?**
* Persist mutable state changes if any event is reapplied

<!-- Tell your future self why have you made these changes -->
**Why?**
Fix issue introduced in #4091,
[ref](https://github.com/temporalio/temporal/pull/4091/files#r1306573612)

<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
N/A

<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
N/A

<!-- Is this PR a hotfix candidate or require that a notification be
sent to the broader community? (Yes/No) -->
**Is hotfix candidate?**
N/A
  • Loading branch information
wxing1292 committed Aug 27, 2023
1 parent df2167e commit 758ebb7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions service/history/api/reapplyevents/api.go
Expand Up @@ -177,7 +177,7 @@ func Invoke(
}, nil
}

_, err = eventsReapplier.ReapplyEvents(
reappliedEvents, err := eventsReapplier.ReapplyEvents(
ctx,
mutableState,
toReapplyEvents,
Expand All @@ -187,8 +187,14 @@ func Invoke(
shard.GetLogger().Error("failed to re-apply stale events", tag.Error(err))
return nil, err
}
if len(reappliedEvents) == 0 {
return &api.UpdateWorkflowAction{
Noop: true,
CreateWorkflowTask: false,
}, nil
}
return &api.UpdateWorkflowAction{
Noop: true,
Noop: false,
CreateWorkflowTask: false,
}, nil
},
Expand Down

0 comments on commit 758ebb7

Please sign in to comment.