Skip to content

Commit

Permalink
Only generate replication task for updated which has history events (#…
Browse files Browse the repository at this point in the history
…973)

WorkflowExecutionContext should check if the update has new history
events before generating replication tasks.
  • Loading branch information
samarabbas authored and wxing1292 committed Jul 17, 2018
1 parent 37c98ee commit 152d202
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions service/history/workflowExecutionContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ func (c *workflowExecutionContext) updateHelper(builder *historyBuilder, transfe
}
executionInfo := c.msBuilder.GetExecutionInfo()

hasNewHistoryEvents := builder.history != nil && len(builder.history) > 0
// Some operations only update the mutable state. For example RecordActivityTaskHeartbeat.
if builder.history != nil && len(builder.history) > 0 {
if hasNewHistoryEvents {
firstEvent := builder.GetFirstEvent()
// Transient decision events need to be written as a separate batch
if builder.HasTransientEvents() {
Expand Down Expand Up @@ -259,7 +260,8 @@ func (c *workflowExecutionContext) updateHelper(builder *historyBuilder, transfe
}

var replicationTasks []persistence.Task
if createReplicationTask {
// Check if the update resulted in new history events before generating replication task
if hasNewHistoryEvents && createReplicationTask {
// Let's create a replication task as part of this update
replicationTasks = append(replicationTasks, c.msBuilder.CreateReplicationTask())
}
Expand Down

0 comments on commit 152d202

Please sign in to comment.