transfer_queue_standby_task_executor.go ×12

Frontier kind: Joint frontier

unlabeled · c_006a03fc53b7

1 test · 8614 LOC · 255 files · introduces 1 test · 123 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges123 lines · 5 files
Tests
1 test

Contains — complete concept membership

All code (extent)
1785 ranges8614 lines · 255 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: 123 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/transfer_queue_standby_task_executor.go 100 introduced LOC · 12 ranges

Open complete file

103 // TODO: add error logs
104 err = nil
105 > case *tasks.CloseExecutionTask: transfer_queue_standby_task_executor.go
106 > err = t.processCloseExecution(ctx, task)
107 case *tasks.DeleteExecutionTask:
108 err = t.processDeleteExecutionTask(ctx, task, false)
294 ctx context.Context,
295 transferTask *tasks.CloseExecutionTask,
297 > processTaskIfClosed := true
298 > actionFn := func(ctx context.Context, wfContext historyi.WorkflowContext, mutableState historyi.MutableState, release historyi.ReleaseWorkflowContextFunc) (any, error) {
299 > if mutableState.IsWorkflowExecutionRunning() {
300 // this can happen if workflow is reset.
301 return nil, nil
302 }
303
304 > executionInfo := mutableState.GetExecutionInfo() transfer_queue_standby_task_executor.go
305 >
306 > closeVersion, err := mutableState.GetCloseVersion()
307 > if err != nil {
308 return nil, err
309 }
310 > err = CheckTaskVersion(t.shardContext, t.logger, mutableState.GetNamespaceEntry(), closeVersion, transferTask.Version, transferTask) transfer_queue_standby_task_executor.go
311 > if err != nil {
312 return nil, err
313 }
314
315 // verify if parent got the completion event
316 > verifyCompletionRecorded := mutableState.HasParentExecution() && executionInfo.NewExecutionRunId == "" transfer_queue_standby_task_executor.go
317 > if verifyCompletionRecorded {
318 > // load close event only if needed.
319 > completionEvent, err := mutableState.GetCompletionEvent(ctx)
320 > if err != nil {
321 return nil, err
322 }
323
324 > verifyCompletionRecorded = !ndc.IsTerminatedByResetter(completionEvent) transfer_queue_standby_task_executor.go
325 }
326
327 > if verifyCompletionRecorded { transfer_queue_standby_task_executor.go
328 > now := t.getCurrentTime()
329 > taskTime := transferTask.GetVisibilityTime()
330 > localVerificationTime := taskTime.Add(t.config.MaxLocalParentWorkflowVerificationDuration())
331 >
332 > resendParent := now.After(localVerificationTime) && mutableState.IsTransitionHistoryEnabled() && mutableState.CurrentVersionedTransition() != nil
333 >
334 > // Copy needed values from executionInfo before releasing mutable state
335 > parentNamespaceID := executionInfo.ParentNamespaceId
336 > parentWorkflowID := executionInfo.ParentWorkflowId
337 > parentRunID := executionInfo.ParentRunId
338 > parentInitiatedID := executionInfo.ParentInitiatedId
339 > parentInitiatedVersion := executionInfo.ParentInitiatedVersion
340 > parentClock := executionInfo.ParentClock
341 >
342 > // no need for mutable state anymore, release workflow lock
343 > release(nil)
344 >
345 > _, err := t.historyRawClient.VerifyChildExecutionCompletionRecorded(ctx, &historyservice.VerifyChildExecutionCompletionRecordedRequest{
346 > NamespaceId: parentNamespaceID,
347 > ParentExecution: &commonpb.WorkflowExecution{
348 > WorkflowId: parentWorkflowID,
349 > RunId: parentRunID,
350 > },
351 > ChildExecution: &commonpb.WorkflowExecution{
352 > WorkflowId: transferTask.WorkflowID,
353 > RunId: transferTask.RunID,
354 > },
355 > ParentInitiatedId: parentInitiatedID,
356 > ParentInitiatedVersion: parentInitiatedVersion,
357 > Clock: parentClock,
358 > ResendParent: resendParent,
359 > })
360 > switch err.(type) {
361 > case nil, *serviceerror.NamespaceNotFound, *serviceerror.Unimplemented:
362 > // Case 1: Target workflow is in the desired state.
363 > return nil, nil
364 > case *serviceerror.NotFound, *serviceerror.WorkflowNotReady:
365 > // Case 2: Target workflow is not in the desired state.
366 > // Returning a non-nil pointer as postActionInfo here to indicate that verification is not done yet.
367 > return &verifyCompletionRecordedPostActionInfo{
368 > parentWorkflowKey: &definition.WorkflowKey{
369 > NamespaceID: parentNamespaceID,
370 > WorkflowID: parentWorkflowID,
371 > RunID: parentRunID,
372 > },
373 > }, nil
374 > default:
375 > // Case 3: Verification itself failed.
376 > // NOTE: Wrapping the error as a verification error to prevent mutable state from being cleared and reloaded upon retry,
377 > // which is unnecessary as the error is in the target workflow, not this workflow.
378 > return nil, &verificationErr{
379 > msg: recordChildCompletionVerificationFailedMsg,
380 > err: err,
381 > }
382 }
383 }
385 }
386
387 > return t.processTransfer( transfer_queue_standby_task_executor.go
388 > ctx,
389 > processTaskIfClosed,
390 > transferTask,
391 > actionFn,
392 > getStandbyPostActionFn(
393 > transferTask,
394 > t.getCurrentTime,
395 > t.config.StandbyTaskMissingEventsDiscardDelay(transferTask.GetType()),
396 > t.checkParentWorkflowStillExistOnSourceBeforeDiscard,
397 > ),
398 > )
399 }
400
707 postActionInfo any,
708 logger log.Logger,
710 > if postActionInfo == nil {
711 return nil
712 }
713 > verifyCompletionInfo, ok := postActionInfo.(*verifyCompletionRecordedPostActionInfo) transfer_queue_standby_task_executor.go
714 > if !ok || verifyCompletionInfo.parentWorkflowKey == nil {
715 return standbyTransferTaskPostActionTaskDiscarded(ctx, taskInfo, postActionInfo, logger)
716 }
717
718 > if !executionExistsOnSource( transfer_queue_standby_task_executor.go
719 > ctx,
720 > *verifyCompletionInfo.parentWorkflowKey,
721 > getTaskArchetypeID(taskInfo),
722 > logger,
723 > t.clusterName,
724 > t.clientBean,
725 > t.shardContext.GetNamespaceRegistry(),
726 > t.shardContext.ChasmRegistry(),
727 > ) {
728 return standbyTransferTaskPostActionTaskDiscarded(ctx, taskInfo, nil, logger)
729 }
730 > return standbyTransferTaskPostActionTaskDiscarded(ctx, taskInfo, postActionInfo, logger) transfer_queue_standby_task_executor.go
731 }
go.temporal.io/server/api/historyservicemock/v1/service_grpc.pb.mock.go 13 introduced LOC · 3 ranges

