427
ctx context.Context,
428
currentWorkflowConditionFailed *persistence.CurrentWorkflowConditionFailedError,
429
>
) (*historyservice.StartWorkflowExecutionResponse, StartOutcome, error) {
api.go
430
>
workflowID := s.request.StartRequest.WorkflowId
431
>
432
>
currentWorkflowStartTime := time.Time{}
433
>
if s.shardContext.GetConfig().EnableWorkflowIdReuseStartTimeValidation(s.namespace.Name().String()) &&
434
>
currentWorkflowConditionFailed.StartTime != nil {
435
currentWorkflowStartTime = *currentWorkflowConditionFailed.StartTime
436
}
437
438
>
workflowKey := definition.NewWorkflowKey(
api.go
439
>
s.namespace.ID().String(),
440
>
workflowID,
441
>
currentWorkflowConditionFailed.RunID,
442
>
)
443
>
444
>
// Using a new RunID here to simplify locking: MultiOperation, that re-uses the Starter, is creating
445
>
// a locked workflow context for each new workflow. Using a fresh RunID prevents a deadlock with the
446
>
// previously created workflow context.
447
>
newRunID := primitives.NewUUID().String()
448
>
449
>
currentExecutionUpdateAction, err := api.ResolveDuplicateWorkflowID(
450
>
s.shardContext,
451
>
workflowKey,
452
>
s.namespace,
453
>
newRunID,
454
>
currentWorkflowConditionFailed.State,
455
>
currentWorkflowConditionFailed.Status,
456
>
currentWorkflowConditionFailed.RequestIDs,
457
>
currentWorkflowConditionFailed.FirstExecutionRunID,
458
>
s.request.StartRequest.GetWorkflowIdReusePolicy(),
459
>
s.request.StartRequest.GetWorkflowIdConflictPolicy(),
460
>
currentWorkflowStartTime,
461
>
s.request.ParentExecutionInfo,
462
>
s.request.ChildWorkflowOnly,
463
>
)
464
>
465
>
switch {
466
case errors.Is(err, api.ErrUseCurrentExecution):
467
return s.handleUseExistingWorkflowOnConflictOptions(