736
ctx context.Context,
737
request *persistence.SetWorkflowExecutionRequest,
738
>
) (*persistence.SetWorkflowExecutionResponse, error) {
context_impl.go
739
>
// do not try to get namespace cache within shard lock
740
>
namespaceID := namespace.ID(request.SetWorkflowSnapshot.ExecutionInfo.NamespaceId)
741
>
namespaceEntry, err := s.GetNamespaceRegistry().GetNamespaceByID(namespaceID)
742
>
if err != nil {
743
return nil, err
744
}
745
747
return nil, err
748
}
750
>
751
>
s.wLock()
752
>
753
>
// timeout check should be done within the shard lock, in case of shard lock contention
754
>
ctx, cancel, err := s.newDetachedContext(ctx)
755
>
if err != nil {
756
s.wUnlock()
757
return nil, err
758
}
760
>
761
>
if err := s.errorByState(); err != nil {
762
s.wUnlock()
763
return nil, err
764
}
765
766
>
if err := s.errorByNamespaceStateLocked(namespaceEntry.Name(), request.SetWorkflowSnapshot.ExecutionInfo.WorkflowId); err != nil {
context_impl.go
767
s.wUnlock()
768
return nil, err
769
}
770
771
>
snapShotRequestCompletionFn, err := s.taskKeyManager.setAndTrackTaskKeys(
context_impl.go
772
>
request.SetWorkflowSnapshot.Tasks,
773
>
)
774
>
if err != nil {
775
s.wUnlock()
776
return nil, err
777
}
778
780
>
s.wUnlock()
781
>
782
>
resp, err := s.executionManager.SetWorkflowExecution(ctx, request)
783
>
snapShotRequestCompletionFn(err)
784
>
if err = s.handleWriteError(request.RangeID, err); err != nil {
785
return nil, err
786
}
788
}
789