context_impl.go ×8

Frontier kind: Joint frontier

unlabeled · c_b867fdab8725

1 test · 8634 LOC · 251 files · introduces 1 test · 83 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
20 ranges83 lines · 5 files
Tests
1 test

Contains — complete concept membership

All code (extent)
1863 ranges8634 lines · 251 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

5 files ranked by introduced lines: 83 introduced LOC across 20 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/shard/context_impl.go 28 introduced LOC · 8 ranges

Open complete file

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
746 > if err := s.ioSemaphoreAcquire(ctx); err != nil { context_impl.go
747 return nil, err
748 }
749 > defer s.ioSemaphoreRelease() context_impl.go
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 }
759 > defer cancel() context_impl.go
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
779 > request.RangeID = s.getRangeIDLocked() context_impl.go
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 }
787 > return resp, nil context_impl.go
788 }
789
go.temporal.io/server/service/history/workflow/transaction_impl.go 20 introduced LOC · 5 ranges

Open complete file

221 archetypeID chasm.ArchetypeID,
222 workflowSnapshot *persistence.WorkflowSnapshot,
223 > ) error { transaction_impl.go
224 >
225 > engine, err := t.shard.GetEngine(ctx)
226 > if err != nil {
227 return err
228 }
229 > _, err = setWorkflowExecution(ctx, t.shard, &persistence.SetWorkflowExecutionRequest{ transaction_impl.go
230 > ShardID: t.shard.GetShardID(),
231 > // RangeID , this is set by shard context
232 > ArchetypeID: archetypeID,
233 > SetWorkflowSnapshot: *workflowSnapshot,
234 > })
235 > if persistence.OperationPossiblySucceeded(err) {
236 > NotifyOnExecutionSnapshot(engine, workflowSnapshot)
237 > }
238 > if err != nil {
239 return err
240 }
241
242 > return nil transaction_impl.go
243 }
244
566 shardContext historyi.ShardContext,
567 request *persistence.SetWorkflowExecutionRequest,
568 > ) (*persistence.SetWorkflowExecutionResponse, error) { transaction_impl.go
569 >
570 > resp, err := shardContext.SetWorkflowExecution(ctx, request)
571 > if err != nil {
572 shardContext.GetLogger().Error(
573 "Set workflow execution operation failed.",
go.temporal.io/server/service/history/workflow/context.go 19 introduced LOC · 4 ranges

Open complete file

893 shardContext historyi.ShardContext,
894 transactionPolicy historyi.TransactionPolicy,
895 > ) (retError error) { context.go
896 > defer func() {
897 > if retError != nil {
898 c.Clear()
899 }
902 // reconcileTaskCompletionBuffer drops an orphaned buffer for the pagination of
903 // RespondWorkflowTaskCompleted requests.
904 > c.reconcileTaskCompletionBuffer() context.go
905 >
906 > resetWorkflowSnapshot, resetWorkflowEventsSeq, err := c.MutableState.CloseTransactionAsSnapshot(
907 > ctx,
908 > transactionPolicy,
909 > )
910 > if err != nil {
911 return err
912 }
913 > if len(resetWorkflowEventsSeq) != 0 { context.go
914 > metrics.ClosedWorkflowBufferEventCount.With(c.metricsHandler).Record(1)
915 > c.logger.Warn("SetWorkflowExecution encountered new events")
916 > }
917
918 > return NewTransaction(shardContext).SetWorkflowExecution( context.go
919 > ctx,
920 > c.archetypeID,
921 > resetWorkflowSnapshot,
922 > )
923 }
924
go.temporal.io/server/common/persistence/data_interfaces_mock.go 11 introduced LOC · 2 ranges

Open complete file

578
579 // SetWorkflowExecution mocks base method.
580 > func (m *MockExecutionManager) SetWorkflowExecution(ctx context.Context, request *SetWorkflowExecutionRequest) (*SetWorkflowExecutionResponse, error) { data_interfaces_mock.go
581 > m.ctrl.T.Helper()
582 > ret := m.ctrl.Call(m, "SetWorkflowExecution", ctx, request)
583 > ret0, _ := ret[0].(*SetWorkflowExecutionResponse)
584 > ret1, _ := ret[1].(error)
585 > return ret0, ret1
586 > }
587
588 // SetWorkflowExecution indicates an expected call of SetWorkflowExecution.
589 > func (mr *MockExecutionManagerMockRecorder) SetWorkflowExecution(ctx, request any) *gomock.Call { data_interfaces_mock.go
590 > mr.mock.ctrl.T.Helper()
591 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWorkflowExecution", reflect.TypeOf((*MockExecutionManager)(nil).SetWorkflowExecution), ctx, request)
592 > }
593
594 // TrimHistoryBranch mocks base method.
go.temporal.io/server/service/history/workflow/util.go 5 introduced LOC · 1 range

Open complete file

77
78 if workflowTask := mutableState.GetStartedWorkflowTask(); workflowTask != nil {
79 > if _, err := failWorkflowTask( util.go
80 > mutableState,
81 > workflowTask,
82 > enumspb.WORKFLOW_TASK_FAILED_CAUSE_FORCE_CLOSE_COMMAND,
83 > ); err != nil {
84 return err
85 }