workflow_task_state_machine.go ×4

Frontier kind: Joint frontier

unlabeled · c_9ec295c88a5c

1 test · 8421 LOC · 245 files · introduces 1 test · 43 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges43 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
1790 ranges8421 lines · 245 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.

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

go.temporal.io/server/service/history/workflow/workflow_task_state_machine.go 39 introduced LOC · 4 ranges

Open complete file

1524 // If execution info in mutable state has speculative workflow task, then
1525 // convert it to normal workflow task before persisting.
1526 > m.ms.RemoveSpeculativeWorkflowTaskTimeoutTask() workflow_task_state_machine.go
1527 >
1528 > if !m.ms.workflowTaskUpdated {
1529 // Whenever we close transaction, speculative workflow task will be converted to normal.
1530 // This means when there's a speculative workflow task, we haven't closed the transaction for the
1537 }
1538
1539 > m.ms.executionInfo.WorkflowTaskType = enumsspb.WORKFLOW_TASK_TYPE_NORMAL workflow_task_state_machine.go
1540 > metrics.SpeculativeWorkflowTaskCommits.With(m.metricsHandler).Record(1,
1541 > metrics.ReasonTag("close_transaction"))
1542 >
1543 > wt := m.getWorkflowTaskInfo()
1544 >
1545 > scheduledEvent := m.ms.hBuilder.AddWorkflowTaskScheduledEvent(
1546 > wt.TaskQueue,
1547 > durationpb.New(wt.WorkflowTaskTimeout),
1548 > wt.Attempt,
1549 > wt.ScheduledTime,
1550 > )
1551 >
1552 > if scheduledEvent.EventId != wt.ScheduledEventID {
1553 return serviceerror.NewInternalf("it could be a bug, scheduled event Id: %d for normal workflow task doesn't match the one from speculative workflow task: %d", scheduledEvent.EventId, wt.ScheduledEventID)
1554 }
1555
1556 > if wtAlreadyStarted := wt.StartedEventID != common.EmptyEventID; wtAlreadyStarted { workflow_task_state_machine.go
1557 > // If WT was already started then started event is written to the history and
1558 > // timeout timer task (for START_TO_CLOSE timeout) is created.
1559 >
1560 > _ = m.ms.hBuilder.AddWorkflowTaskStartedEvent(
1561 > scheduledEvent.EventId,
1562 > wt.RequestID,
1563 > "",
1564 > wt.StartedTime,
1565 > wt.SuggestContinueAsNew,
1566 > wt.HistorySizeBytes,
1567 > nil,
1568 > wt.BuildIdRedirectCounter,
1569 > wt.SuggestContinueAsNewReasons,
1570 > m.targetWorkerDeploymentVersionChangedForStartedEvent(),
1571 > )
1572 > m.ms.hBuilder.FlushAndCreateNewBatch()
1573 >
1574 > if err := m.ms.taskGenerator.GenerateStartWorkflowTaskTasks(
1575 > scheduledEvent.EventId,
1576 > ); err != nil {
1577 return err
1578 }
go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/api.go 4 introduced LOC · 1 range

Open complete file

214 // We don't accept the request to create a new workflow task if the workflow is paused.
215 if ms.IsWorkflowExecutionStatusPaused() && request.GetForceCreateNewWorkflowTask() {
216 > // Mutable state wasn't changed yet and doesn't have to be cleared. api.go
217 > releaseLeaseWithError = false
218 > return nil, serviceerror.NewFailedPrecondition("Workflow is paused and force create new workflow task is not allowed.")
219 > }
220
221 behavior := request.GetVersioningBehavior()