Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: non global domain workflow, when started, should not generate… #862

Merged
merged 2 commits into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,11 @@ func (e *historyEngineImpl) StartWorkflowExecution(startRequest *h.StartWorkflow
return nil, err
}
msBuilder.GetExecutionInfo().LastFirstEventID = startedEvent.GetEventId()
if msBuilder.GetReplicationState() != nil {
msBuilder.UpdateReplicationStateLastEventID("", msBuilder.GetCurrentVersion(), msBuilder.GetNextEventID()-1)
}

createReplicationTask := e.shard.GetService().GetClusterMetadata().IsGlobalDomainEnabled()
createReplicationTask := msBuilder.GetReplicationState() != nil
var replicationState *persistence.ReplicationState
var replicationTasks []persistence.Task
if createReplicationTask {
msBuilder.UpdateReplicationStateLastEventID("", msBuilder.GetCurrentVersion(), msBuilder.GetNextEventID()-1)
replicationState = msBuilder.GetReplicationState()
replicationTask := &persistence.HistoryReplicationTask{
FirstEventID: common.FirstEventID,
Expand Down Expand Up @@ -1955,14 +1952,11 @@ func (e *historyEngineImpl) SignalWithStartWorkflowExecution(ctx context.Context
return nil, err
}
msBuilder.GetExecutionInfo().LastFirstEventID = startedEvent.GetEventId()
if msBuilder.GetReplicationState() != nil {
msBuilder.UpdateReplicationStateLastEventID("", msBuilder.GetCurrentVersion(), msBuilder.GetNextEventID()-1)
}

createReplicationTask := e.shard.GetService().GetClusterMetadata().IsGlobalDomainEnabled()
createReplicationTask := msBuilder.GetReplicationState() != nil
var replicationState *persistence.ReplicationState
var replicationTasks []persistence.Task
if createReplicationTask {
msBuilder.UpdateReplicationStateLastEventID("", msBuilder.GetCurrentVersion(), msBuilder.GetNextEventID()-1)
replicationState = msBuilder.GetReplicationState()
replicationTask := &persistence.HistoryReplicationTask{
FirstEventID: common.FirstEventID,
Expand All @@ -1988,6 +1982,7 @@ func (e *historyEngineImpl) SignalWithStartWorkflowExecution(ctx context.Context
NextEventID: msBuilder.GetNextEventID(),
LastProcessedEvent: common.EmptyEventID,
TransferTasks: transferTasks,
ReplicationTasks: replicationTasks,
DecisionVersion: decisionVersion,
DecisionScheduleID: decisionScheduleID,
DecisionStartedID: decisionStartID,
Expand Down
1 change: 1 addition & 0 deletions service/history/historyReplicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ func (r *historyReplicator) replicateWorkflowStarted(context *workflowExecutionC

createWorkflow := func(isBrandNew bool, prevRunID string) error {
_, err = r.shard.CreateWorkflowExecution(&persistence.CreateWorkflowExecutionRequest{
// NOTE: should not set the replication task, since we are in the standby
RequestID: executionInfo.CreateRequestID,
DomainID: domainID,
Execution: execution,
Expand Down
2 changes: 2 additions & 0 deletions service/history/mutableStateBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,8 @@ func (e *mutableStateBuilder) ReplicateWorkflowExecutionContinuedAsNewEvent(sour
setTaskVersion(newStateBuilder.GetCurrentVersion(), newTransferTasks, nil)

e.continueAsNew = &persistence.CreateWorkflowExecutionRequest{
// NOTE: there is no replication task for the start / decision scheduled event,
// the above 2 events will be replicated along with previous continue as new event.
RequestID: uuid.New(),
DomainID: domainID,
Execution: newExecution,
Expand Down