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

release-19.1: opt: Fix and improve zone-based index selection #36737

Merged

Conversation

andy-kimball
Copy link
Contributor

Backport 1/1 commits from #36689.

/cc @cockroachdb/release


This PR fixes a couple of related issues with zone-based index selection.

First, placeholder zones were incorrectly discarded. Placeholder zones are
used when there are indexes with Constraints/Leaseholder Preferences on a
table that doesn't have either of those things. The fix is to merge the
indexes placeholder into the table zone.

Second, the optimizer required that a prefix of the locality tiers match
constraints. That is no longer required after this commit. For example, if
locality=region=us;dc=east, then it now matches any of these constraint
sets equally well:

[+locality=region=us;+dc=east]
[+dc=east]
[+dc=east,+dc=west]

A missing constraint match is OK (i.e. region=us), as long as a more specific
locality tier matches (i.e. dc=east).

Fixes #36642
Fixes #36644

Release note: None

This PR fixes a couple of related issues with zone-based index selection.

First, placeholder zones were incorrectly discarded. Placeholder zones are
used when there are indexes with Constraints/Leaseholder Preferences on a
table that doesn't have either of those things. The fix is to merge the
indexes placeholder into the table zone.

Second, the optimizer required that a prefix of the locality tiers match
constraints. That is no longer required after this commit. For example, if
locality=region=us;dc=east, then it now matches any of these constraint
sets equally well:

  [+locality=region=us;+dc=east]
  [+dc=east]
  [+dc=east,+dc=west]

A missing constraint match is OK (i.e. region=us), as long as a more specific
locality tier matches (i.e. dc=east).

Fixes cockroachdb#36642
Fixes cockroachdb#36644

Release note: None
@andy-kimball andy-kimball requested review from RaduBerinde and a team April 10, 2019 22:45
@andy-kimball andy-kimball requested a review from a team as a code owner April 10, 2019 22:45
@andy-kimball andy-kimball requested a review from a team April 10, 2019 22:45
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@andy-kimball andy-kimball merged commit f845fa0 into cockroachdb:release-19.1 Apr 10, 2019
@andy-kimball andy-kimball deleted the backport19.1-36689 branch April 10, 2019 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants