Commit 3bb32ec
committed
fix(dist): widen replica fan-out on promotion and add forward_promotion metric
When `setImpl` promotes a local replica due to an unreachable primary,
pass the full `owners` list to `replicateTo` (instead of `owners[1:]`).
This ensures the dead primary's slot is included in best-effort replication,
so `replicateTo`'s existing failure-path queues a hinted handoff for it.
Post-restart convergence is now bounded by `WithDistHintReplayInterval`
(~200ms default) rather than the next merkle tick.
Add a new OTel counter `dist.write.forward_promotion` (internal atomic
`writeForwardPromotion`) that increments each time promotion fires. A
steadily rising counter surfaces a flapping primary well before any
read/write error spikes.
Expand `TestDistSet_PromotesOnGenericForwardError` to:
- assert `WriteForwardPromotion` increments on every promotion
- assert `HintedQueued` increments (proving the hint was enqueued)
- heal chaos and confirm the original primary receives the write via
natural hint-replay, using a `waitForLocalContains` polling helper
to absorb scheduling jitter
- configure a 20ms hint-replay interval for fast, deterministic recovery
assertions
Also updates CHANGELOG.md with a detailed description of the defense-in-
depth approach and the extended test coverage.1 parent e19ab38 commit 3bb32ec
3 files changed
Lines changed: 85 additions & 7 deletions
File tree
- pkg/backend
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
| 290 | + | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
| |||
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
306 | 314 | | |
307 | 315 | | |
308 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1274 | 1274 | | |
1275 | 1275 | | |
1276 | 1276 | | |
| 1277 | + | |
1277 | 1278 | | |
1278 | 1279 | | |
1279 | 1280 | | |
| |||
1334 | 1335 | | |
1335 | 1336 | | |
1336 | 1337 | | |
| 1338 | + | |
1337 | 1339 | | |
1338 | 1340 | | |
1339 | 1341 | | |
| |||
1409 | 1411 | | |
1410 | 1412 | | |
1411 | 1413 | | |
| 1414 | + | |
1412 | 1415 | | |
1413 | 1416 | | |
1414 | 1417 | | |
| |||
3657 | 3660 | | |
3658 | 3661 | | |
3659 | 3662 | | |
| 3663 | + | |
| 3664 | + | |
3660 | 3665 | | |
3661 | 3666 | | |
3662 | 3667 | | |
| |||
3823 | 3828 | | |
3824 | 3829 | | |
3825 | 3830 | | |
| 3831 | + | |
| 3832 | + | |
3826 | 3833 | | |
3827 | 3834 | | |
3828 | 3835 | | |
| |||
3832 | 3839 | | |
3833 | 3840 | | |
3834 | 3841 | | |
| 3842 | + | |
| 3843 | + | |
3835 | 3844 | | |
3836 | 3845 | | |
3837 | 3846 | | |
| |||
3840 | 3849 | | |
3841 | 3850 | | |
3842 | 3851 | | |
3843 | | - | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
3844 | 3865 | | |
3845 | 3866 | | |
3846 | 3867 | | |
| |||
4192 | 4213 | | |
4193 | 4214 | | |
4194 | 4215 | | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
4195 | 4221 | | |
4196 | 4222 | | |
4197 | 4223 | | |
| |||
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
74 | 118 | | |
0 commit comments