version_workflow.go ×10

Frontier kind: Code frontier

unlabeled · c_0177d50c209e

57 tests · 2768 LOC · 133 files · introduces 0 tests · 44 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges44 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
420 ranges2768 lines · 133 files · Browse complete extent
All tests (intent)
57 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.

1 file ranked by introduced lines: 44 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/workerdeployment/version_workflow.go 44 introduced LOC · 10 ranges

Open complete file

1340 // syncTaskQueuesAsync must be called within the lock. It first increments the version revision number and then
1341 // starts async propagation of version data (and routing info if given) to all task queues.
1342 > func (d *VersionWorkflowRunner) syncTaskQueuesAsync(ctx workflow.Context, routingConfig *deploymentpb.RoutingConfig, versionDataChanged bool) { version_workflow.go
1343 > startTime := workflow.Now(ctx)
1344 >
1345 > withRevisionNumber := d.hasMinVersion(VersionDataRevisionNumber)
1346 > if withRevisionNumber && versionDataChanged {
1347 d.GetVersionState().RevisionNumber++
1348 }
1349
1350 > versionData := &deploymentspb.WorkerDeploymentVersionData{ version_workflow.go
1351 > Status: d.VersionState.Status,
1352 > RevisionNumber: d.GetVersionState().GetRevisionNumber(),
1353 > UpdateTime: timestamppb.New(workflow.Now(ctx)),
1354 > Deleted: d.deleteVersion,
1355 > }
1356 >
1357 > // Batches must be calculated within the lock otherwise previous update might be called on future task queues unintentionally.
1358 > batches := d.batchTaskQueuesForSync()
1359 >
1360 > // Increment counter to prevent CaN while propagation is in progress.
1361 > // This must be done in the main goroutine otherwise the wf may CaN before getting to it.
1362 > d.asyncPropagationsInProgress++
1363 >
1364 > // Start async propagation - DON'T WAIT
1365 > workflow.Go(ctx, func(gCtx workflow.Context) {
1366 > d.executeAndTrackAsyncPropagation(gCtx, batches, routingConfig, versionData)
1367 >
1368 > if routingConfig != nil && withRevisionNumber {
1369 // Signal deployment workflow that routing config propagation completed
1370 d.signalPropagationComplete(gCtx, routingConfig.GetRevisionNumber())
1371 }
1372
1373 > d.metrics.Timer(metrics.VersioningDataPropagationLatency.Name()).Record(workflow.Now(ctx).Sub(startTime)) version_workflow.go
1374 > // Decrement counter when propagation completes
1375 > d.asyncPropagationsInProgress--
1376 })
1377 }
1383 routingConfig *deploymentpb.RoutingConfig,
1384 versionData *deploymentspb.WorkerDeploymentVersionData,
1385 > ) { version_workflow.go
1386 > // Number of batches to check might be less than the original batches because some TQ might not update.
1387 > var taskQueueMaxVersionsToCheck []map[string]int64
1388 >
1389 > for _, batch := range batches {
1390 if d.cancelPropagations {
1391 // Version is deleting. no need to continue propagation. Also can skip sending signal to deployment workflow.
1405 }
1406 }
1407 > if d.cancelPropagations { version_workflow.go
1408 // Version is deleting. no need to continue propagation. Also can skip sending signal to deployment workflow.
1409 return
1411
1412 // Wait for propagation to complete only for task queues where config changed
1413 > for _, batch := range taskQueueMaxVersionsToCheck { version_workflow.go
1414 activityCtx := workflow.WithActivityOptions(ctx, propagationActivityOptions)
1415 err := workflow.ExecuteActivity(
1426 }
1427
1428 > if !d.hasMinVersion(VersionDataRevisionNumber) { version_workflow.go
1429 if routingConfig != nil {
1430 d.syncSummary(ctx)
1435 }
1436
1437 > func (d *VersionWorkflowRunner) batchTaskQueuesForSync() [][]*deploymentspb.SyncDeploymentVersionUserDataRequest_SyncUserData { version_workflow.go
1438 > state := d.GetVersionState()
1439 > // Build sync request batches with routing config (async mode)
1440 > batches := make([][]*deploymentspb.SyncDeploymentVersionUserDataRequest_SyncUserData, 0)
1441 > var currentBatch []*deploymentspb.SyncDeploymentVersionUserDataRequest_SyncUserData
1442 >
1443 > for _, tqName := range workflow.DeterministicKeys(state.TaskQueueFamilies) {
1444 byType := state.TaskQueueFamilies[tqName]
1445 var types []enumspb.TaskQueueType