@@ -694,24 +694,24 @@ type analyzedConstraints struct {
694694 // satisfiedByReplica[kind][i] contains the set of storeIDs that satisfy
695695 // constraints[i]. These are for stores that satisfy at least one
696696 // constraint. Each store should appear exactly once in the 2D slice
697- // ac.satisfiedByReplica[kind]. Populated by initialize and used by mmma to
698- // compute lease-transfer and rebalancing candidates by functions like
699- // candidatesToReplaceVoterForRebalance. For example,
697+ // ac.satisfiedByReplica[kind]. For example,
700698 // satisfiedByReplica[voterIndex][0] = [1, 2, 3], means that the first
701699 // constraint (constraints[0]) is satisfied by storeIDs 1, 2, and 3.
702700 //
703- // NB: this does not mean the current replica set satisfies constraints[i]
704- // since we may populate satisfiedByReplica[nonVoterIndex][i] for voter
705- // constraints as well. This just means that the store can satisfy
706- // constraints[i] regardless of the replica type.
701+ // NB: satisfiedByReplica[nonVoterIndex][i] is populated even if this
702+ // analyzedConstraints represents a voter constraint. This is done because
703+ // satisfiedByReplica[voterIndex][i] may not sufficiently satisfy a
704+ // constraint (or even if it does, at a later point one could be
705+ // decommissioning one of the voters), and populating the nonVoterIndex
706+ // allows MMA to decide to promote a non-voter. replica type.
707707 satisfiedByReplica [numReplicaKinds ][][]roachpb.StoreID
708708
709709 // ac.satisfiedNoConstraintReplica[kind] contains the set of storeIDs that
710- // satisfy no constraint. Populated by initialize and used later by mma.
711- // Even though we are strict about constraint satisfaction, this can happen
712- // if the SpanConfig changed or the attributes of a store changed. Note that
713- // if these analyzedConstraints correspond to voterConstraints, there can be
714- // non-voters here (which is never be used but is harmless) .
710+ // satisfy no constraint. Even though we are strict about constraint
711+ // satisfaction, this can happen if the SpanConfig changed or the attributes
712+ // of a store changed. Note that if these analyzedConstraints correspond to
713+ // voterConstraints, there can be non-voters here which is never used but
714+ // harmless.
715715 satisfiedNoConstraintReplica [numReplicaKinds ][]roachpb.StoreID
716716}
717717
@@ -746,10 +746,12 @@ func clear2DSlice[T any](v [][]T) [][]T {
746746 return v
747747}
748748
749- // rangeAnalyzedConstraints is a function of the spanConfig and the current
750- // stores that have replicas for that range (including the ReplicaType). It
751- // contains information necessary for mma to compute lease-transfer and
752- // rebalancing candidates.
749+ // rangeAnalyzedConstraints represents the analyzed constraint state for a
750+ // range, derived from the range's span config and current replica placement
751+ // (including ReplicaType). It contains information used to handle constraint
752+ // satisfaction as part of allocation decisions (e.g. helping identify candidate
753+ // stores for range rebalancing, lease transfers, up-replication,
754+ // down-replication, validating whether constraints are satisfied).
753755//
754756// LEARNER and VOTER_DEMOTING_LEARNER replicas are ignored.
755757type rangeAnalyzedConstraints struct {
0 commit comments