workflow_task_completed_handler.go ×9

Frontier kind: Code frontier

unlabeled · c_17ecdb993123

2 tests · 43341 LOC · 750 files · introduces 0 tests · 75 LOC · 7 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges75 lines · 7 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
10216 ranges43341 lines · 750 files · Browse complete extent
All tests (intent)
2 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.

7 files ranked by introduced lines: 75 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go 48 introduced LOC · 9 ranges

Open complete file

324 historyEvent, err = handler.handleCommandStartChildWorkflow(ctx, command.GetStartChildWorkflowExecutionCommandAttributes())
325
326 > case enumspb.COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: workflow_task_completed_handler.go
327 > historyEvent, err = handler.handleCommandUpsertWorkflowSearchAttributes(ctx, command.GetUpsertWorkflowSearchAttributesCommandAttributes())
328
329 case enumspb.COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES:
1309 _ context.Context,
1310 attr *commandpb.UpsertWorkflowSearchAttributesCommandAttributes,
1311 > ) (*historypb.HistoryEvent, error) { workflow_task_completed_handler.go
1312 > // get namespace name
1313 > executionInfo := handler.mutableState.GetExecutionInfo()
1314 > namespaceID := namespace.ID(executionInfo.NamespaceId)
1315 > namespaceEntry, err := handler.namespaceRegistry.GetNamespaceByID(namespaceID)
1316 > if err != nil {
1317 return nil, serviceerror.NewUnavailablef("Unable to get namespace for namespaceID: %v.", namespaceID)
1318 }
1319 > namespace := namespaceEntry.Name() workflow_task_completed_handler.go
1320 >
1321 > unaliasedSas, err := searchattribute.UnaliasFields(
1322 > handler.searchAttributesMapperProvider,
1323 > attr.GetSearchAttributes(),
1324 > namespace.String(),
1325 > )
1326 > if err != nil {
1327 return nil, handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
1328 }
1329 > if unaliasedSas != attr.GetSearchAttributes() { workflow_task_completed_handler.go
1330 // Create a copy of the `attr` to avoid modification of original `attr`,
1331 // which can be needed again in case of retry.
1336
1337 // valid search attributes for upsert
1338 > if err := handler.validateCommandAttr( workflow_task_completed_handler.go
1339 > func() (enumspb.WorkflowTaskFailedCause, error) {
1340 > return handler.attrValidator.ValidateUpsertWorkflowSearchAttributes(namespace, attr)
1341 > },
1342 ); err != nil || handler.stopProcessing {
1343 return nil, err
1345
1346 // blob size limit check
1347 > if err := handler.sizeLimitChecker.checkIfPayloadSizeExceedsLimit( workflow_task_completed_handler.go
1348 > metrics.CommandTypeTag(enumspb.COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES.String()),
1349 > payloadsMapSize(attr.GetSearchAttributes().GetIndexedFields()),
1350 > "UpsertWorkflowSearchAttributesCommandAttributes exceeds size limit.",
1351 > ); err != nil {
1352 return nil, handler.terminateWorkflow(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
1353 }
1355 // new search attributes size limit check
1356 // search attribute validation must be done after unaliasing keys
1357 > err = handler.sizeLimitChecker.checkIfSearchAttributesSizeExceedsLimit( workflow_task_completed_handler.go
1358 > &commonpb.SearchAttributes{
1359 > IndexedFields: payload.MergeMapOfPayload(
1360 > executionInfo.SearchAttributes,
1361 > attr.GetSearchAttributes().GetIndexedFields(),
1362 > ),
1363 > },
1364 > namespace,
1365 > metrics.CommandTypeTag(enumspb.COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES.String()),
1366 > )
1367 > if err != nil {
1368 return nil, handler.terminateWorkflow(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
1369 }
1370
1371 > return handler.mutableState.AddUpsertWorkflowSearchAttributesEvent( workflow_task_completed_handler.go
1372 > handler.workflowTaskCompletedID, attr,
1373 > )
1374 }
1375
1421 }
1422
1423 > func payloadsMapSize(fields map[string]*commonpb.Payload) int { workflow_task_completed_handler.go
1424 > result := 0
1425 >
1426 > for k, v := range fields {
1427 > result += len(k)
1428 > result += len(v.GetData())
1429 > }
1430 > return result
1431 }
1432
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 14 introduced LOC · 4 ranges

Open complete file

5232 workflowTaskCompletedEventID int64,
5233 command *commandpb.UpsertWorkflowSearchAttributesCommandAttributes,
5234 > ) (*historypb.HistoryEvent, error) { mutable_state_impl.go
5235 > opTag := tag.WorkflowActionUpsertWorkflowSearchAttributes
5236 > if err := ms.checkMutability(opTag); err != nil {
5237 return nil, err
5238 }
5239
5240 > event := ms.hBuilder.AddUpsertWorkflowSearchAttributesEvent(workflowTaskCompletedEventID, command) mutable_state_impl.go
5241 > ms.ApplyUpsertWorkflowSearchAttributesEvent(event)
5242 > // TODO merge active & passive task generation
5243 > if err := ms.taskGenerator.GenerateUpsertVisibilityTask(); err != nil {
5244 return nil, err
5245 }
5246 > return event, nil mutable_state_impl.go
5247 }
5248
5249 func (ms *MutableStateImpl) ApplyUpsertWorkflowSearchAttributesEvent(
5250 event *historypb.HistoryEvent,
5252 > upsertSearchAttr := event.GetUpsertWorkflowSearchAttributesEventAttributes().GetSearchAttributes().GetIndexedFields()
5253 > ms.approximateSize -= ms.executionInfo.Size()
5254 > ms.updateSearchAttributes(upsertSearchAttr)
5255 > ms.approximateSize += ms.executionInfo.Size()
5256 > }
5257
5258 func (ms *MutableStateImpl) AddWorkflowPropertiesModifiedEvent(
go.temporal.io/server/common/persistence/visibility/visibility_manager_impl.go 3 introduced LOC · 1 range

Open complete file

85 func (p *visibilityManagerImpl) ValidateCustomSearchAttributes(
86 searchAttributes map[string]any,
87 > ) (map[string]any, error) { visibility_manager_impl.go
88 > return p.store.ValidateCustomSearchAttributes(searchAttributes)
89 > }
90
91 func (p *visibilityManagerImpl) RecordWorkflowExecutionStarted(
go.temporal.io/server/common/persistence/visibility/visibility_manager_rate_limited.go 3 introduced LOC · 1 range

Open complete file

61 func (m *visibilityManagerRateLimited) ValidateCustomSearchAttributes(
62 searchAttributes map[string]any,
63 > ) (map[string]any, error) { visibility_manager_rate_limited.go
64 > return m.delegate.ValidateCustomSearchAttributes(searchAttributes)
65 > }
66
67 // Below are write APIs.
go.temporal.io/server/common/persistence/visibility/visiblity_manager_metrics.go 3 introduced LOC · 1 range

Open complete file

69 func (m *visibilityManagerMetrics) ValidateCustomSearchAttributes(
70 searchAttributes map[string]any,
71 > ) (map[string]any, error) { visiblity_manager_metrics.go
72 > return m.delegate.ValidateCustomSearchAttributes(searchAttributes)
73 > }
74
75 func (m *visibilityManagerMetrics) RecordWorkflowExecutionStarted(
go.temporal.io/server/service/history/api/get_history_util.go 2 introduced LOC · 1 range

Open complete file

369 case enumspb.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED:
370 searchAttributes = event.GetStartChildWorkflowExecutionInitiatedEventAttributes().GetSearchAttributes()
371 > case enumspb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: get_history_util.go
372 > searchAttributes = event.GetUpsertWorkflowSearchAttributesEventAttributes().GetSearchAttributes()
373 }
374 if searchAttributes != nil {
go.temporal.io/server/service/matching/pri_forwarder.go 2 introduced LOC · 1 range

Open complete file

273 return nil, err
274 } else if resp.TaskToken == nil {
275 > return nil, errNoTasks pri_forwarder.go
276 > }
277 return newInternalStartedTask(&startedTaskInfo{activityTaskInfo: resp}), nil
278 case enumspb.TASK_QUEUE_TYPE_NEXUS: