task_refresher.go ×4

Frontier kind: Code frontier

unlabeled · c_159ecdb547ec

7 tests · 4533 LOC · 195 files · introduces 0 tests · 37 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges37 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
713 ranges4533 lines · 195 files · Browse complete extent
All tests (intent)
7 testsBrowse 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

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

go.temporal.io/server/service/history/workflow/task_refresher.go 34 introduced LOC · 4 ranges

Open complete file

643 mutableState historyi.MutableState,
644 minVersionedTransition *persistencespb.VersionedTransition,
645 > ) error { task_refresher.go
646 >
647 > // NOTE: Not all callers of TaskRefresher goes through the closeTransaction process.
648 > // If we were to regenerate tasks here by doing a state machine transition and return
649 > // a TransitionOutput, then, we need to
650 > // 1. Call taskGenerator.GenerateDirtySubStateMachineTasks explictly to make sure
651 > // tasks are added to mutable state.
652 > // 2. Make GenerateDirtySubStateMachineTasks idempotent, so that if the logic
653 > // does go through closeTransaction, no duplicate tasks are generated.
654 > // 3. Explicitly clear transition state for sub state machines when not going through
655 > // closeTransaction path.
656 > // 4. Sub state machine will be marked as dirty, causing task refresh being counted
657 > // as a state transition. (if the logic does go through closeTransaction path,
658 > // though we don't actually have such cases today)
659 > // With the implementation below, we avoid the above complexities by directly generating
660 > // tasks and adding them to mutable state immediately.
661 >
662 > // Task refresher is only meant for regenerating tasks that has been generated before,
663 > // in previous state transitions, so we can just call generateSubStateMachineTask
664 > // which uses the last versioned transition.
665 > // In replication case, task refresher should be called after applying the state from source
666 > // cluster, which updated the transition history.
667 >
668 > var nodesToRefresh []*hsm.Node
669 > if err := mutableState.HSM().Walk(func(node *hsm.Node) error {
670 > if node.Parent == nil {
671 > // root node is mutable state and can't be refreshed
672 > return nil
673 > }
674
675 // Skip task generation if this state machine node has not been updated since minVersionedTransition.
687 }
688
689 > if len(nodesToRefresh) != 0 || mutableState.IsSubStateMachineDeleted() { task_refresher.go
690 if err := TrimStateMachineTimers(mutableState, minVersionedTransition); err != nil {
691 return err
693 }
694
695 > for _, node := range nodesToRefresh { task_refresher.go
696 taskRegenerator, err := hsm.MachineData[hsm.TaskRegenerator](node)
697 if err != nil {
718 }
719
720 > AddNextStateMachineTimerTask(mutableState) task_refresher.go
721 >
722 > return nil
723 }
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 3 introduced LOC · 1 range

Open complete file

9847 }
9848
9849 > func (ms *MutableStateImpl) IsSubStateMachineDeleted() bool { mutable_state_impl.go
9850 > return ms.subStateMachineDeleted
9851 > }
9852
9853 func (ms *MutableStateImpl) SetSuccessorRunID(runID string) {