Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config, opt: teach localityMatchScore about voter_constraints #59482

Open
aayushshah15 opened this issue Jan 27, 2021 · 2 comments
Open

config, opt: teach localityMatchScore about voter_constraints #59482

aayushshah15 opened this issue Jan 27, 2021 · 2 comments
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) docs-done docs-known-limitation T-multiregion

Comments

@aayushshah15
Copy link
Contributor

aayushshah15 commented Jan 27, 2021

localityMatchScore() aids in computing the scan cost of a single row, from a given index idx, based on how well the locality tiers of the gateway match the zone config constraints on idx. This allows the cost model to prioritize choosing indexes that are geographically closer over the ones that are further away from the gateway node.

With the introduction of the new voter_constraints attribute, voting replicas are constrained by the existing constraints (which apply to all replicas - voting and non-voting) as well as voter_constraints (which apply only to voting replicas). Thus, localityMatchScore() needs to be updated to include this new attribute when computing its result.

Jira issue: CRDB-3285

@aayushshah15 aayushshah15 added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Jan 27, 2021
@aayushshah15 aayushshah15 self-assigned this Jan 27, 2021
@aayushshah15 aayushshah15 changed the title config, opt: teach optimizer to compute localityMatchScore for voter_constraints config, opt: teach localityMatchScore about voter_constraints Jan 27, 2021
@rytaft
Copy link
Collaborator

rytaft commented Mar 24, 2021

cc @rmloveland I've added docs-known-limitation, since until this issue is addressed, the duplicate indexes pattern won't work with "voter constraints" in zone configs. The suggested workaround is to use GLOBAL tables instead of duplicate indexes if users want fast reads and non-voting replicas.

(Existing schemas with the duplicated indexes pattern should work fine -- what won't work is if users try to update the zone configs to use the new "voter constraints" instead of "constraints")

@rmloveland
Copy link
Collaborator

Thanks Becca! Filed cockroachdb/docs#10173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) docs-done docs-known-limitation T-multiregion
Projects
None yet
Development

No branches or pull requests

5 participants