6349
command *commandpb.StartChildWorkflowExecutionCommandAttributes,
6350
targetNamespaceID namespace.ID,
6352
>
opTag := tag.WorkflowActionChildWorkflowInitiated
6353
>
if err := ms.checkMutability(opTag); err != nil {
6354
return nil, nil, err
6355
}
6356
>
childTSC, childTSStateProp := propagateTimeSkippingToChild(ms.executionInfo)
mutable_state_impl.go
6357
>
event, batchID := ms.hBuilder.AddStartChildWorkflowExecutionInitiatedEvent(
6358
>
workflowTaskCompletedEventID,
6359
>
command,
6360
>
targetNamespaceID,
6361
>
childTSC,
6362
>
childTSStateProp,
6363
>
)
6364
>
ci, err := ms.ApplyStartChildWorkflowExecutionInitiatedEvent(batchID, event)
6365
>
if err != nil {
6366
return nil, nil, err
6367
}
6368
// TODO merge active & passive task generation
6370
>
event.GetEventId(),
6371
>
); err != nil {
6372
return nil, nil, err
6373
}
6375
}
6376
6377
// generateChildWorkflowRequestID generates a unique request ID for child workflow execution
6378
>
func (ms *MutableStateImpl) generateChildWorkflowRequestID(event *historypb.HistoryEvent) string {
mutable_state_impl.go
6379
>
return fmt.Sprintf("%s:%d:%d", ms.executionState.RunId, event.GetEventId(), event.GetVersion())
6380
>
}
6381
6382
func (ms *MutableStateImpl) ApplyStartChildWorkflowExecutionInitiatedEvent(
6383
batchID int64,
6384
event *historypb.HistoryEvent,
6386
>
initiatedEventID := event.GetEventId()
6387
>
attributes := event.GetStartChildWorkflowExecutionInitiatedEventAttributes()
6388
>
ci := &persistencespb.ChildExecutionInfo{
6389
>
Version: event.GetVersion(),
6390
>
InitiatedEventId: initiatedEventID,
6391
>
InitiatedEventBatchId: batchID,
6392
>
StartedEventId: common.EmptyEventID,
6393
>
StartedWorkflowId: attributes.GetWorkflowId(),
6394
>
CreateRequestId: ms.generateChildWorkflowRequestID(event),
6395
>
Namespace: attributes.GetNamespace(),
6396
>
NamespaceId: attributes.GetNamespaceId(),
6397
>
WorkflowTypeName: attributes.GetWorkflowType().GetName(),
6398
>
ParentClosePolicy: attributes.GetParentClosePolicy(),
6399
>
Priority: attributes.Priority,
6400
>
}
6401
>
6402
>
ms.pendingChildExecutionInfoIDs[ci.InitiatedEventId] = ci
6403
>
ms.updateChildExecutionInfos[ci.InitiatedEventId] = ci
6404
>
ms.approximateSize += ci.Size() + int64SizeBytes
6405
>
ms.executionInfo.ChildExecutionCount++
6406
>
6407
>
ms.writeEventToCache(event)
6408
>
return ci, nil
6409
>
}
6410
6411
func (ms *MutableStateImpl) AddChildWorkflowExecutionStartedEvent(