version_workflow.go ×13

Frontier kind: Code frontier

unlabeled · c_c906ff8a8d07

127 tests · 2878 LOC · 134 files · introduces 0 tests · 46 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges46 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
457 ranges2878 lines · 134 files · Browse complete extent
All tests (intent)
127 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: 46 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

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

Open complete file

864
865 // If routing update time has changed then we want to let the update through.
866 > func (d *VersionWorkflowRunner) validateSyncState(args *deploymentspb.SyncVersionStateUpdateArgs) error { version_workflow.go
867 > if err := d.ensureNotDeleted(); err != nil {
868 return err
869 }
870
871 > res := &deploymentspb.SyncVersionStateResponse{VersionState: d.VersionState} version_workflow.go
872 > if args.GetRoutingUpdateTime().AsTime().Equal(d.GetVersionState().GetRoutingUpdateTime().AsTime()) {
873 return temporal.NewApplicationError("no change", errNoChangeType, res)
874 }
875 > return nil version_workflow.go
876 }
877
878 //nolint:staticcheck // SA1019
879 > func (d *VersionWorkflowRunner) handleSyncState(ctx workflow.Context, args *deploymentspb.SyncVersionStateUpdateArgs) (*deploymentspb.SyncVersionStateResponse, error) { version_workflow.go
880 > if err := d.preUpdateChecks(ctx); err != nil {
881 return nil, err
882 }
883
884 // use lock to enforce only one update at a time
885 > err := d.lock.Lock(ctx) version_workflow.go
886 > if err != nil {
887 d.logger.Error("Could not acquire workflow lock")
888 return nil, serviceerror.NewDeadlineExceeded("Could not acquire workflow lock")
889 }
890 > defer func() { version_workflow.go
891 > // although the handler might have not changed the state and had returned an error, still
892 > // it's better to CaN because some history events are built now.
893 > d.setStateChanged()
894 > d.lock.Unlock()
895 > }()
896
897 > if err = d.validateSyncState(args); err != nil { version_workflow.go
898 return nil, err
899 }
900
901 > if !d.hasMinVersion(VersionDataRevisionNumber) { version_workflow.go
902 // wait until deployment workflow started
903 err = workflow.Await(ctx, func() bool { return d.VersionState.StartedDeploymentWorkflow })
908 }
909
910 > state := d.GetVersionState() version_workflow.go
911 > var newStatus enumspb.WorkerDeploymentVersionStatus
912 >
913 > // Determine propagation mode based on routing config presence
914 > if rg := args.GetRoutingConfig(); rg != nil {
915 // ASYNC MODE: propagate full routing config
916 newStatus = d.findNewVersionStatusFromRoutingConfig(rg)
917 versionDataChanged := d.updateStateFromRoutingConfig(newStatus, state, rg)
918 d.syncTaskQueuesAsync(ctx, args.RoutingConfig, versionDataChanged)
919 > } else { version_workflow.go
920 // SYNC MODE: propagate only version data (existing behavior)
921 newStatus = d.findNewVersionStatus(args)
951
952 // stopped accepting new workflows --> start drainage tracking
953 > if newStatus == enumspb.WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING { version_workflow.go
954 // Version deactivated from current/ramping
955 state.LastDeactivationTime = args.RoutingUpdateTime
958
959 // started accepting new workflows
960 > if newStatus == enumspb.WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT || newStatus == enumspb.WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING { version_workflow.go
961 if state.FirstActivationTime == nil {
962 // First time this version is activated to current/ramping
971 }
972
973 > return &deploymentspb.SyncVersionStateResponse{ version_workflow.go
974 > Summary: versionStateToSummary(state),
975 > }, nil
976 }
977
go.temporal.io/server/api/deployment/v1/message.pb.go 18 introduced LOC · 4 ranges

Open complete file

384 }
385
386 > func (x *VersionLocalState) GetRoutingUpdateTime() *timestamppb.Timestamp { message.pb.go
387 > if x != nil {
388 > return x.RoutingUpdateTime
389 > }
390 return nil
391 }
392
393 > func (x *VersionLocalState) GetCurrentSinceTime() *timestamppb.Timestamp { message.pb.go
394 > if x != nil {
395 > return x.CurrentSinceTime
396 > }
397 return nil
398 }
1274 }
1275
1276 > func (x *SyncVersionStateUpdateArgs) Reset() { message.pb.go
1277 > *x = SyncVersionStateUpdateArgs{}
1278 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[14]
1279 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1280 > ms.StoreMessageInfo(mi)
1281 > }
1282
1283 func (x *SyncVersionStateUpdateArgs) String() string {
1305
1306 // Deprecated: Marked as deprecated in temporal/server/api/deployment/v1/message.proto.
1307 > func (x *SyncVersionStateUpdateArgs) GetRoutingUpdateTime() *timestamppb.Timestamp { message.pb.go
1308 > if x != nil {
1309 > return x.RoutingUpdateTime
1310 > }
1311 return nil
1312 }