forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add closest-instance physical planning
This changes physical planning, specifically how the SQL instance for a given KV node ID is resolved, to be more generalized w.r.t. different locality tier taxonomies. Previously this function had a special case that checked for, and only for, a specific locality tier with the key "region" and if it was found, picked a random instance from the subset of instances where their value for that matched the value for the KV node. Matching on and only on the "region" tier is both too specific and not specific enough: it is "too specific" in that it requires a tier with the key "region" to be used and to match, and is "not specific enough" in that it simultaneously ignores more specific locality tiers that would indicate closer matches (e.g. subregion, AZ, data-center or rack). Instead, this change generalizes this function to identify the subset of instances that have the "closest match" in localities to the KV node and pick one of them, where closest match is defined as the longest matching prefix of locality tiers. In a simple, single-tier locality taxonomy using the key "region" this should yield the same behavior as the previous implementation, as all instances with a matching "region" will have the same longest matching prefix (at length 1), however this more general approach should better handle other locality taxonomies that use more tiers and/or tiers with names other than "region". Currently this change only applies to physical planning for secondary tenants until physical planning is unified for system and secondary tenants. Release note: none. Epic: none.
- Loading branch information
Showing
3 changed files
with
99 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters