Skip to content

Commit 2a4de7e

Browse files
committed
mmaprototype: explain why localities don't care about the keys
It's because operators must use matching keys across the cluster, so only the values can be different. For example, it's not allowed to have one node with `region=foo` and another with `fruit=banana`. It must be `region=foo`,`region=banana` and that point the key no longer plays a role since it always matches. Epic: CRDB-55052
1 parent d00e9c3 commit 2a4de7e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/kv/kvserver/allocator/mmaprototype/constraint.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,14 @@ func (lti *localityTierInterner) unintern(lt localityTiers) roachpb.Locality {
19221922
return locality
19231923
}
19241924

1925+
// localityTiers encodes a locality value hierarchy, represented by codes
1926+
// from an associated stringInterner.
1927+
//
1928+
// Note that CockroachDB operators must use matching *keys*[1] across all nodes
1929+
// in each deployment, so we only need to deal with a slice of locality
1930+
// *values*.
1931+
//
1932+
// [1]: https://www.cockroachlabs.com/docs/stable/cockroach-start#locality
19251933
type localityTiers struct {
19261934
tiers []stringCode
19271935
// str is useful as a map key for caching computations.

0 commit comments

Comments
 (0)