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

opt: fix index alteration recommendation for multiple invisible indexes #108576

Merged
merged 1 commit into from Aug 11, 2023

Conversation

rytaft
Copy link
Collaborator

@rytaft rytaft commented Aug 11, 2023

Fixes #108490

Release note (bug fix): Fixed a bug in the index recommendations provided in the EXPLAIN output where ALTER INDEX ... VISIBLE index recommendations may suggest making the wrong index visible when there are multiple invisible indexes in a table.

Fixes cockroachdb#108490

Release note (bug fix): Fixed a bug in the index recommendations provided in
the EXPLAIN output where ALTER INDEX ... VISIBLE index recommendations may
suggest making the wrong index visible when there are multiple invisible
indexes in a table.
@rytaft rytaft added backport-22.2.x Flags PRs that need to be backported to 22.2. backport-23.1.x Flags PRs that need to be backported to 23.1 labels Aug 11, 2023
@rytaft rytaft requested a review from a team as a code owner August 11, 2023 02:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Nice fix!

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @msirek)

@rytaft
Copy link
Collaborator Author

rytaft commented Aug 11, 2023

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 11, 2023

Build succeeded:

@craig craig bot merged commit 243515d into cockroachdb:master Aug 11, 2023
6 of 7 checks passed
@blathers-crl
Copy link

blathers-crl bot commented Aug 11, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 507e594 to blathers/backport-release-22.2-108576: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.2.x failed. See errors above.


error creating merge commit from 507e594 to blathers/backport-release-23.1-108576: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

mgartner added a commit to mgartner/cockroach that referenced this pull request Sep 6, 2023
A bug was introduced in cockroachdb#108576 in code that compares index columns of
an existing index and a hypothetical index. Prior to this commit, this
logic only checked that the hypothetical index column was an inverted
column (the last explicitly indexed column in an inverted index) before
fetching the inverted source column ordinal for both the hypothetical
and existing index column. When the existing index column was not an
inverted column, and internal error would occur.

This commit fixes the bug by checking that both the hypothetical and
existing index columns are inverted columns before fetching the source
column ordinals.

There is no release note because this bug does not exist in any
releases.

Fixes cockroachdb#109974

Release note: None
craig bot pushed a commit that referenced this pull request Sep 6, 2023
110116: indexrec: fix internal error with inverted indexes r=mgartner a=mgartner

A bug was introduced in #108576 in code that compares index columns of
an existing index and a hypothetical index. Prior to this commit, this
logic only checked that the hypothetical index column was an inverted
column (the last explicitly indexed column in an inverted index) before
fetching the inverted source column ordinal for both the hypothetical
and existing index column. When the existing index column was not an
inverted column, and internal error would occur.

This commit fixes the bug by checking that both the hypothetical and
existing index columns are inverted columns before fetching the source
column ordinals.

There is no release note because this bug does not exist in any
releases.

Fixes #109974

Release note: None


Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
blathers-crl bot pushed a commit that referenced this pull request Sep 6, 2023
A bug was introduced in #108576 in code that compares index columns of
an existing index and a hypothetical index. Prior to this commit, this
logic only checked that the hypothetical index column was an inverted
column (the last explicitly indexed column in an inverted index) before
fetching the inverted source column ordinal for both the hypothetical
and existing index column. When the existing index column was not an
inverted column, and internal error would occur.

This commit fixes the bug by checking that both the hypothetical and
existing index columns are inverted columns before fetching the source
column ordinals.

There is no release note because this bug does not exist in any
releases.

Fixes #109974

Release note: None
blathers-crl bot pushed a commit that referenced this pull request Sep 6, 2023
A bug was introduced in #108576 in code that compares index columns of
an existing index and a hypothetical index. Prior to this commit, this
logic only checked that the hypothetical index column was an inverted
column (the last explicitly indexed column in an inverted index) before
fetching the inverted source column ordinal for both the hypothetical
and existing index column. When the existing index column was not an
inverted column, and internal error would occur.

This commit fixes the bug by checking that both the hypothetical and
existing index columns are inverted columns before fetching the source
column ordinals.

There is no release note because this bug does not exist in any
releases.

Fixes #109974

Release note: None
mgartner added a commit to mgartner/cockroach that referenced this pull request Sep 6, 2023
A bug was introduced in cockroachdb#108576 in code that compares index columns of
an existing index and a hypothetical index. Prior to this commit, this
logic only checked that the hypothetical index column was an inverted
column (the last explicitly indexed column in an inverted index) before
fetching the inverted source column ordinal for both the hypothetical
and existing index column. When the existing index column was not an
inverted column, and internal error would occur.

This commit fixes the bug by checking that both the hypothetical and
existing index columns are inverted columns before fetching the source
column ordinals.

There is no release note because this bug does not exist in any
releases.

Fixes cockroachdb#109974

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-22.2.x Flags PRs that need to be backported to 22.2. backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opt: wrong index alteration recommendation when multiple invisible indexes exist
3 participants