Commit b54720e
authored
dynamic_modules: skip host-set republish when addHosts adds no new hosts (#45627)
**Commit Message:** dynamic_modules: skip host-set republish when
addHosts adds no new hosts
**Additional Description:**
A dynamic module cluster re-applies its full host set from the control
plane periodically. addHosts already skips
addresses already present in the cluster, but when a batch contains only
such addresses (eg., a control plane re-send
on reconnect), it still rebuilds and republishes the unchanged host set:
it copies the whole host vector, re-partitions
every host, rebuilds per-locality, and calls updateHosts, which fans out
to every worker and fires a (0, 0)
membership update. In a cluster with millions of hosts that is a full
O(N) rebuild and cross-thread publish for zero
membership change.
This returns early from addHosts when no new hosts remain after
filtering, so a no-op re-send does no per-worker republish.
Risk Level: Low
Testing: Unit Test
Docs Changes: N.A
Release Notes: N.A
Platform Specific Features: N.A
Signed-off-by: Basundhara Chakrabarty <basundhara17061996@gmail.com>1 parent 214a094 commit b54720e
2 files changed
Lines changed: 24 additions & 1 deletion
File tree
- source/extensions/clusters/dynamic_modules
- test/extensions/clusters/dynamic_modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
456 | 463 | | |
457 | 464 | | |
458 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
341 | 352 | | |
342 | 353 | | |
343 | 354 | | |
344 | 355 | | |
345 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
346 | 362 | | |
347 | 363 | | |
348 | 364 | | |
| |||
0 commit comments