Commit 7bc5dd9
committed
mmaprototype: add pre-means filtering for replica transfers
Previously, computeCandidatesForRange (now computeCandidatesForReplicaTransfer)
computed the mean over all constraint-satisfying stores, then applied
post-means exclusions before returning candidates. These exclusions were:
- Stores on nodes already housing replicas of the range
- The shedding store itself (handled via a separate check in the loop)
- If the shedding store's node was CPU overloaded, all other stores on
that node
The last bullet was ad-hoc and asymmetric: we wouldn't apply the same logic
to other overloaded nodes that happened to have replicas. It also wasn't
exercised, and the downstream candidate selection logic wouldn't choose these
stores anyway (they'd be rejected for being on an overloaded node).
This commit makes two changes:
1. Simplified post-means exclusions: The parameter is renamed from
storesToExclude to postMeansExclusions to clarify its role. All exclusions
are now handled uniformly in this set:
- The shedding store (we're moving away from it)
- Stores on nodes with other existing replicas
The ad-hoc "exclude other stores on shedding node if node is overloaded"
logic is removed. Within-node rebalance (to another store on the shedding
node) is now permitted at this stage.
2. Pre-means filtering: This is new. Before computing the mean, we now filter
out stores that aren't ready to receive replicas based on disposition.
As a legacy case, we manually filter on high disk utilization, but there
is a TODO to fold this into the disposition as well - this is tracked and
will be done separately.
This is done by retainReadyReplicaTargetStoresOnly. The shedding store
bypasses the disposition check since it already has the replica - its load
should be in the mean regardless of its disposition for NEW replicas.
When filtering occurs, we recompute the mean over the filtered set. The
common case (nothing filtered) still uses the cached mean for efficiency.
Other cleanup:
- Fixed logging (VEventf instead of mixing V() and Infof)
- Added scratch fields to clusterState for the new filtering but also left
a TODO to get out of scratch fields entirely.
Part of #156776.
Epic: CRDB-550521 parent 3ce534a commit 7bc5dd9
File tree
11 files changed
+572
-59
lines changed- pkg/kv/kvserver/allocator/mmaprototype
- testdata/cluster_state
11 files changed
+572
-59
lines changedLines changed: 104 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
818 | | - | |
| 818 | + | |
819 | 819 | | |
820 | 820 | | |
821 | | - | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
849 | | - | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
850 | 854 | | |
851 | | - | |
852 | | - | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
853 | 858 | | |
854 | 859 | | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
863 | 891 | | |
864 | | - | |
865 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
866 | 899 | | |
867 | | - | |
868 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
869 | 904 | | |
870 | 905 | | |
871 | | - | |
872 | | - | |
| 906 | + | |
873 | 907 | | |
874 | 908 | | |
875 | 909 | | |
876 | 910 | | |
877 | 911 | | |
878 | | - | |
| 912 | + | |
879 | 913 | | |
880 | 914 | | |
881 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
882 | 966 | | |
883 | 967 | | |
884 | 968 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1259 | 1259 | | |
1260 | 1260 | | |
1261 | 1261 | | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1262 | 1265 | | |
1263 | 1266 | | |
1264 | 1267 | | |
| |||
Lines changed: 35 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 371 | | |
387 | 372 | | |
388 | 373 | | |
| |||
428 | 413 | | |
429 | 414 | | |
430 | 415 | | |
| 416 | + | |
| 417 | + | |
431 | 418 | | |
432 | 419 | | |
433 | 420 | | |
| |||
441 | 428 | | |
442 | 429 | | |
443 | 430 | | |
444 | | - | |
445 | | - | |
446 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
447 | 440 | | |
448 | 441 | | |
| 442 | + | |
449 | 443 | | |
450 | | - | |
451 | | - | |
452 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
453 | 447 | | |
454 | 448 | | |
| 449 | + | |
455 | 450 | | |
456 | 451 | | |
457 | | - | |
| 452 | + | |
458 | 453 | | |
459 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
460 | 461 | | |
461 | | - | |
| 462 | + | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
469 | 468 | | |
470 | 469 | | |
471 | 470 | | |
| |||
667 | 666 | | |
668 | 667 | | |
669 | 668 | | |
670 | | - | |
671 | 669 | | |
| 670 | + | |
| 671 | + | |
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
422 | 427 | | |
423 | 428 | | |
424 | 429 | | |
| |||
630 | 635 | | |
631 | 636 | | |
632 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
633 | 651 | | |
634 | 652 | | |
635 | 653 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | 64 | | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments