Commit 6d09a34
authored
Auto-enroll pollers into autoscaling on PollerAutoscalingAutoEnroll (Java SDK) (#2953)
* Auto-enroll pollers into autoscaling on PollerAutoscalingAutoEnroll
When a namespace advertises the PollerAutoscalingAutoEnroll capability,
automatically switch a poller type to poller autoscaling if the user left
it at its default (set neither MaxConcurrent<Type>TaskPollers nor a
<Type>TaskPollerBehavior). Explicitly configured pollers are untouched.
Auto-enroll implies full autoscaling support, so it also enables
serverSupportsAutoscaling (scale-down). Applies to workflow, activity, and
nexus pollers.
The decision is made at worker start(), after namespace capabilities are
loaded, by rebuilding each dormant worker's PollerOptions before its poller
is created. Per-poller-type eligibility is captured at Worker construction
from the raw (pre-defaulting) WorkerOptions and threaded through
PollerOptions.
Also bumps the temporal/api proto submodule to pick up the
poller_autoscaling_auto_enroll namespace capability (api #803).
* Address review: track poller-setter intent for auto-enroll eligibility
- Determine auto-enroll eligibility from whether the user actually called a
poller setter (MaxConcurrent<Type>TaskPollers or <Type>TaskPollerBehavior),
tracked on WorkerOptions.Builder and carried through build/validate/copy,
instead of inferring from the resolved option values. This fixes the case
where options from getDefaultInstance()/validateAndBuildWithDefaults() carry
the numeric default (5) and would wrongly look explicitly configured.
- Worker reads the new WorkerOptions eligibility getters instead of the raw
pre-defaulting options.
- Reword the NamespaceCapabilities comment to explain why auto-enroll also
enables pollerAutoscaling (serverSupportsAutoscaling in PollScaleReportHandle),
and fix the mangled comment in Worker.
- Expand tests: eligibility from getDefaultInstance()/validateAndBuildWithDefaults()
and copies stays eligible; an explicit count equal to the numeric default is
ineligible. Add a full start-path E2E test asserting workflow/activity/nexus
pollers become autoscaling when the namespace advertises the capability.
* Address review: don't couple auto-enroll to the pollerAutoscaling flag
The auto-enroll capability no longer forces NamespaceCapabilities.pollerAutoscaling
on. The server advertises pollerAutoscaling independently (and unconditionally), so
the pre-existing getPollerAutoscaling() read already enables scale-down for
auto-enrolled pollers; the extra coupling was redundant and conflated the
scale-down flag with the enrollment decision.
setFromCapabilities reverts to reading each capability separately. The auto-enroll
field/getter stay, since the enrollment decision still needs them and is independent
of isPollerAutoscaling(). Replaced the obsolete implication test with one asserting
the two capabilities are independent.
* Fix awkward comment wrapping in WorkerPollerAutoEnrollEligibilityTest1 parent 8b57794 commit 6d09a34
11 files changed
Lines changed: 647 additions & 17 deletions
File tree
- temporal-sdk/src
- main/java/io/temporal
- internal/worker
- worker
- test/java/io/temporal
- internal/worker
- worker
- temporal-serviceclient/src/main
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
Lines changed: 44 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| |||
46 | 68 | | |
47 | 69 | | |
48 | 70 | | |
| 71 | + | |
49 | 72 | | |
50 | 73 | | |
51 | 74 | | |
| |||
65 | 88 | | |
66 | 89 | | |
67 | 90 | | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| |||
152 | 176 | | |
153 | 177 | | |
154 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
155 | 189 | | |
156 | 190 | | |
157 | 191 | | |
| |||
180 | 214 | | |
181 | 215 | | |
182 | 216 | | |
183 | | - | |
| 217 | + | |
| 218 | + | |
184 | 219 | | |
185 | 220 | | |
186 | 221 | | |
| |||
198 | 233 | | |
199 | 234 | | |
200 | 235 | | |
| 236 | + | |
201 | 237 | | |
202 | 238 | | |
203 | 239 | | |
| |||
211 | 247 | | |
212 | 248 | | |
213 | 249 | | |
214 | | - | |
| 250 | + | |
| 251 | + | |
215 | 252 | | |
216 | 253 | | |
217 | 254 | | |
| |||
224 | 261 | | |
225 | 262 | | |
226 | 263 | | |
| 264 | + | |
227 | 265 | | |
228 | 266 | | |
229 | 267 | | |
| |||
274 | 312 | | |
275 | 313 | | |
276 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
277 | 319 | | |
278 | 320 | | |
279 | 321 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| |||
Lines changed: 24 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
135 | 144 | | |
136 | 145 | | |
137 | 146 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
143 | | - | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
| |||
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
177 | | - | |
| 187 | + | |
| 188 | + | |
178 | 189 | | |
179 | 190 | | |
180 | 191 | | |
| |||
194 | 205 | | |
195 | 206 | | |
196 | 207 | | |
197 | | - | |
| 208 | + | |
| 209 | + | |
198 | 210 | | |
199 | 211 | | |
200 | 212 | | |
| |||
901 | 913 | | |
902 | 914 | | |
903 | 915 | | |
904 | | - | |
| 916 | + | |
| 917 | + | |
905 | 918 | | |
906 | 919 | | |
907 | 920 | | |
| |||
920 | 933 | | |
921 | 934 | | |
922 | 935 | | |
| 936 | + | |
923 | 937 | | |
924 | 938 | | |
925 | 939 | | |
| |||
932 | 946 | | |
933 | 947 | | |
934 | 948 | | |
935 | | - | |
| 949 | + | |
| 950 | + | |
936 | 951 | | |
937 | 952 | | |
938 | 953 | | |
| |||
948 | 963 | | |
949 | 964 | | |
950 | 965 | | |
| 966 | + | |
951 | 967 | | |
952 | 968 | | |
953 | 969 | | |
| |||
962 | 978 | | |
963 | 979 | | |
964 | 980 | | |
965 | | - | |
| 981 | + | |
| 982 | + | |
966 | 983 | | |
967 | 984 | | |
968 | 985 | | |
| |||
1005 | 1022 | | |
1006 | 1023 | | |
1007 | 1024 | | |
| 1025 | + | |
1008 | 1026 | | |
1009 | 1027 | | |
1010 | 1028 | | |
| |||
0 commit comments