transaction_manager_new_workflow.go ×7

Frontier kind: Code frontier

unlabeled · c_8cc24da00029

3 tests · 2864 LOC · 139 files · introduces 0 tests · 58 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges58 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
429 ranges2864 lines · 139 files · Browse complete extent
All tests (intent)
3 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: 58 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/ndc/transaction_manager_new_workflow.go 48 introduced LOC · 7 ranges

Open complete file

107
108 if !targetWorkflowIsNewer {
109 > // target workflow is older than current workflow, need to suppress the target workflow transaction_manager_new_workflow.go
110 > return r.executeTransaction(
111 > ctx,
112 > nDCTransactionPolicyCreateAsZombie,
113 > currentWorkflow,
114 > targetWorkflow,
115 > )
116 > }
117
118 // target workflow is newer than current workflow
194 currentWorkflow Workflow,
195 targetWorkflow Workflow,
197 >
198 > targetWorkflowPolicy, err := targetWorkflow.SuppressBy(
199 > currentWorkflow,
200 > )
201 > if err != nil {
202 return err
203 }
204 > if !r.bypassVersionSemanticsCheck && targetWorkflowPolicy != historyi.TransactionPolicyPassive { transaction_manager_new_workflow.go
205 return serviceerror.NewInternal("transactionMgrForNewWorkflow createAsZombie encountered target workflow policy not being passive")
206 }
208 // release lock on current workflow, since current cluster maybe the active cluster
209 // and events maybe reapplied to current workflow
210 > currentWorkflow.GetReleaseFn()(nil) transaction_manager_new_workflow.go
211 > currentWorkflow = nil
212 >
213 > ms := targetWorkflow.GetMutableState()
214 >
215 > eventReapplyCandidates := ms.GetReapplyCandidateEvents()
216 > targetWorkflowSnapshot, targetWorkflowEventsSeq, err := ms.CloseTransactionAsSnapshot(
217 > ctx,
218 > targetWorkflowPolicy,
219 > )
220 > if err != nil {
221 return err
222 }
223
224 > if len(targetWorkflowEventsSeq) != 0 { transaction_manager_new_workflow.go
225 if err := targetWorkflow.GetContext().ReapplyEvents(
226 ctx,
249
250 // target workflow is in zombie state, no need to update current record.
251 > createMode := persistence.CreateWorkflowModeBypassCurrent transaction_manager_new_workflow.go
252 > prevRunID := ""
253 > prevLastWriteVersion := int64(0)
254 > err = targetWorkflow.GetContext().CreateWorkflowExecution(
255 > ctx,
256 > r.shardContext,
257 > createMode,
258 > prevRunID,
259 > prevLastWriteVersion,
260 > ms,
261 > targetWorkflowSnapshot,
262 > targetWorkflowEventsSeq,
263 > historyi.TransactionPolicyPassive,
264 > )
265 > switch err.(type) {
266 case nil:
267 return nil
325 )
326
327 > case nDCTransactionPolicyCreateAsZombie: transaction_manager_new_workflow.go
328 > return r.createAsZombie(
329 > ctx,
330 > currentWorkflow,
331 > targetWorkflow,
332 > )
333
334 case nDCTransactionPolicySuppressCurrentAndCreateAsCurrent:
go.temporal.io/server/service/history/interfaces/mutable_state_mock.go 10 introduced LOC · 2 ranges

Open complete file

2636
2637 // GetReapplyCandidateEvents mocks base method.
2638 > func (m *MockMutableState) GetReapplyCandidateEvents() []*history.HistoryEvent { mutable_state_mock.go
2639 > m.ctrl.T.Helper()
2640 > ret := m.ctrl.Call(m, "GetReapplyCandidateEvents")
2641 > ret0, _ := ret[0].([]*history.HistoryEvent)
2642 > return ret0
2643 > }
2644
2645 // GetReapplyCandidateEvents indicates an expected call of GetReapplyCandidateEvents.
2646 > func (mr *MockMutableStateMockRecorder) GetReapplyCandidateEvents() *gomock.Call { mutable_state_mock.go
2647 > mr.mock.ctrl.T.Helper()
2648 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReapplyCandidateEvents", reflect.TypeOf((*MockMutableState)(nil).GetReapplyCandidateEvents))
2649 > }
2650
2651 // GetRequestCancelInfo mocks base method.