Commit 2d4d03d
MINOR: gate: re-upsert only the Gateways whose conflict verdict changed
A listener conflict is a relational property: it depends on the listeners of
the other Gateways. A Gateway can therefore enter or leave the conflict set
without any event of its own -- adding a listener to an older Gateway
invalidates a younger Gateway's listener on the same port, and deleting the
older one frees it again.
The conflict table is rebuilt for the whole tree on every cycle, but the
transfer of a verdict onto a listener (checkConflict -> CheckConflict ->
BuildConditions) only runs for Gateways marked StatusUpserted. Re-upserting an
untouched Gateway is what routes it through that single transfer point, so the
selection of Gateways to re-upsert must cover every verdict change.
Until now that selection was the union of the Gateways having a conflicting
listener in the previous cycle and those having one in the current cycle. It
was correct but coarse in one direction and blind in another:
- a lasting misconfiguration keeps its Gateways in both sets, so they were
re-upserted on every single cycle, whatever the event that triggered it.
Each re-upsert replays all five listener checks, down to re-reading the
Secrets and PEM-decoding the certificates in checkCertificateRefs, to
conclude that nothing changed;
- conversely, a listener staying conflicted while its reason changes (for
instance ProtocolConflict becoming HostnameConflict) does not change its
membership of either set, so the stale reason was never refreshed.
Replace the two set computations with a value diff of the previous and current
conflict tables. Both tables hold an entry for every listener of the tree,
conflicting or not, so comparing the listenerConflictCondition values yields
exactly the listeners whose verdict changed -- entering, leaving, or keeping a
conflict with a different reason -- and nothing else.
The diff works at listener granularity and derives the Gateway keys from the
listener keys, which is also the granularity needed to extend the mechanism to
resources other than Gateways.1 parent 8e523a0 commit 2d4d03d
2 files changed
Lines changed: 62 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
206 | | - | |
207 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
208 | 222 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 223 | + | |
| 224 | + | |
212 | 225 | | |
213 | 226 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 227 | + | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| |||
232 | 237 | | |
233 | 238 | | |
234 | 239 | | |
235 | | - | |
236 | | - | |
237 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
238 | 247 | | |
239 | 248 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
247 | 263 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
255 | 282 | | |
| 283 | + | |
256 | 284 | | |
257 | 285 | | |
| 286 | + | |
258 | 287 | | |
259 | 288 | | |
260 | 289 | | |
| |||
0 commit comments