version_workflow.go ×13

Frontier kind: Code frontier

unlabeled · c_da7b470ebbbc

74 tests · 2815 LOC · 133 files · introduces 0 tests · 36 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges36 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
440 ranges2815 lines · 133 files · Browse complete extent
All tests (intent)
74 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: 36 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/workerdeployment/version_workflow.go 26 introduced LOC · 13 ranges

Open complete file

707 }
708
709 > func (d *VersionWorkflowRunner) handleRegisterWorker(ctx workflow.Context, args *deploymentspb.RegisterWorkerInVersionArgs) error { version_workflow.go
710 > // Should not ensure not deleted, instead the version would revive if deleted.
711 > if workflow.GetInfo(ctx).GetContinueAsNewSuggested() {
712 // History is too large, do not accept new updates until wf CaNs.
713 // Since this needs workflow context we cannot do it in validators.
716
717 // use lock to enforce only one update at a time
718 > err := d.lock.Lock(ctx) version_workflow.go
719 > if err != nil {
720 d.logger.Error("Could not acquire workflow lock")
721 return err
722 }
723 > defer func() { version_workflow.go
724 > // although the handler might have not changed the state and had returned an error, still
725 > // it's better to CaN because some history events are built now.
726 > d.setStateChanged()
727 > d.lock.Unlock()
728 > }()
729
730 > withRevisionNumbers := d.hasMinVersion(VersionDataRevisionNumber) version_workflow.go
731 >
732 > if !withRevisionNumbers { // No need to do this with version data revision number protection
733 // In case this version just got deleted, we wait until it finished propagating delete to all task queues before reviving it
734 err = workflow.Await(ctx, func() bool {
740 }
741
742 > if d.deleteVersion { version_workflow.go
743 if workflow.GetVersion(ctx, "awaitSerialDelete", workflow.DefaultVersion, 1) == workflow.DefaultVersion {
744 // In case it was marked as deleted we make it undeleted
762
763 // Add the task queue to the local state.
764 > if d.VersionState.TaskQueueFamilies == nil { version_workflow.go
765 d.VersionState.TaskQueueFamilies = make(map[string]*deploymentspb.VersionLocalState_TaskQueueFamilyData)
766 }
767 > if d.VersionState.TaskQueueFamilies[args.TaskQueueName] == nil { version_workflow.go
768 d.VersionState.TaskQueueFamilies[args.TaskQueueName] = &deploymentspb.VersionLocalState_TaskQueueFamilyData{}
769 }
770 > if d.VersionState.TaskQueueFamilies[args.TaskQueueName].TaskQueues == nil { version_workflow.go
771 d.VersionState.TaskQueueFamilies[args.TaskQueueName].TaskQueues = make(map[int32]*deploymentspb.TaskQueueVersionData)
772 }
773
774 > if _, ok := d.VersionState.TaskQueueFamilies[args.TaskQueueName].TaskQueues[int32(args.TaskQueueType)]; ok { version_workflow.go
775 // already registered, returning success so it is idempotent
776 return nil
777 }
778
779 > d.VersionState.TaskQueueFamilies[args.TaskQueueName].TaskQueues[int32(args.TaskQueueType)] = &deploymentspb.TaskQueueVersionData{} version_workflow.go
780 >
781 > // Transition from CREATED to INACTIVE once a poller registers a task queue.
782 > if d.VersionState.Status == enumspb.WORKER_DEPLOYMENT_VERSION_STATUS_CREATED {
783 d.VersionState.Status = enumspb.WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE
784 // deployment workflow updates the status in version summary to INACTIVE
785 }
786
787 > if withRevisionNumbers && args.GetRoutingConfig() != nil { version_workflow.go
788 // Still need to check RoutingConfig not being nil because of edge cases during enabling dynamic config.
789 // i.e. the deployment workflow might run old version and not send the routing config.
790 d.syncRegisteredTaskQueueAsync(ctx, args)
791 > } else { version_workflow.go
792 err = d.syncRegisteredTaskQueueOld(ctx, args)
793 }
794 > return err version_workflow.go
795 }
796
go.temporal.io/server/api/deployment/v1/message.pb.go 10 introduced LOC · 2 ranges

Open complete file

1015 }
1016
1017 > func (x *RegisterWorkerInVersionArgs) Reset() { message.pb.go
1018 > *x = RegisterWorkerInVersionArgs{}
1019 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[10]
1020 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1021 > ms.StoreMessageInfo(mi)
1022 > }
1023
1024 func (x *RegisterWorkerInVersionArgs) String() string {
1073 }
1074
1075 > func (x *RegisterWorkerInVersionArgs) GetRoutingConfig() *v11.RoutingConfig { message.pb.go
1076 > if x != nil {
1077 > return x.RoutingConfig
1078 > }
1079 return nil
1080 }