Commit 3fe57a7
committed
Use atomics for HEALTHZ command
The HEALTHZ command is used to detect if there a leader or follower
are ready for commands. All that it cares about is if the leader
has it's data fully loaded in memory, and that a follower is
caught up to the leader.
Previously there was a read lock around the 'caught up' flags,
which could potentially be blocked by other operations such as
SET and INTERSECTS. This commit removes the shared read lock when
running the HEALTHZ command. It now uses atomics bit flags for the
'caught up' flags.
The result is that the HEALTHZ command should have little-to-no
noticable contention, always appearing instant to the user.1 parent fbf767a commit 3fe57a7
File tree
5 files changed
+51
-29
lines changed- internal/server
5 files changed
+51
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
206 | 230 | | |
207 | 231 | | |
208 | 232 | | |
209 | 233 | | |
210 | 234 | | |
211 | 235 | | |
212 | | - | |
| 236 | + | |
213 | 237 | | |
214 | 238 | | |
215 | 239 | | |
| |||
305 | 329 | | |
306 | 330 | | |
307 | 331 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 332 | + | |
312 | 333 | | |
313 | 334 | | |
314 | 335 | | |
| |||
339 | 360 | | |
340 | 361 | | |
341 | 362 | | |
342 | | - | |
343 | | - | |
| 363 | + | |
344 | 364 | | |
345 | 365 | | |
346 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
746 | | - | |
| 746 | + | |
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
| 799 | + | |
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
| |||
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
852 | | - | |
| 852 | + | |
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
| |||
1029 | 1028 | | |
1030 | 1029 | | |
1031 | 1030 | | |
1032 | | - | |
| 1031 | + | |
1033 | 1032 | | |
1034 | | - | |
1035 | 1033 | | |
1036 | 1034 | | |
1037 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1038 | 1041 | | |
1039 | 1042 | | |
1040 | 1043 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| |||
168 | 166 | | |
169 | 167 | | |
170 | 168 | | |
171 | | - | |
172 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
| |||
0 commit comments