eventID int64,
maxResetPoints int,
resetPoints := ms.executionInfo.AutoResetPoints.GetPoints()
for _, rp := range resetPoints {
if rp.GetBinaryChecksum() == binaryChecksum && rp.GetBuildId() == buildId {
return false
Frontier kind: Code frontier
unlabeled · c_9d57a1abdb80
196 tests · 5219 LOC · 177 files · introduces 0 tests · 241 LOC · 4 files
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.
Every exact file and test below is linked only from the concept that introduces it.
go.temporal.io/server/common/persistence/client/TestQuotasSuite/TestAPITypeCallOriginPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestBackgroundTypeAPIPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestCallerTypeDefaultPriorityMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestRequestPrioritiesOrderedgo.temporal.io/server/common/circuitbreaker/TestTSCBWithDynamicSettingsgo.temporal.io/server/common/dynamicconfig/TestDeepCopy_OtherReferenceTypes_Nilgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIPrioritiesOrderedgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIToPriorityMappinggo.temporal.io/server/common/namespace/TestDefaultReplicationResolver_FailoverVersion/negative_versiongo.temporal.io/server/common/namespace/TestDefaultReplicationResolver_FailoverVersion/positive_versiongo.temporal.io/server/common/namespace/TestDefaultReplicationResolver_FailoverVersion/zero_versiongo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/boolgo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/datetimego.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/doublego.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/intgo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/keywordgo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/keyword_listgo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/nilgo.temporal.io/server/common/searchattribute/sadefs/Test_EncodeValue/textEvery collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
4 files ranked by introduced lines: 241 introduced LOC across 68 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
eventID int64,
maxResetPoints int,
resetPoints := ms.executionInfo.AutoResetPoints.GetPoints()
for _, rp := range resetPoints {
if rp.GetBinaryChecksum() == binaryChecksum && rp.GetBuildId() == buildId {
return false
// todo@time-skipping: time skipping is naturally supported for auto reset points, and need to
// decide if this the best default policy for auto reset points
BinaryChecksum: binaryChecksum,
BuildId: buildId,
RunId: ms.executionState.GetRunId(),
FirstWorkflowTaskCompletedId: eventID,
CreateTime: timestamppb.New(ms.timeSource.Now()),
Resettable: ms.CheckResettable() == nil,
}
ms.executionInfo.AutoResetPoints = &workflowpb.ResetPoints{
Points: util.SliceTail(append(resetPoints, newPoint), maxResetPoints),
}
return true
}
usedVersion *deploymentpb.WorkerDeploymentVersion,
maxSearchAttributeValueSize int,
changed, err := ms.addBuildIDAndDeploymentInfoToSearchAttributesWithNoVisibilityTask(stamp, usedVersion, maxSearchAttributeValueSize)
if err != nil {
return err
}
return nil
}
}
searchAttributes := ms.executionInfo.SearchAttributes
if searchAttributes == nil {
return []string{}, nil
}
saPayload, found := searchAttributes[sadefs.BuildIds]
if !found {
}
func (ms *MutableStateImpl) loadSearchAttributeString(saName string) (string, error) {
mutable_state_impl.go
searchAttributes := ms.executionInfo.SearchAttributes
if searchAttributes == nil {
return "", nil
}
saPayload, found := searchAttributes[saName]
if !found {
}
func (ms *MutableStateImpl) loadUsedDeploymentVersions() ([]string, error) {
mutable_state_impl.go
searchAttributes := ms.executionInfo.SearchAttributes
if searchAttributes == nil {
return []string{}, nil
}
saPayload, found := searchAttributes[sadefs.TemporalUsedWorkerDeploymentVersions]
if !found {
existingValues []string,
stamp *commonpb.WorkerVersionStamp,
var newValues []string
var buildId string
behavior := ms.GetWorkflowVersioningBehaviorSA()
// set up the unversioned or assigned:x sentinels (versioning v2)
if !stamp.GetUseVersioning() && behavior == enumspb.VERSIONING_BEHAVIOR_UNSPECIFIED { // unversioned workflows may still have non-nil deployment, so we don't check deployment
newValues = append(newValues, worker_versioning.UnversionedSearchAttribute)
} else if ms.GetAssignedBuildId() != "" && behavior == enumspb.VERSIONING_BEHAVIOR_UNSPECIFIED {
newValues = append(newValues, worker_versioning.AssignedBuildIdSearchAttribute(ms.GetAssignedBuildId()))
}
// get the most up-to-date pinned entry put it at the front (v3 reachability and v3.1 drainage)
newValues = append(newValues, worker_versioning.PinnedBuildIdSearchAttribute(ms.GetWorkerDeploymentVersionSA()))
}
// get the build id entry (all versions of versioning)
buildId = worker_versioning.VersionStampToBuildIdSearchAttribute(stamp)
}
// add all previous values except for unversioned, assigned, or pinned (there can only be one, and we just added it)
for _, existingValue := range existingValues {
if existingValue == buildId {
foundBuildId = true
// add buildId to the list only if it wasn't there before
newValues = append(newValues, buildId)
}
}
func (ms *MutableStateImpl) addUsedDeploymentVersionToLoadedSearchAttribute(existingValues []string, usedVersion *deploymentpb.WorkerDeploymentVersion) []string {
mutable_state_impl.go
if usedVersion == nil {
return existingValues
}
// Get the current deployment version string (already formatted via ExternalWorkerDeploymentVersionToString)
}
func (ms *MutableStateImpl) saveBuildIds(buildIds []string, maxSearchAttributeValueSize int) error {
mutable_state_impl.go
searchAttributes := ms.executionInfo.SearchAttributes
if searchAttributes == nil {
searchAttributes = make(map[string]*commonpb.Payload, 1)
ms.executionInfo.SearchAttributes = searchAttributes
}
if len(buildIds) > 0 { // len is 0 if we are removing the pinned search attribute and the workflow was never unversioned or assigned
hasUnversionedOrAssigned = worker_versioning.IsUnversionedOrAssignedBuildIdSearchAttribute(buildIds[0])
}
for {
saPayload, err := sadefs.EncodeValue(buildIds, enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST)
if err != nil {
return err
}
if len(buildIds) == 0 || len(saPayload.GetData()) <= maxSearchAttributeValueSize {
mutable_state_impl.go
ms.updateSearchAttributes(map[string]*commonpb.Payload{sadefs.BuildIds: saPayload})
break
}
if len(buildIds) == 1 {
usedVersion *deploymentpb.WorkerDeploymentVersion,
maxSearchAttributeValueSize int,
// get all the existing SAs
existingBuildIds, err := ms.loadBuildIds()
if err != nil {
return false, err
}
if err != nil {
return false, err
}
existingDeployment, err := ms.loadSearchAttributeString(sadefs.TemporalWorkerDeployment)
mutable_state_impl.go
if err != nil {
return false, err
}
existingVersion, err := ms.loadSearchAttributeString(sadefs.TemporalWorkerDeploymentVersion)
mutable_state_impl.go
if err != nil {
return false, err
}
existingBehavior, err := ms.loadSearchAttributeString(sadefs.TemporalWorkflowVersioningBehavior)
mutable_state_impl.go
if err != nil {
return false, err
}
// modify them
modifiedBuildIds := ms.addBuildIdToLoadedSearchAttribute(existingBuildIds, stamp)
mutable_state_impl.go
modifiedUsedDeploymentVersions := ms.addUsedDeploymentVersionToLoadedSearchAttribute(existingUsedDeploymentVersions, usedVersion)
modifiedDeployment := ms.GetWorkerDeploymentSA()
modifiedVersion := ms.GetWorkerDeploymentVersionSA()
modifiedBehavior := ""
if b := ms.GetWorkflowVersioningBehaviorSA(); b != enumspb.VERSIONING_BEHAVIOR_UNSPECIFIED {
modifiedBehavior = b.String()
}
// check equality
slices.Equal(existingUsedDeploymentVersions, modifiedUsedDeploymentVersions) &&
existingDeployment == modifiedDeployment &&
existingVersion == modifiedVersion &&
existingBehavior == modifiedBehavior {
return false, nil
}
// save build ids if changed
err = ms.saveBuildIds(modifiedBuildIds, maxSearchAttributeValueSize)
if err != nil {
return false, err // if err != nil, nothing will be written
}
// save used deployment versions if changed
if !slices.Equal(existingUsedDeploymentVersions, modifiedUsedDeploymentVersions) {
mutable_state_impl.go
err = ms.saveUsedDeploymentVersions(modifiedUsedDeploymentVersions, maxSearchAttributeValueSize)
if err != nil {
// save deployment search attributes if changed
existingVersion != modifiedVersion ||
existingBehavior != modifiedBehavior {
err = ms.saveDeploymentSearchAttributes(modifiedDeployment, modifiedVersion, modifiedBehavior, maxSearchAttributeValueSize)
if err != nil {
// CheckResettable check if workflow can be reset
if len(ms.GetPendingChildExecutionInfos()) > 0 {
return serviceerror.NewInvalidArgument("it is not allowed resetting to a point that workflow has pending child workflow.")
}
return serviceerror.NewInvalidArgument("it is not allowed resetting to a point that workflow has pending request cancel.")
}
return serviceerror.NewInvalidArgument("it is not allowed resetting to a point that workflow has pending signals to send.")
}
}
}
func (ms *MutableStateImpl) RemoveReportedProblemsSearchAttribute() error {
mutable_state_impl.go
if ms.executionInfo.SearchAttributes == nil {
return nil
}
temporalReportedProblems := ms.executionInfo.SearchAttributes[sadefs.TemporalReportedProblems]
mutable_state_impl.go
if temporalReportedProblems == nil {
return nil
}
// Log the removal of the search attribute
}
versioningInfo := ms.GetExecutionInfo().GetVersioningInfo()
if override := versioningInfo.GetVersioningOverride(); override != nil {
if v := worker_versioning.GetOverrideTargetDeploymentVersion(override); v != nil {
return v.GetDeploymentName()
}
}
return v.GetDeploymentName()
}
}
versioningInfo := ms.GetExecutionInfo().GetVersioningInfo()
if override := versioningInfo.GetVersioningOverride(); override != nil {
if v := worker_versioning.GetOverrideTargetDeploymentVersion(override); v != nil {
return worker_versioning.ExternalWorkerDeploymentVersionToString(v)
}
}
return worker_versioning.ExternalWorkerDeploymentVersionToString(v)
}
//nolint:staticcheck // SA1019: worker versioning v0.31
return worker_versioning.ExternalWorkerDeploymentVersionToString(worker_versioning.ExternalWorkerDeploymentVersionFromStringV31(versioningInfo.GetVersion()))
mutable_state_impl.go
}
func (ms *MutableStateImpl) GetWorkflowVersioningBehaviorSA() enumspb.VersioningBehavior {
mutable_state_impl.go
if override := ms.executionInfo.GetVersioningInfo().GetVersioningOverride(); override != nil {
if override.GetAutoUpgrade() {
return enumspb.VERSIONING_BEHAVIOR_AUTO_UPGRADE
return override.GetBehavior()
}
}
}
// Create corresponding WorkflowTaskScheduled and WorkflowTaskStarted events for transient/speculative workflow tasks.
scheduledEvent := m.ms.hBuilder.AddWorkflowTaskScheduledEvent(
}
deploymentName := request.GetDeploymentOptions().GetDeploymentName()
workflow_task_state_machine.go
if deploymentName == "" {
//nolint:staticcheck // SA1019 deprecated Deployment will clean up later
deploymentName = request.GetDeployment().GetSeriesName()
}
if request.DeploymentOptions != nil && request.DeploymentOptions.GetWorkerVersioningMode() != enumspb.WORKER_VERSIONING_MODE_VERSIONED {
// SDK has a bug that reports behavior if user has specified a default behavior without enabling versioning.
// Until that is fixed, we should adjust this value so the workflow works correctly.
//nolint:staticcheck // SA1019 deprecated Deployment will clean up later
wftDeployment := worker_versioning.DeploymentOrVersion(request.Deployment, worker_versioning.DeploymentVersionFromOptions(request.DeploymentOptions))
workflow_task_state_machine.go
// Now write the completed event
event := m.ms.hBuilder.AddWorkflowTaskCompletedEvent(
workflowTask.ScheduledEventID,
workflowTask.StartedEventID,
request.Identity,
request.BinaryChecksum,
request.WorkerVersionStamp,
request.SdkMetadata,
request.MeteringMetadata,
deploymentName,
wftDeployment,
vb,
)
override := m.ms.GetExecutionInfo().GetVersioningInfo().GetVersioningOverride()
// Capture the pending one-time target before afterAddWorkflowTaskCompletedEvent,
// which clears the override when this WFT completes on the target version.
var oneTimeTarget *deploymentpb.WorkerDeploymentVersion
if oneTime := override.GetOneTime(); oneTime != nil {
oneTimeTarget = oneTime.GetTargetDeploymentVersion()
}
wftScheduleToClose := event.GetEventTime().AsTime().Sub(workflowTask.ScheduledTime)
workflow_task_state_machine.go
err := m.afterAddWorkflowTaskCompletedEvent(event, limits, wftScheduleToClose)
if err != nil {
return nil, err
}
// afterAddWorkflowTaskCompletedEvent clears the one-time override. Emit fulfillment
// telemetry only on this live completion path, not when applying rebuilt history.
if oneTimeTarget != nil && wftCompletedOnTargetVersion(wftDeployment, oneTimeTarget) {
workflow_task_state_machine.go
metrics.WorkerDeploymentVersioningOneTimeOverrideCounter.With(m.metricsHandler).Record(1)
m.ms.logger.Info("One-time versioning override fulfilled",
}
metrics.WorkflowTasksCompleted.With(m.metricsHandler).Record(1,
workflow_task_state_machine.go
metrics.NamespaceTag(m.ms.GetNamespaceEntry().Name().String()),
metrics.VersioningBehaviorTag(vb),
metrics.FirstAttemptTag(workflowTask.Attempt),
)
numConsecutiveWorkflowTaskProblemsToTriggerSearchAttribute := m.ms.config.NumConsecutiveWorkflowTaskProblemsToTriggerSearchAttribute(m.ms.GetNamespaceEntry().Name().String())
if numConsecutiveWorkflowTaskProblemsToTriggerSearchAttribute > 0 {
if err := m.ms.RemoveReportedProblemsSearchAttribute(); err != nil {
return nil, err
}
}
}
limits historyi.WorkflowTaskCompletionLimits,
wftScheduleToClose time.Duration,
attrs := event.GetWorkflowTaskCompletedEventAttributes()
m.ms.executionInfo.LastCompletedWorkflowTaskStartedEventId = attrs.GetStartedEventId()
m.ms.executionInfo.MostRecentWorkerVersionStamp = attrs.GetWorkerVersion()
m.ms.executionInfo.WorkerDeploymentName = attrs.GetWorkerDeploymentName()
//nolint:staticcheck // SA1019 deprecated Deployment will clean up later
wftDeployment := attrs.GetDeployment()
if v := attrs.GetWorkerDeploymentVersion(); v != "" { //nolint:staticcheck // SA1019: worker versioning v0.31
dv, _ := worker_versioning.WorkerDeploymentVersionFromStringV31(v)
wftDeployment = worker_versioning.DeploymentFromDeploymentVersion(dv)
}
wftDeployment = worker_versioning.DeploymentFromExternalDeploymentVersion(v)
}
versioningInfo := m.ms.GetExecutionInfo().GetVersioningInfo()
transition := m.ms.GetDeploymentTransition()
var completedTransition bool
if transition != nil {
// It's possible that the completed WFT is not yet from the current transition because when
// the transition started, the current wft was already started. In this case, we allow the
// Deployment and behavior before applying the data came from the completed wft.
wfBehaviorBefore := m.ms.GetEffectiveVersioningBehavior()
// Change deployment and behavior based on completed wft.
if wftBehavior == enumspb.VERSIONING_BEHAVIOR_UNSPECIFIED {
if versioningInfo != nil {
versioningInfo.Behavior = wftBehavior
// Deployment Version is not set for unversioned workers.
versioningInfo.DeploymentVersion = worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(wftDeployment)
}
if oneTime := versioningInfo.GetVersioningOverride().GetOneTime(); oneTime != nil &&
workflow_task_state_machine.go
wftCompletedOnTargetVersion(wftDeployment, oneTime.GetTargetDeploymentVersion()) {
// Clear before computing effective deployment/behavior so the worker-reported base state takes effect.
versioningInfo.VersioningOverride = nil
// Deployment and behavior after applying the data came from the completed wft.
wfBehaviorAfter := m.ms.GetEffectiveVersioningBehavior()
// We reschedule activities if a transition was completed because during the transition
// ATs might have been dropped. Note that it is possible that transition completes and still
// `wfDeploymentBefore == wfDeploymentAfter`. Example: wf was on deployment1, started
// transition to deployment2, before completing the transition it changed the transition to
// deployment1 (maybe user rolled back current deployment), now the transition completes.
if completedTransition ||
// It is possible that this WFT is changing workflow's deployment even if there was no
// ongoing transition in the MS. That is possible when the wft is speculative. We still
// want to reschedule the activities so they are queued with the up-to-date directive.
!wfDeploymentBefore.Equal(wfDeploymentAfter) ||
// If effective behavior changes we also want to reschedule the pending activities, so
// they go to the right matching queues.
wfBehaviorBefore != wfBehaviorAfter {
if err := m.ms.reschedulePendingActivities(wftScheduleToClose); err != nil {
return err
//nolint:staticcheck // SA1019: worker versioning v2
if wftDeployment != nil {
buildId = wftDeployment.GetBuildId()
}
attrs.GetBinaryChecksum(),
buildId,
event.GetEventId(),
limits.MaxResetPoints,
)
// For v3 versioned workflows (ms.GetEffectiveVersioningBehavior() != UNSPECIFIED), this will update the reachability
// search attribute based on the execution_info.deployment and/or override deployment if one exists. We must update the
// search attribute here because the reachability deployment may have just been changed by CompleteDeploymentTransition.
// This is also useful for unversioned workers.
// For v1 and v2 versioned workflows the search attributes should be already up-to-date based on the task started events.
//nolint:staticcheck // SA1019
if err := m.ms.updateBuildIdsAndDeploymentSearchAttributes(attrs.GetWorkerVersion(), worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(wftDeployment), limits.MaxSearchAttributeValueSize); err != nil {
return err
}
if err := m.ms.updateBinaryChecksumSearchAttribute(); err != nil {
return err
}
}
}
// IsUnversionedOrAssignedBuildIdSearchAttribute returns the value is "unversioned" or "assigned:<bld>"
func IsUnversionedOrAssignedBuildIdSearchAttribute(buildId string) bool {
worker_versioning.go
return buildId == UnversionedSearchAttribute ||
strings.HasPrefix(buildId, buildIdSearchAttributePrefixAssigned+BuildIdSearchAttributeDelimiter)
}
// VersionedBuildIdSearchAttribute returns the search attribute value for a versioned build ID
// DeploymentOrVersion Temporary helper function to return a Deployment based on passed Deployment
// or WorkerDeploymentVersion objects, if `v` is not nil, it'll take precedence.
func DeploymentOrVersion(d *deploymentpb.Deployment, v *deploymentspb.WorkerDeploymentVersion) *deploymentpb.Deployment {
worker_versioning.go
if v != nil {
return DeploymentIfValid(DeploymentFromDeploymentVersion(v))
}
}
// DeploymentIfValid returns the deployment back if is both of its fields have value.
func DeploymentIfValid(d *deploymentpb.Deployment) *deploymentpb.Deployment {
worker_versioning.go
if d.GetSeriesName() != "" && d.GetBuildId() != "" {
return d
}
}
}
if x != nil {
return x.WorkerDeploymentName
}
return ""
}