go.temporal.io/server/service/matching/config.go

608 LOC · 293 covered · 315 uncovered · 54 ranges · 1653 concepts · 47 introducers · 677 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 //go:generate stringer -type loadCause -trimprefix loadCause -output loadcause_string_gen.go
2 //go:generate stringer -type unloadCause -trimprefix unloadCause -output unloadcause_string_gen.go
3
4 package matching
5
6 import (
7 "time"
8
9 "go.temporal.io/server/common/backoff"
10 "go.temporal.io/server/common/dynamicconfig"
11 "go.temporal.io/server/common/namespace"
12 "go.temporal.io/server/common/tqid"
13 "go.temporal.io/server/components/nexusoperations"
14 "go.temporal.io/server/service/matching/counter"
15 )
16
17 type (
18 // Config represents configuration for matching service
19 Config struct {
20 PersistenceMaxQPS dynamicconfig.IntPropertyFn
21 PersistenceGlobalMaxQPS dynamicconfig.IntPropertyFn
22 PersistenceNamespaceMaxQPS dynamicconfig.IntPropertyFnWithNamespaceFilter
23 PersistenceGlobalNamespaceMaxQPS dynamicconfig.IntPropertyFnWithNamespaceFilter
24 PersistencePerShardNamespaceMaxQPS dynamicconfig.IntPropertyFnWithNamespaceFilter
25 PersistenceDynamicRateLimitingParams dynamicconfig.TypedPropertyFn[dynamicconfig.DynamicRateLimitingParams]
26 PersistenceQPSBurstRatio dynamicconfig.FloatPropertyFn
27 SyncMatchWaitDuration dynamicconfig.DurationPropertyFnWithTaskQueueFilter
28 RPS dynamicconfig.IntPropertyFn
29 NamespaceRPS dynamicconfig.IntPropertyFnWithNamespaceFilter
30 OperatorRPSRatio dynamicconfig.FloatPropertyFn
31 PollWaitForNamespaceRateLimitToken dynamicconfig.BoolPropertyFnWithNamespaceFilter
32 AlignMembershipChange dynamicconfig.DurationPropertyFn
33 ShutdownDrainDuration dynamicconfig.DurationPropertyFn
34 HistoryMaxPageSize dynamicconfig.IntPropertyFnWithNamespaceFilter
35 EnableDeployments dynamicconfig.BoolPropertyFnWithNamespaceFilter // [cleanup-wv-pre-release]
36 EnableDeploymentVersions dynamicconfig.BoolPropertyFnWithNamespaceFilter
37 UseRevisionNumberForWorkerVersioning dynamicconfig.BoolPropertyFnWithNamespaceFilter
38 MaxTaskQueuesInDeployment dynamicconfig.IntPropertyFnWithNamespaceFilter
39 MaxVersionsInTaskQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
40 MaxIDLengthLimit dynamicconfig.IntPropertyFn
41
42 // task queue configuration
43
44 RangeSize int64
45 NewMatcherSub dynamicconfig.TypedSubscribableWithTaskQueueFilter[dynamicconfig.GradualChange[bool]]
46 EnableFairnessSub dynamicconfig.TypedSubscribableWithTaskQueueFilter[dynamicconfig.GradualChange[bool]]
47 EnableMigration dynamicconfig.BoolPropertyFnWithTaskQueueFilter
48 AutoEnableV2Sub dynamicconfig.TypedSubscribableWithTaskQueueFilter[bool]
49 GetTasksBatchSize dynamicconfig.IntPropertyFnWithTaskQueueFilter
50 GetTasksReloadAt dynamicconfig.IntPropertyFnWithTaskQueueFilter
51 ForceReadTasksOnWrite dynamicconfig.BoolPropertyFnWithTaskQueueFilter
52 UpdateAckInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
53 MetadataUpdateOnAppendInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
54 MaxTaskQueueIdleTime dynamicconfig.DurationPropertyFnWithTaskQueueFilter
55 NumTaskqueueWritePartitions dynamicconfig.IntPropertyFnWithTaskQueueFilter
56 NumTaskqueueReadPartitions dynamicconfig.IntPropertyFnWithTaskQueueFilter
57 NumTaskqueueReadPartitionsSub dynamicconfig.TypedSubscribableWithTaskQueueFilter[int]
58 BreakdownMetricsByTaskQueue dynamicconfig.BoolPropertyFnWithTaskQueueFilter
59 BreakdownMetricsByPartition dynamicconfig.BoolPropertyFnWithTaskQueueFilter
60 BreakdownMetricsByBuildID dynamicconfig.BoolPropertyFnWithTaskQueueFilter
61 EnableWorkerPluginMetrics dynamicconfig.BoolPropertyFn
62 EnablePollerAutoscalingMetrics dynamicconfig.BoolPropertyFn
63 ExternalPayloadsEnabled dynamicconfig.BoolPropertyFnWithNamespaceFilter
64 WorkerRegistryNumBuckets dynamicconfig.IntPropertyFn
65 WorkerRegistryEntryTTL dynamicconfig.DurationPropertyFn
66 WorkerRegistryMinEvictAge dynamicconfig.DurationPropertyFn
67 WorkerRegistryMaxEntries dynamicconfig.IntPropertyFn
68 WorkerRegistryEvictionInterval dynamicconfig.DurationPropertyFn
69 ForwarderMaxOutstandingPolls dynamicconfig.IntPropertyFnWithTaskQueueFilter
70 ForwarderMaxOutstandingTasks dynamicconfig.IntPropertyFnWithTaskQueueFilter
71 ForwarderMaxRatePerSecond dynamicconfig.FloatPropertyFnWithTaskQueueFilter
72 ForwarderMaxChildrenPerNode dynamicconfig.IntPropertyFnWithTaskQueueFilter
73 VersionCompatibleSetLimitPerQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
74 VersionBuildIdLimitPerQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
75 AssignmentRuleLimitPerQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
76 RedirectRuleLimitPerQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
77 RedirectRuleMaxUpstreamBuildIDsPerQueue dynamicconfig.IntPropertyFnWithNamespaceFilter
78 DeletedRuleRetentionTime dynamicconfig.DurationPropertyFnWithNamespaceFilter
79 PollerHistoryTTL dynamicconfig.DurationPropertyFnWithNamespaceFilter
80 EnableMatchingFanOutForPollCancellation dynamicconfig.BoolPropertyFnWithNamespaceFilter
81 ReachabilityBuildIdVisibilityGracePeriod dynamicconfig.DurationPropertyFnWithNamespaceFilter
82 ReachabilityCacheOpenWFsTTL dynamicconfig.DurationPropertyFn
83 ReachabilityCacheClosedWFsTTL dynamicconfig.DurationPropertyFn
84 TaskQueueLimitPerBuildId dynamicconfig.IntPropertyFnWithNamespaceFilter
85 GetUserDataLongPollTimeout dynamicconfig.DurationPropertyFn
86 GetUserDataRefresh dynamicconfig.DurationPropertyFn
87 EphemeralDataUpdateInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
88 BacklogMetricsEmitInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
89 PriorityBacklogForwarding dynamicconfig.BoolPropertyFnWithTaskQueueFilter
90 BacklogNegligibleAge dynamicconfig.DurationPropertyFnWithTaskQueueFilter
91 MaxWaitForPollerBeforeFwd dynamicconfig.DurationPropertyFnWithTaskQueueFilter
92 QueryPollerUnavailableWindow dynamicconfig.DurationPropertyFn
93 WorkerControllerNoPollerHookWindow dynamicconfig.DurationPropertyFn
94 EmitTaskDispatchLatencyAtPoll dynamicconfig.BoolPropertyFnWithTaskQueueFilter
95 QueryWorkflowTaskTimeoutLogRate dynamicconfig.FloatPropertyFnWithTaskQueueFilter
96 MembershipUnloadDelay dynamicconfig.DurationPropertyFn
97 TaskQueueInfoByBuildIdTTL dynamicconfig.DurationPropertyFnWithTaskQueueFilter
98 PriorityLevels dynamicconfig.IntPropertyFnWithTaskQueueFilter
99
100 RateLimitFractionProvider TaskQueueRateLimitFractionProvider
101
102 RateLimiterRefreshInterval time.Duration
103 FairnessKeyRateLimitCacheSize dynamicconfig.IntPropertyFnWithTaskQueueFilter
104 MaxFairnessKeyWeightOverrides dynamicconfig.IntPropertyFnWithTaskQueueFilter
105
106 // Time to hold a poll request before returning an empty response if there are no tasks
107 LongPollExpirationInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
108 BacklogTaskForwardTimeout dynamicconfig.DurationPropertyFnWithTaskQueueFilter
109 ForwardPollRetryMaxInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
110 MinTaskThrottlingBurstSize dynamicconfig.IntPropertyFnWithTaskQueueFilter
111 MaxTaskDeleteBatchSize dynamicconfig.IntPropertyFnWithTaskQueueFilter
112 TaskDeleteInterval dynamicconfig.DurationPropertyFnWithTaskQueueFilter
113
114 // taskWriter configuration
115 OutstandingTaskAppendsThreshold dynamicconfig.IntPropertyFnWithTaskQueueFilter
116 MaxTaskBatchSize dynamicconfig.IntPropertyFnWithTaskQueueFilter
117
118 ThrottledLogRPS dynamicconfig.IntPropertyFn
119
120 AdminNamespaceToPartitionDispatchRate dynamicconfig.FloatPropertyFnWithNamespaceFilter
121 AdminNamespaceToPartitionRateSub dynamicconfig.TypedSubscribableWithNamespaceFilter[float64]
122 AdminNamespaceTaskqueueToPartitionDispatchRate dynamicconfig.FloatPropertyFnWithTaskQueueFilter
123 AdminNamespaceTaskqueueToPartitionRateSub dynamicconfig.TypedSubscribableWithTaskQueueFilter[float64]
124
125 VisibilityPersistenceMaxReadQPS dynamicconfig.IntPropertyFn
126 VisibilityPersistenceMaxWriteQPS dynamicconfig.IntPropertyFn
127 VisibilityPersistenceSlowQueryThreshold dynamicconfig.DurationPropertyFn
128 EnableReadFromSecondaryVisibility dynamicconfig.BoolPropertyFnWithNamespaceFilter
129 VisibilityEnableShadowReadMode dynamicconfig.BoolPropertyFn
130 VisibilityDisableOrderByClause dynamicconfig.BoolPropertyFnWithNamespaceFilter
131 VisibilityEnableManualPagination dynamicconfig.BoolPropertyFnWithNamespaceFilter
132 VisibilityEnableUnifiedQueryConverter dynamicconfig.BoolPropertyFn
133
134 ListNexusEndpointsLongPollTimeout dynamicconfig.DurationPropertyFn
135 NexusEndpointsRefreshInterval dynamicconfig.DurationPropertyFn
136 MinDispatchTaskTimeout dynamicconfig.DurationPropertyFnWithNamespaceFilter
137
138 PollerScalingBacklogAgeScaleUp dynamicconfig.DurationPropertyFnWithTaskQueueFilter
139 PollerScalingWaitTime dynamicconfig.DurationPropertyFnWithTaskQueueFilter
140 PollerScalingDecisionsPerSecond dynamicconfig.FloatPropertyFnWithTaskQueueFilter
141 PollerScalingTaskAddToDispatchRatio dynamicconfig.FloatPropertyFnWithTaskQueueFilter
142 EnablePollerScalingDecisionMetrics dynamicconfig.BoolPropertyFnWithTaskQueueFilter
143
144 FairnessCounter dynamicconfig.TypedPropertyFnWithTaskQueueFilter[counter.CounterParams]
145 FairnessPassDither dynamicconfig.BoolPropertyFnWithTaskQueueFilter
146 PartitionScaleAllowedDrift dynamicconfig.TypedPropertyFnWithTaskQueueFilter[dynamicconfig.PartitionScaleAllowedDrift]
147 PartitionScaleManagerSettings dynamicconfig.TypedPropertyFnWithTaskQueueFilter[dynamicconfig.PartitionScaleManagerSettings]
148
149 LogAllReqErrors dynamicconfig.BoolPropertyFnWithNamespaceFilter
150 }
151
152 forwarderConfig struct {
153 ForwarderMaxOutstandingPolls func() int
154 ForwarderMaxOutstandingTasks func() int
155 ForwarderMaxRatePerSecond func() float64
156 ForwarderMaxChildrenPerNode func() int
157 }
158
159 taskQueueConfig struct {
160 forwarderConfig
161 SyncMatchWaitDuration func() time.Duration
162 EphemeralDataUpdateInterval func() time.Duration
163 BacklogMetricsEmitInterval func() time.Duration
164 PriorityBacklogForwarding func() bool
165 BacklogNegligibleAge func() time.Duration
166 MaxWaitForPollerBeforeFwd func() time.Duration
167 QueryPollerUnavailableWindow func() time.Duration
168 WorkerControllerNoPollerHookWindow func() time.Duration
169 EmitTaskDispatchLatencyAtPoll func() bool
170 // Time to hold a poll request before returning an empty response if there are no tasks
171 LongPollExpirationInterval func() time.Duration
172 BacklogTaskForwardTimeout func() time.Duration
173 ForwardPollRetryMaxInterval func() time.Duration
174 RangeSize int64
175 NewMatcher bool
176 NewMatcherSub func(func(dynamicconfig.GradualChange[bool])) (dynamicconfig.GradualChange[bool], func())
177 EnableFairness bool
178 EnableFairnessSub func(func(dynamicconfig.GradualChange[bool])) (dynamicconfig.GradualChange[bool], func())
179 EnableMigration func() bool
180 AutoEnableV2 func() bool
181 AutoEnableV2Sub func(func(bool)) (bool, func())
182 GetTasksBatchSize func() int
183 GetTasksReloadAt func() int
184 ForceReadTasksOnWrite func() bool
185 UpdateAckInterval func() time.Duration
186 MetadataUpdateOnAppendInterval func() time.Duration
187 MaxTaskQueueIdleTime func() time.Duration
188 MinTaskThrottlingBurstSize func() int
189 MaxTaskDeleteBatchSize func() int
190 TaskDeleteInterval func() time.Duration
191 PriorityLevels priorityKey
192 DefaultPriorityKey priorityKey
193
194 GetUserDataLongPollTimeout dynamicconfig.DurationPropertyFn
195 GetUserDataMinWaitTime time.Duration
196 GetUserDataReturnBudget time.Duration
197 GetUserDataInitialRefresh time.Duration
198 GetUserDataRefresh dynamicconfig.DurationPropertyFn
199
200 // taskWriter configuration
201 OutstandingTaskAppendsThreshold func() int
202 MaxTaskBatchSize func() int
203 NumWritePartitions func() int
204 NumReadPartitions func() int
205 NumReadPartitionsSub func(func(int)) (int, func())
206
207 // partition qps = AdminNamespaceToPartitionDispatchRate(namespace)
208 AdminNamespaceToPartitionDispatchRate func() float64
209 AdminNamespaceToPartitionRateSub func(func(float64)) (float64, func())
210 // partition qps = AdminNamespaceTaskQueueToPartitionDispatchRate(namespace, task_queue)
211 AdminNamespaceTaskQueueToPartitionDispatchRate func() float64
212 AdminNamespaceTaskQueueToPartitionRateSub func(func(float64)) (float64, func())
213
214 // Retry policy for fetching user data from root partition. Should retry forever.
215 GetUserDataRetryPolicy backoff.RetryPolicy
216
217 // TTL for cache holding TaskQueueInfoByBuildID
218 TaskQueueInfoByBuildIdTTL func() time.Duration
219 MaxVersionsInTaskQueue func() int
220
221 // Rate limiting
222 RateLimitFraction func() float64
223 RateLimiterRefreshInterval time.Duration
224 FairnessKeyRateLimitCacheSize func() int
225 MaxFairnessKeyWeightOverrides func() int
226
227 BreakdownMetricsByTaskQueue func() bool
228 BreakdownMetricsByPartition func() bool
229 BreakdownMetricsByBuildID func() bool
230
231 PollerHistoryTTL func() time.Duration
232
233 // Poller scaling decisions configuration
234 PollerScalingBacklogAgeScaleUp func() time.Duration
235 PollerScalingWaitTime func() time.Duration
236 PollerScalingDecisionsPerSecond func() float64
237 PollerScalingTaskAddToDispatchRatio func() float64
238 EnablePollerScalingDecisionMetrics func() bool
239
240 FairnessCounter func() counter.CounterParams
241 FairnessPassDither func() bool
242 PartitionScaleAllowedDrift func() dynamicconfig.PartitionScaleAllowedDrift
243 PartitionScaleManagerSettings func() dynamicconfig.PartitionScaleManagerSettings
244
245 loadCause loadCause
246 }
247
248 loadCause int
249 unloadCause int
250 )
251
252 const (
253 loadCauseUnspecified loadCause = iota
254 loadCauseTask
255 loadCauseQuery
256 loadCauseDescribe
257 loadCauseUserData
258 loadCauseNexusTask
259 loadCausePoll
260 loadCauseOtherRead // any other read-only rpc
261 loadCauseOtherWrite // any other mutating rpc
262 loadCauseForce // root partition loaded, force load to ensure matching with back logged partitions
263 )
264
265 const (
266 unloadCauseUnspecified unloadCause = iota
267 unloadCauseInitError
268 unloadCauseIdle
269 unloadCauseMembership // proactive unload due to ownership change
270 unloadCauseConflict // reactive unload due to other node stealing ownership
271 unloadCauseShuttingDown
272 unloadCauseForce
273 unloadCauseConfigChange
274 unloadCauseOtherError
275 )
276
277 // NewConfig returns new service config with default values
278 func NewConfig(
279 dc *dynamicconfig.Collection,
280 > ) *Config { setting_gen.go ×2
281 > return &Config{
282 > PersistenceMaxQPS: dynamicconfig.MatchingPersistenceMaxQPS.Get(dc),
283 > PersistenceGlobalMaxQPS: dynamicconfig.MatchingPersistenceGlobalMaxQPS.Get(dc),
284 > PersistenceNamespaceMaxQPS: dynamicconfig.MatchingPersistenceNamespaceMaxQPS.Get(dc),
285 > PersistenceGlobalNamespaceMaxQPS: dynamicconfig.MatchingPersistenceGlobalNamespaceMaxQPS.Get(dc),
286 > PersistencePerShardNamespaceMaxQPS: dynamicconfig.DefaultPerShardNamespaceRPSMax,
287 > PersistenceDynamicRateLimitingParams: dynamicconfig.MatchingPersistenceDynamicRateLimitingParams.Get(dc),
288 > PersistenceQPSBurstRatio: dynamicconfig.PersistenceQPSBurstRatio.Get(dc),
289 > SyncMatchWaitDuration: dynamicconfig.MatchingSyncMatchWaitDuration.Get(dc),
290 > HistoryMaxPageSize: dynamicconfig.MatchingHistoryMaxPageSize.Get(dc),
291 > EnableDeployments: dynamicconfig.EnableDeployments.Get(dc), // [cleanup-wv-pre-release]
292 > EnableDeploymentVersions: dynamicconfig.EnableDeploymentVersions.Get(dc),
293 > UseRevisionNumberForWorkerVersioning: dynamicconfig.UseRevisionNumberForWorkerVersioning.Get(dc),
294 > MaxTaskQueuesInDeployment: dynamicconfig.MatchingMaxTaskQueuesInDeployment.Get(dc),
295 > MaxVersionsInTaskQueue: dynamicconfig.MatchingMaxVersionsInTaskQueue.Get(dc),
296 > RPS: dynamicconfig.MatchingRPS.Get(dc),
297 > NamespaceRPS: dynamicconfig.MatchingNamespaceRPS.Get(dc),
298 > OperatorRPSRatio: dynamicconfig.OperatorRPSRatio.Get(dc),
299 > PollWaitForNamespaceRateLimitToken: dynamicconfig.PollWaitForNamespaceRateLimitToken.Get(dc),
300 > RangeSize: 100000,
301 > NewMatcherSub: dynamicconfig.MatchingUseNewMatcher.Subscribe(dc),
302 > EnableFairnessSub: dynamicconfig.MatchingEnableFairness.Subscribe(dc),
303 > EnableMigration: dynamicconfig.MatchingEnableMigration.Get(dc),
304 > AutoEnableV2Sub: dynamicconfig.MatchingAutoEnableV2.Subscribe(dc),
305 > GetTasksBatchSize: dynamicconfig.MatchingGetTasksBatchSize.Get(dc),
306 > GetTasksReloadAt: dynamicconfig.MatchingGetTasksReloadAt.Get(dc),
307 > ForceReadTasksOnWrite: dynamicconfig.MatchingForceReadTasksOnWrite.Get(dc),
308 > UpdateAckInterval: dynamicconfig.MatchingUpdateAckInterval.Get(dc),
309 > MetadataUpdateOnAppendInterval: dynamicconfig.MatchingMetadataUpdateOnAppendInterval.Get(dc),
310 > MaxTaskQueueIdleTime: dynamicconfig.MatchingMaxTaskQueueIdleTime.Get(dc),
311 > LongPollExpirationInterval: dynamicconfig.MatchingLongPollExpirationInterval.Get(dc),
312 > BacklogTaskForwardTimeout: dynamicconfig.MatchingBacklogTaskForwardTimeout.Get(dc),
313 > ForwardPollRetryMaxInterval: dynamicconfig.MatchingForwardPollRetryMaxInterval.Get(dc),
314 > MinTaskThrottlingBurstSize: dynamicconfig.MatchingMinTaskThrottlingBurstSize.Get(dc),
315 > MaxTaskDeleteBatchSize: dynamicconfig.MatchingMaxTaskDeleteBatchSize.Get(dc),
316 > TaskDeleteInterval: dynamicconfig.MatchingTaskDeleteInterval.Get(dc),
317 > OutstandingTaskAppendsThreshold: dynamicconfig.MatchingOutstandingTaskAppendsThreshold.Get(dc),
318 > MaxTaskBatchSize: dynamicconfig.MatchingMaxTaskBatchSize.Get(dc),
319 > ThrottledLogRPS: dynamicconfig.MatchingThrottledLogRPS.Get(dc),
320 > NumTaskqueueWritePartitions: dynamicconfig.MatchingNumTaskqueueWritePartitions.Get(dc),
321 > NumTaskqueueReadPartitions: dynamicconfig.MatchingNumTaskqueueReadPartitions.Get(dc),
322 > NumTaskqueueReadPartitionsSub: dynamicconfig.MatchingNumTaskqueueReadPartitions.Subscribe(dc),
323 > BreakdownMetricsByTaskQueue: dynamicconfig.MetricsBreakdownByTaskQueue.Get(dc),
324 > BreakdownMetricsByPartition: dynamicconfig.MetricsBreakdownByPartition.Get(dc),
325 > BreakdownMetricsByBuildID: dynamicconfig.MetricsBreakdownByBuildID.Get(dc),
326 > EnableWorkerPluginMetrics: dynamicconfig.MatchingEnableWorkerPluginMetrics.Get(dc),
327 > EnablePollerAutoscalingMetrics: dynamicconfig.MatchingEnablePollerAutoscalingMetrics.Get(dc),
328 > ExternalPayloadsEnabled: dynamicconfig.ExternalPayloadsEnabled.Get(dc),
329 > WorkerRegistryNumBuckets: dynamicconfig.MatchingWorkerRegistryNumBuckets.Get(dc),
330 > WorkerRegistryEntryTTL: dynamicconfig.MatchingWorkerRegistryEntryTTL.Get(dc),
331 > WorkerRegistryMinEvictAge: dynamicconfig.MatchingWorkerRegistryMinEvictAge.Get(dc),
332 > WorkerRegistryMaxEntries: dynamicconfig.MatchingWorkerRegistryMaxEntries.Get(dc),
333 > WorkerRegistryEvictionInterval: dynamicconfig.MatchingWorkerRegistryEvictionInterval.Get(dc),
334 > ForwarderMaxOutstandingPolls: dynamicconfig.MatchingForwarderMaxOutstandingPolls.Get(dc),
335 > ForwarderMaxOutstandingTasks: dynamicconfig.MatchingForwarderMaxOutstandingTasks.Get(dc),
336 > ForwarderMaxRatePerSecond: dynamicconfig.MatchingForwarderMaxRatePerSecond.Get(dc),
337 > ForwarderMaxChildrenPerNode: dynamicconfig.MatchingForwarderMaxChildrenPerNode.Get(dc),
338 > AlignMembershipChange: dynamicconfig.MatchingAlignMembershipChange.Get(dc),
339 > ShutdownDrainDuration: dynamicconfig.MatchingShutdownDrainDuration.Get(dc),
340 > VersionCompatibleSetLimitPerQueue: dynamicconfig.VersionCompatibleSetLimitPerQueue.Get(dc),
341 > VersionBuildIdLimitPerQueue: dynamicconfig.VersionBuildIdLimitPerQueue.Get(dc),
342 > AssignmentRuleLimitPerQueue: dynamicconfig.AssignmentRuleLimitPerQueue.Get(dc),
343 > RedirectRuleLimitPerQueue: dynamicconfig.RedirectRuleLimitPerQueue.Get(dc),
344 > RedirectRuleMaxUpstreamBuildIDsPerQueue: dynamicconfig.RedirectRuleMaxUpstreamBuildIDsPerQueue.Get(dc),
345 > DeletedRuleRetentionTime: dynamicconfig.MatchingDeletedRuleRetentionTime.Get(dc),
346 > PollerHistoryTTL: dynamicconfig.PollerHistoryTTL.Get(dc),
347 > EnableMatchingFanOutForPollCancellation: dynamicconfig.EnableMatchingFanOutForPollCancellation.Get(dc),
348 > ReachabilityBuildIdVisibilityGracePeriod: dynamicconfig.ReachabilityBuildIdVisibilityGracePeriod.Get(dc),
349 > ReachabilityCacheOpenWFsTTL: dynamicconfig.ReachabilityCacheOpenWFsTTL.Get(dc),
350 > ReachabilityCacheClosedWFsTTL: dynamicconfig.ReachabilityCacheClosedWFsTTL.Get(dc),
351 > TaskQueueLimitPerBuildId: dynamicconfig.TaskQueuesPerBuildIdLimit.Get(dc),
352 > GetUserDataLongPollTimeout: dynamicconfig.MatchingGetUserDataLongPollTimeout.Get(dc), // Use -10 seconds so that we send back empty response instead of timeout
353 > GetUserDataRefresh: dynamicconfig.MatchingGetUserDataRefresh.Get(dc),
354 > EphemeralDataUpdateInterval: dynamicconfig.MatchingEphemeralDataUpdateInterval.Get(dc),
355 > BacklogMetricsEmitInterval: dynamicconfig.MatchingBacklogMetricsEmitInterval.Get(dc),
356 > PriorityBacklogForwarding: dynamicconfig.MatchingPriorityBacklogForwarding.Get(dc),
357 > BacklogNegligibleAge: dynamicconfig.MatchingBacklogNegligibleAge.Get(dc),
358 > MaxWaitForPollerBeforeFwd: dynamicconfig.MatchingMaxWaitForPollerBeforeFwd.Get(dc),
359 > QueryPollerUnavailableWindow: dynamicconfig.QueryPollerUnavailableWindow.Get(dc),
360 > WorkerControllerNoPollerHookWindow: dynamicconfig.WorkerControllerNoPollerHookWindow.Get(dc),
361 > EmitTaskDispatchLatencyAtPoll: dynamicconfig.MatchingEmitTaskDispatchLatencyAtPoll.Get(dc),
362 > QueryWorkflowTaskTimeoutLogRate: dynamicconfig.MatchingQueryWorkflowTaskTimeoutLogRate.Get(dc),
363 > MembershipUnloadDelay: dynamicconfig.MatchingMembershipUnloadDelay.Get(dc),
364 > TaskQueueInfoByBuildIdTTL: dynamicconfig.TaskQueueInfoByBuildIdTTL.Get(dc),
365 > PriorityLevels: dynamicconfig.MatchingPriorityLevels.Get(dc),
366 > RateLimiterRefreshInterval: time.Minute,
367 > FairnessKeyRateLimitCacheSize: dynamicconfig.MatchingFairnessKeyRateLimitCacheSize.Get(dc),
368 > MaxFairnessKeyWeightOverrides: dynamicconfig.MatchingMaxFairnessKeyWeightOverrides.Get(dc),
369 > MaxIDLengthLimit: dynamicconfig.MaxIDLengthLimit.Get(dc),
370 >
371 > AdminNamespaceToPartitionDispatchRate: dynamicconfig.AdminMatchingNamespaceToPartitionDispatchRate.Get(dc),
372 > AdminNamespaceToPartitionRateSub: dynamicconfig.AdminMatchingNamespaceToPartitionDispatchRate.Subscribe(dc),
373 > AdminNamespaceTaskqueueToPartitionDispatchRate: dynamicconfig.AdminMatchingNamespaceTaskqueueToPartitionDispatchRate.Get(dc),
374 > AdminNamespaceTaskqueueToPartitionRateSub: dynamicconfig.AdminMatchingNamespaceTaskqueueToPartitionDispatchRate.Subscribe(dc),
375 >
376 > VisibilityPersistenceMaxReadQPS: dynamicconfig.VisibilityPersistenceMaxReadQPS.Get(dc),
377 > VisibilityPersistenceMaxWriteQPS: dynamicconfig.VisibilityPersistenceMaxWriteQPS.Get(dc),
378 > VisibilityPersistenceSlowQueryThreshold: dynamicconfig.VisibilityPersistenceSlowQueryThreshold.Get(dc),
379 > EnableReadFromSecondaryVisibility: dynamicconfig.EnableReadFromSecondaryVisibility.Get(dc),
380 > VisibilityEnableShadowReadMode: dynamicconfig.VisibilityEnableShadowReadMode.Get(dc),
381 > VisibilityDisableOrderByClause: dynamicconfig.VisibilityDisableOrderByClause.Get(dc),
382 > VisibilityEnableManualPagination: dynamicconfig.VisibilityEnableManualPagination.Get(dc),
383 > VisibilityEnableUnifiedQueryConverter: dynamicconfig.VisibilityEnableUnifiedQueryConverter.Get(dc),
384 >
385 > ListNexusEndpointsLongPollTimeout: dynamicconfig.MatchingListNexusEndpointsLongPollTimeout.Get(dc),
386 > NexusEndpointsRefreshInterval: dynamicconfig.MatchingNexusEndpointsRefreshInterval.Get(dc),
387 > MinDispatchTaskTimeout: nexusoperations.MinDispatchTaskTimeout.Get(dc),
388 >
389 > PollerScalingBacklogAgeScaleUp: dynamicconfig.MatchingPollerScalingBacklogAgeScaleUp.Get(dc),
390 > PollerScalingWaitTime: dynamicconfig.MatchingPollerScalingWaitTime.Get(dc),
391 > PollerScalingDecisionsPerSecond: dynamicconfig.MatchingPollerScalingDecisionsPerSecond.Get(dc),
392 > PollerScalingTaskAddToDispatchRatio: dynamicconfig.MatchingPollerScalingTaskAddToDispatchRatio.Get(dc),
393 > EnablePollerScalingDecisionMetrics: dynamicconfig.MatchingEnablePollerScalingDecisionMetrics.Get(dc),
394 >
395 > FairnessCounter: dynamicconfig.MatchingFairnessCounter.Get(dc),
396 > FairnessPassDither: dynamicconfig.MatchingFairnessPassDither.Get(dc),
397 > PartitionScaleAllowedDrift: dynamicconfig.MatchingPartitionScaleAllowedDrift.Get(dc),
398 > PartitionScaleManagerSettings: dynamicconfig.MatchingPartitionScaleManager.Get(dc),
399 >
400 > LogAllReqErrors: dynamicconfig.LogAllReqErrors.Get(dc),
401 >
402 > RateLimitFractionProvider: defaultTaskQueueRateLimitFractionProvider,
403 > }
404 > }
405
406 > func newTaskQueueConfig(tq *tqid.TaskQueue, config *Config, ns namespace.Name) *taskQueueConfig { config.go ×1
407 > taskQueueName := tq.Name()
408 > taskType := tq.TaskType()
409 > priorityLevels := priorityKey(config.PriorityLevels(ns.String(), taskQueueName, taskType))
410 > priorityLevels = max(priorityLevels, min(priorityLevels, maxPriorityLevels), 1)
411 > defaultPriorityKey := (priorityLevels + 1) / 2
412 >
413 > return &taskQueueConfig{
414 > RangeSize: config.RangeSize,
415 > NewMatcherSub: func(cb func(dynamicconfig.GradualChange[bool])) (dynamicconfig.GradualChange[bool], func()) {
416 > return config.NewMatcherSub(ns.String(), taskQueueName, taskType, cb) task_queue_partition_manager.go ×14
417 > },
418 > EnableFairnessSub: func(cb func(dynamicconfig.GradualChange[bool])) (dynamicconfig.GradualChange[bool], func()) {
419 > return config.EnableFairnessSub(ns.String(), taskQueueName, taskType, cb)
420 > },
421 > EnableMigration: func() bool { physical_task_queue_manager.go ×2
422 > return config.EnableMigration(ns.String(), taskQueueName, taskType)
423 > },
424 > AutoEnableV2: func() bool { config.go ×1
425 > v, _ := config.AutoEnableV2Sub(ns.String(), taskQueueName, taskType, nil)
426 > return v
427 > },
428 > AutoEnableV2Sub: func(cb func(bool)) (bool, func()) { task_queue_partition_manager.go ×14
429 > return config.AutoEnableV2Sub(ns.String(), taskQueueName, taskType, cb)
430 > },
431 > GetTasksBatchSize: func() int { config.go ×1
432 > return config.GetTasksBatchSize(ns.String(), taskQueueName, taskType)
433 > },
434 > GetTasksReloadAt: func() int { config.go ×1
435 > return config.GetTasksReloadAt(ns.String(), taskQueueName, taskType)
436 > },
437 > ForceReadTasksOnWrite: func() bool { config.go ×1
438 > return config.ForceReadTasksOnWrite(ns.String(), taskQueueName, taskType)
439 > },
440 > UpdateAckInterval: func() time.Duration { config.go ×1
441 > return config.UpdateAckInterval(ns.String(), taskQueueName, taskType)
442 > },
443 > MetadataUpdateOnAppendInterval: func() time.Duration { config.go ×2
444 > return config.MetadataUpdateOnAppendInterval(ns.String(), taskQueueName, taskType)
445 > },
446 > MaxTaskQueueIdleTime: func() time.Duration { matching_engine.go ×4
447 > return config.MaxTaskQueueIdleTime(ns.String(), taskQueueName, taskType)
448 > },
449 > MinTaskThrottlingBurstSize: func() int { ratelimit_manager.go ×2
450 > return config.MinTaskThrottlingBurstSize(ns.String(), taskQueueName, taskType)
451 > },
452 > SyncMatchWaitDuration: func() time.Duration { config.go ×1
453 > return config.SyncMatchWaitDuration(ns.String(), taskQueueName, taskType)
454 > },
455 > EphemeralDataUpdateInterval: func() time.Duration { task_queue_partition_manager.go ×2
456 > return config.EphemeralDataUpdateInterval(ns.String(), taskQueueName, taskType)
457 > },
458 > BacklogMetricsEmitInterval: func() time.Duration { config.go ×1
459 > return config.BacklogMetricsEmitInterval(ns.String(), taskQueueName, taskType)
460 > },
461 PriorityBacklogForwarding: func() bool {
462 return config.PriorityBacklogForwarding(ns.String(), taskQueueName, taskType)
463 },
464 > BacklogNegligibleAge: func() time.Duration { config.go ×1
465 > return config.BacklogNegligibleAge(ns.String(), taskQueueName, taskType)
466 > },
467 > MaxWaitForPollerBeforeFwd: func() time.Duration { config.go ×1
468 > return config.MaxWaitForPollerBeforeFwd(ns.String(), taskQueueName, taskType)
469 > },
470 QueryPollerUnavailableWindow: config.QueryPollerUnavailableWindow,
471 WorkerControllerNoPollerHookWindow: config.WorkerControllerNoPollerHookWindow,
472 > EmitTaskDispatchLatencyAtPoll: func() bool { config.go ×1
473 > return config.EmitTaskDispatchLatencyAtPoll(ns.String(), taskQueueName, taskType)
474 > },
475 > LongPollExpirationInterval: func() time.Duration { config.go ×1
476 > return config.LongPollExpirationInterval(ns.String(), taskQueueName, taskType)
477 > },
478 > BacklogTaskForwardTimeout: func() time.Duration { config.go ×1
479 > return config.BacklogTaskForwardTimeout(ns.String(), taskQueueName, taskType)
480 > },
481 > ForwardPollRetryMaxInterval: func() time.Duration { pri_matcher.go ×6
482 > return config.ForwardPollRetryMaxInterval(ns.String(), taskQueueName, taskType)
483 > },
484 > MaxTaskDeleteBatchSize: func() int { config.go ×1
485 > return config.MaxTaskDeleteBatchSize(ns.String(), taskQueueName, taskType)
486 > },
487 > TaskDeleteInterval: func() time.Duration { config.go ×1
488 > return config.TaskDeleteInterval(ns.String(), taskQueueName, taskType)
489 > },
490 PriorityLevels: priorityLevels,
491 DefaultPriorityKey: defaultPriorityKey,
492 GetUserDataLongPollTimeout: config.GetUserDataLongPollTimeout,
493 GetUserDataMinWaitTime: 1 * time.Second,
494 GetUserDataReturnBudget: returnEmptyTaskTimeBudget,
495 GetUserDataInitialRefresh: ioTimeout,
496 GetUserDataRefresh: config.GetUserDataRefresh,
497 > OutstandingTaskAppendsThreshold: func() int { config.go ×1
498 > return config.OutstandingTaskAppendsThreshold(ns.String(), taskQueueName, taskType)
499 > },
500 > MaxTaskBatchSize: func() int { config.go ×2
501 > return config.MaxTaskBatchSize(ns.String(), taskQueueName, taskType)
502 > },
503 > NumWritePartitions: func() int { task_queue_partition_manager.go ×2
504 > return max(1, config.NumTaskqueueWritePartitions(ns.String(), taskQueueName, taskType))
505 > },
506 > NumReadPartitions: func() int { config.go ×1
507 > return max(1, config.NumTaskqueueReadPartitions(ns.String(), taskQueueName, taskType))
508 > },
509 > NumReadPartitionsSub: func(cb func(int)) (int, func()) { config.go ×4
510 > return config.NumTaskqueueReadPartitionsSub(ns.String(), taskQueueName, taskType, cb)
511 > },
512 > BreakdownMetricsByTaskQueue: func() bool { config.go ×1
513 > return config.BreakdownMetricsByTaskQueue(ns.String(), taskQueueName, taskType)
514 > },
515 > BreakdownMetricsByPartition: func() bool { config.go ×1
516 > return config.BreakdownMetricsByPartition(ns.String(), taskQueueName, taskType)
517 > },
518 > BreakdownMetricsByBuildID: func() bool { config.go ×1
519 > return config.BreakdownMetricsByBuildID(ns.String(), taskQueueName, taskType)
520 > },
521 AdminNamespaceToPartitionDispatchRate: func() float64 {
522 return config.AdminNamespaceToPartitionDispatchRate(ns.String())
523 },
524 > AdminNamespaceToPartitionRateSub: func(cb func(float64)) (float64, func()) { config.go ×4
525 > return config.AdminNamespaceToPartitionRateSub(ns.String(), cb)
526 > },
527 AdminNamespaceTaskQueueToPartitionDispatchRate: func() float64 {
528 return config.AdminNamespaceTaskqueueToPartitionDispatchRate(ns.String(), taskQueueName, taskType)
529 },
530 > AdminNamespaceTaskQueueToPartitionRateSub: func(cb func(float64)) (float64, func()) { config.go ×4
531 > return config.AdminNamespaceTaskqueueToPartitionRateSub(ns.String(), taskQueueName, taskType, cb)
532 > },
533 forwarderConfig: forwarderConfig{
534 > ForwarderMaxOutstandingPolls: func() int { config.go ×1
535 > return config.ForwarderMaxOutstandingPolls(ns.String(), taskQueueName, taskType)
536 > },
537 > ForwarderMaxOutstandingTasks: func() int {
538 > return config.ForwarderMaxOutstandingTasks(ns.String(), taskQueueName, taskType)
539 > },
540 > ForwarderMaxRatePerSecond: func() float64 { config.go ×1
541 > return config.ForwarderMaxRatePerSecond(ns.String(), taskQueueName, taskType)
542 > },
543 > ForwarderMaxChildrenPerNode: func() int { config.go ×1
544 > return max(1, config.ForwarderMaxChildrenPerNode(ns.String(), taskQueueName, taskType))
545 > },
546 },
547 GetUserDataRetryPolicy: backoff.NewExponentialRetryPolicy(1 * time.Second).WithMaximumInterval(5 * time.Minute).WithExpirationInterval(backoff.NoInterval),
548 > TaskQueueInfoByBuildIdTTL: func() time.Duration { config.go ×1
549 > return config.TaskQueueInfoByBuildIdTTL(ns.String(), taskQueueName, taskType)
550 > },
551 > RateLimitFraction: func() float64 { config.go ×4
552 > return config.RateLimitFractionProvider.GetRateLimitFraction(ns, taskQueueName, taskType)
553 > },
554 RateLimiterRefreshInterval: config.RateLimiterRefreshInterval,
555 > FairnessKeyRateLimitCacheSize: func() int { config.go ×1
556 > return config.FairnessKeyRateLimitCacheSize(ns.String(), taskQueueName, taskType)
557 > },
558 MaxFairnessKeyWeightOverrides: func() int {
559 return config.MaxFairnessKeyWeightOverrides(ns.String(), taskQueueName, taskType)
560 },
561 > PollerHistoryTTL: func() time.Duration { task_queue_partition_manager.go ×5
562 > return config.PollerHistoryTTL(ns.String())
563 > },
564 > PollerScalingBacklogAgeScaleUp: func() time.Duration { config.go ×1
565 > return config.PollerScalingBacklogAgeScaleUp(ns.String(), taskQueueName, taskType)
566 > },
567 > PollerScalingWaitTime: func() time.Duration { config.go ×1
568 > return config.PollerScalingWaitTime(ns.String(), taskQueueName, taskType)
569 > },
570 > PollerScalingDecisionsPerSecond: func() float64 { task_queue_partition_manager.go ×5
571 > return config.PollerScalingDecisionsPerSecond(ns.String(), taskQueueName, taskType)
572 > },
573 > PollerScalingTaskAddToDispatchRatio: func() float64 { config.go ×1
574 > return config.PollerScalingTaskAddToDispatchRatio(ns.String(), taskQueueName, taskType)
575 > },
576 > EnablePollerScalingDecisionMetrics: func() bool { config.go ×1
577 > return config.EnablePollerScalingDecisionMetrics(ns.String(), taskQueueName, taskType)
578 > },
579 > FairnessCounter: func() counter.CounterParams { physical_task_queue_manager.go ×2
580 > return config.FairnessCounter(ns.String(), taskQueueName, taskType)
581 > },
582 > FairnessPassDither: func() bool { fair_task_writer.go ×17
583 > return config.FairnessPassDither(ns.String(), taskQueueName, taskType)
584 > },
585 PartitionScaleAllowedDrift: func() dynamicconfig.PartitionScaleAllowedDrift {
586 return config.PartitionScaleAllowedDrift(ns.String(), taskQueueName, taskType)
587 },
588 > PartitionScaleManagerSettings: func() dynamicconfig.PartitionScaleManagerSettings { service_grpc.pb.go ×20
589 > return config.PartitionScaleManagerSettings(ns.String(), taskQueueName, taskType)
590 > },
591 MaxVersionsInTaskQueue: func() int { return config.MaxVersionsInTaskQueue(ns.String()) },
592 }
593 }
594
595 > func (c *taskQueueConfig) clipPriority(priority priorityKey) priorityKey { config.go ×2
596 > if priority == 0 {
597 > priority = c.DefaultPriorityKey config.go ×1
598 > }
599 > priority = max(priority, 1) config.go ×2
600 > priority = min(priority, c.PriorityLevels)
601 > return priority
602 }
603
604 > func (c *taskQueueConfig) setDefaultPriority(task *internalTask) { config.go ×1
605 > if task.effectivePriority == 0 {
606 > task.effectivePriority = effectivePriorityFactor * c.DefaultPriorityKey config.go ×1
607 > }
608 }