Open complete file

1545
1546 // VerifyChildExecutionCompletionRecorded mocks base method.
1547 > func (m *MockHistoryServiceClient) VerifyChildExecutionCompletionRecorded(ctx context.Context, in *historyservice.VerifyChildExecutionCompletionRecordedRequest, opts ...grpc.CallOption) (*historyservice.VerifyChildExecutionCompletionRecordedResponse, error) { service_grpc.pb.mock.go
1548 > m.ctrl.T.Helper()
1549 > varargs := []any{ctx, in}
1550 > for _, a := range opts {
1551 varargs = append(varargs, a)
1552 }
1553 > ret := m.ctrl.Call(m, "VerifyChildExecutionCompletionRecorded", varargs...) service_grpc.pb.mock.go
1554 > ret0, _ := ret[0].(*historyservice.VerifyChildExecutionCompletionRecordedResponse)
1555 > ret1, _ := ret[1].(error)
1556 > return ret0, ret1
1557 }
1558
1559 // VerifyChildExecutionCompletionRecorded indicates an expected call of VerifyChildExecutionCompletionRecorded.
1560 > func (mr *MockHistoryServiceClientMockRecorder) VerifyChildExecutionCompletionRecorded(ctx, in any, opts ...any) *gomock.Call { service_grpc.pb.mock.go
1561 > mr.mock.ctrl.T.Helper()
1562 > varargs := append([]any{ctx, in}, opts...)
1563 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyChildExecutionCompletionRecorded", reflect.TypeOf((*MockHistoryServiceClient)(nil).VerifyChildExecutionCompletionRecorded), varargs...)
1564 > }
1565
1566 // VerifyFirstWorkflowTaskScheduled mocks base method.
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 5 introduced LOC · 1 range

Open complete file

3981 mi := &file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[52]
3982 if x != nil {
3983 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) request_response.pb.go
3984 > if ms.LoadMessageInfo() == nil {
3985 > ms.StoreMessageInfo(mi)
3986 > }
3987 > return ms
3988 }
3989 return mi.MessageOf(x)
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 3 introduced LOC · 1 range

Open complete file

7443 }
7444
7445 > func (ms *MutableStateImpl) IsTransitionHistoryEnabled() bool { mutable_state_impl.go
7446 > return ms.transitionHistoryEnabled
7447 > }
7448
7449 func (ms *MutableStateImpl) StartTransaction(
go.temporal.io/server/service/history/queues/metrics.go 2 introduced LOC · 1 range

Open complete file

66 case *tasks.WorkflowTask:
67 return metrics.TaskTypeTransferStandbyTaskWorkflowTask
68 > case *tasks.CloseExecutionTask: metrics.go
69 > return metrics.TaskTypeTransferStandbyTaskCloseExecution
70 case *tasks.CancelExecutionTask:
71 return metrics.TaskTypeTransferStandbyTaskCancelExecution