Repository navigation
Commit 95138e0
authored
fix(kafka): preserve stable log.dirs ordering across storageConfigs changes (#350)
Previously, getEffectiveLogDirsMountPaths() seeded the effective list
directly from mountPathsNew (the freshly generated order from the
current storageConfigs spec), so simply reordering entries in
storageConfigs reshuffled log.dirs to match. In KRaft mode an unset
metadata.log.dir defaults to log.dirs[0], so this could silently move
the metadata log to a different disk whenever storageConfigs was
reordered (e.g. while removing/re-adding a disk), with no change
intended to the actual broker storage layout.
Now the effective list is built by walking mountPathsOld first,
keeping each existing path in its original position (including paths
kept temporarily during a pending disk removal/rebalance), and only
appending genuinely new paths from mountPathsNew at the end, in their
declared relative order.
Example: old log.dirs = [a, b, c]; storageConfigs reordered to
declare [c, a, b] -> before: log.dirs became [c, a, b]; after:
log.dirs stays [a, b, c].
Example: disk 'b' removal confirmed, then re-added before 'a' in
storageConfigs (old=[b], new=[a, b]) -> before: log.dirs became
[a, b]; after: log.dirs becomes [b, a] (b keeps its slot, a is
appended as new).
Adds 5 table-driven test cases to TestGetEffectiveLogDirsMountPaths
covering reordering, new-path append order, pending-removal position
retention under reordering, confirmed-removal-then-readd append, and
a mixed scenario.1 parent 5c26bea commit 95138e0
2 files changed
Lines changed: 80 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
302 | 310 | | |
303 | | - | |
304 | 311 | | |
305 | | - | |
| 312 | + | |
306 | 313 | | |
307 | 314 | | |
308 | 315 | | |
309 | 316 | | |
310 | 317 | | |
311 | 318 | | |
312 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
313 | 329 | | |
314 | | - | |
| 330 | + | |
| 331 | + | |
315 | 332 | | |
316 | 333 | | |
317 | 334 | | |
| |||
320 | 337 | | |
321 | 338 | | |
322 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
323 | 348 | | |
324 | 349 | | |
325 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
219 | 271 | | |
220 | 272 | | |
221 | 273 | | |
| |||
0 commit comments