Commit f30a668
Merge #154688
154688: mmaprototype: pass []roachpb.StoreID for computeMeansForStoreSet r=tbg a=wenyihu6
Epic: CRDB-55052
Release note: none
---
**mmaprototype: pass []roachpb.StoreID for computeMeansForStoreSet**
Previously, computeMeansForStoreSet took in a meansForStoreSet struct. Future
PRs will use this helper function to compute mean load summaries for stores
without having a storeIDPostingList handy. To avoid unnecessary construction of
a storeIDPostingList, the function signature now takes meansLoad and
[]roachpb.StoreID directly. This change lets future callers pass a simple slice
of stores. Since future callers may provide slices with duplicate store IDs, the
function now also de-duplicates them internally.
---
**mmaprototype: refactor computeMeansForStoreSet**
Previously, we updated computeMeansForStoreSet to take meansLoad and
[]roachpb.StoreID directly instead of a meansForStoreSet struct. This commit
updates the call sites that only require meansLoad to use it directly, removing
unnecessary use of meansForStoreSet.
---
**mmaprototype: pass in scratch stores for computeMeansForStoreSet**
Previously, computeMeansForStoreSet allocated a new map on every call to
deduplicate the provided stores list. This commit refactors it to reuse a
scratchStores map (similar to scratchNodes). The caller now allocates this map
once and stores it in the function scope or struct, reducing repeated
allocations.
---
**mmaprototype: return meansLoad directly for computeMeansForStoreSet**
Previously, computeMeansForStoreSet received *meansForStoreSet, which contained
information like stores needed to compute the mean. A recent commit changed it
to take *meansLoad, and computeMeansForStoreSet doesn’t actually use any fields
as provided information. This commit updates computeMeansForStoreSet to directly
construct and return a meanLoad instead.
Co-authored-by: wenyihu6 <wenyi@cockroachlabs.com>File tree
3 files changed
+35
-18
lines changed- pkg/kv/kvserver/allocator/mmaprototype
3 files changed
+35
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
359 | 360 | | |
360 | 361 | | |
361 | 362 | | |
| |||
473 | 474 | | |
474 | 475 | | |
475 | 476 | | |
476 | | - | |
477 | 477 | | |
478 | | - | |
479 | | - | |
| 478 | + | |
480 | 479 | | |
481 | 480 | | |
482 | 481 | | |
| |||
948 | 947 | | |
949 | 948 | | |
950 | 949 | | |
951 | | - | |
| 950 | + | |
952 | 951 | | |
953 | 952 | | |
954 | 953 | | |
| |||
1390 | 1389 | | |
1391 | 1390 | | |
1392 | 1391 | | |
1393 | | - | |
| 1392 | + | |
1394 | 1393 | | |
1395 | 1394 | | |
1396 | 1395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1949 | 1949 | | |
1950 | 1950 | | |
1951 | 1951 | | |
1952 | | - | |
| 1952 | + | |
1953 | 1953 | | |
1954 | 1954 | | |
1955 | 1955 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
232 | 237 | | |
233 | 238 | | |
234 | | - | |
235 | | - | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
| |||
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
280 | | - | |
| 283 | + | |
| 284 | + | |
281 | 285 | | |
282 | 286 | | |
283 | 287 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
320 | | - | |
| 324 | + | |
| 325 | + | |
321 | 326 | | |
322 | 327 | | |
323 | 328 | | |
| |||
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
342 | | - | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
| |||
362 | 367 | | |
363 | 368 | | |
364 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
365 | 373 | | |
366 | 374 | | |
367 | 375 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
373 | 383 | | |
374 | 384 | | |
375 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
376 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
377 | 394 | | |
378 | 395 | | |
379 | 396 | | |
| |||
413 | 430 | | |
414 | 431 | | |
415 | 432 | | |
| 433 | + | |
416 | 434 | | |
417 | 435 | | |
418 | 436 | | |
| |||
0 commit comments