Commit 849d1b7
authored
feat: skip memberlist zone-aware routing if there is a zone with members but no alive bridges (#800)
**What this PR does**:
When zone-aware routing is enabled, if there is a zone with members but
no alive bridges we end up in a network partitioning state. I think we
can make the routing logic more resilient by checking for this specific
condition, and internally disable the zone-aware routing if we detect a
zone without alive bridges.
The new logic is definitely slower than the previous one, but in
absolute terms I don't think it's prohibitive. `SelectNodes()` gets
called once every gossip interval (200ms) and takes 0.17ms with 10K
nodes and 2 zones (10K nodes is a pretty large scale):
```
goos: darwin
goarch: arm64
pkg: github.com/grafana/dskit/kv/memberlist
cpu: Apple M3 Pro
BenchmarkZoneAwareNodeSelectionDelegate_SelectNodes-11 7033 170166 ns/op 81922 B/op 1 allocs/op
BenchmarkZoneAwareNodeSelectionDelegate_SelectNodes-11 6940 170834 ns/op 81922 B/op 1 allocs/op
BenchmarkZoneAwareNodeSelectionDelegate_SelectNodes-11 6925 171649 ns/op 81922 B/op 1 allocs/op
BenchmarkZoneAwareNodeSelectionDelegate_SelectNodes-11 6906 213222 ns/op 81922 B/op 1 allocs/op
BenchmarkZoneAwareNodeSelectionDelegate_SelectNodes-11 6957 172906 ns/op 81922 B/op 1 allocs/op
PASS
ok github.com/grafana/dskit/kv/memberlist 9.339s
```
This PR is based on grafana/memberlist#13.
**Which issue(s) this PR fixes**:
N/A
**Checklist**
- [x] Tests updated
---------
Signed-off-by: Marco Pracucci <marco@pracucci.com>1 parent 191763b commit 849d1b7
File tree
5 files changed
+377
-100
lines changed- kv/memberlist
5 files changed
+377
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
96 | 112 | | |
97 | 113 | | |
98 | 114 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
106 | 182 | | |
107 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
108 | 190 | | |
109 | 191 | | |
110 | | - | |
| 192 | + | |
111 | 193 | | |
112 | 194 | | |
113 | 195 | | |
| |||
132 | 214 | | |
133 | 215 | | |
134 | 216 | | |
135 | | - | |
136 | | - | |
137 | 217 | | |
138 | 218 | | |
139 | 219 | | |
| |||
0 commit comments