worker_versioning.go ×13

Frontier kind: Code frontier

unlabeled · c_a6f5e82dc4a5

60 tests · 2200 LOC · 106 files · introduces 0 tests · 52 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges52 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
335 ranges2200 lines · 106 files · Browse complete extent
All tests (intent)
60 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: 52 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/worker_versioning/worker_versioning.go 52 introduced LOC · 13 ranges

Open complete file

891 finalRampingRev int64,
892 finalRampingUpdateTime time.Time,
894 > // current: choose newer of old vs new format
895 >
896 > oldCurrentTime := current.GetRoutingUpdateTime().AsTime()
897 > newCurrentTime := currentVersionRoutingConfig.GetCurrentVersionChangedTime().AsTime()
898 >
899 > // Break ties by choosing the newer format
900 > if newCurrentTime.After(oldCurrentTime) || newCurrentTime.Equal(oldCurrentTime) {
901 finalCurrent = DeploymentVersionFromDeployment(DeploymentFromExternalDeploymentVersion(currentVersionRoutingConfig.GetCurrentDeploymentVersion()))
902 finalCurrentRev = currentVersionRoutingConfig.GetRevisionNumber()
903 finalCurrentUpdateTime = newCurrentTime
904 > } else { worker_versioning.go
905 finalCurrent = current.GetVersion()
906 finalCurrentRev = 0
910 // ramping: choose newer of old vs new format; new format can change either version or percentage
911
912 > oldRampingTime := ramping.GetRoutingUpdateTime().AsTime() worker_versioning.go
913 > newRampingTime := rampingVersionRoutingConfig.GetRampingVersionPercentageChangedTime().AsTime()
914 >
915 > // Break ties by choosing the newer format
916 >
917 > if newRampingTime.After(oldRampingTime) || newRampingTime.Equal(oldRampingTime) {
918 finalRamping = DeploymentVersionFromDeployment(DeploymentFromExternalDeploymentVersion(rampingVersionRoutingConfig.GetRampingDeploymentVersion()))
919 finalRampingRev = rampingVersionRoutingConfig.GetRevisionNumber()
944 }
945
946 > return finalCurrent, finalCurrentRev, finalCurrentUpdateTime, finalRamping, isRamping, finalRampPercentage, finalRampingRev, finalRampingUpdateTime worker_versioning.go
947 }
948
974 }
975
976 > var current *deploymentspb.DeploymentVersionData worker_versioning.go
977 > ramping := deployments.GetUnversionedRampData() // nil if there is no unversioned ramp
978 >
979 > // Find current and ramping
980 > // [cleanup-pp-wv]
981 > for _, v := range deployments.GetVersions() {
982 if v.RoutingUpdateTime != nil && v.GetCurrentSinceTime() != nil {
983 if t := v.RoutingUpdateTime.AsTime(); t.After(current.GetRoutingUpdateTime().AsTime()) {
994 // Find new current and ramping and pass information in DeploymentVersionData when returning to the caller to
995 // preserve backwards compatibility.
996 > var routingConfigLatestCurrentVersion *deploymentpb.RoutingConfig worker_versioning.go
997 > var routingConfigLatestRampingVersion *deploymentpb.RoutingConfig
998 >
999 > // Track the latest "versioned and TQ is a member" and "unversioned" routing configs
1000 > // separately so a versioned current/ramping always wins over an unversioned-but-newer
1001 > // entry in another deployment bucket, independent of map iteration order.
1002 > //
1003 > // Only chose those RoutingConfigs which pass the HasDeploymentVersion check due to the following example case:
1004 > // t0: TQ "foo" is in current version A with other TQ's
1005 > // t1: All other TQ's are moved to new version B except for "foo".
1006 > // t2: New version B is set as the current version.
1007 > //
1008 > // When this happens, we sync to "foo" that A is no longer the current version by passing in the new routing config. However,
1009 > // version B should not be considered as the current version for "foo" because the task-queue is not part of version B.
1010 > var latestVersionedCurrent, latestUnversionedCurrent *deploymentpb.RoutingConfig
1011 > var latestVersionedRamping, latestUnversionedRamping *deploymentpb.RoutingConfig
1012 >
1013 > for _, deploymentInfo := range deployments.GetDeploymentsData() {
1014 rc := deploymentInfo.GetRoutingConfig()
1015
1037 }
1038
1039 > if latestVersionedCurrent != nil { worker_versioning.go
1040 routingConfigLatestCurrentVersion = latestVersionedCurrent
1041 > } else { worker_versioning.go
1042 routingConfigLatestCurrentVersion = latestUnversionedCurrent
1043 }
1044 > if latestVersionedRamping != nil { worker_versioning.go
1045 routingConfigLatestRampingVersion = latestVersionedRamping
1046 > } else { worker_versioning.go
1047 routingConfigLatestRampingVersion = latestUnversionedRamping
1048 }
1049
1050 > if routingConfigLatestCurrentVersion.GetCurrentDeploymentVersion() == nil && current.GetVersion() != nil { worker_versioning.go
1051 // The new current version is not unversioned but belongs to a versioned deployment which synced to the task-queue using the old deployment data format.
1052 routingConfigLatestCurrentVersion = nil
1053 }
1054
1055 > if routingConfigLatestRampingVersion.GetRampingDeploymentVersion() == nil && ramping.GetVersion() != nil { worker_versioning.go
1056 // The new ramping version is not unversioned but belongs to a versioned deployment which synced to the task-queue using the old deployment data format.
1057 routingConfigLatestRampingVersion = nil
1059
1060 // Pick the final current and ramping version amongst the old and new deployment data formats.
1061 > return PickFinalCurrentAndRamping( worker_versioning.go
1062 > current,
1063 > ramping,
1064 > routingConfigLatestCurrentVersion,
1065 > routingConfigLatestRampingVersion,
1066 > )
1067 }
1068