-
Notifications
You must be signed in to change notification settings - Fork 4k
release-24.3: sql/opt_catalog: Use index offset as tombstone index ordinal #156133
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
base: release-24.3
Are you sure you want to change the base?
Conversation
Previously, when the optimizer stored the ordinal of an index to use for writing tombstones in non-SERIALIZABLE transactions, it would call the Ordinal() method, which returns the value from the table's descriptor. We would later use this value as an input to the Index() method to retrieve the index in question. However, Ordinal() can differ from the catalog's view of the schema during schema change, resulting in sometimes getting the wrong index ordinal from the optimizer's point of view, sometimes resulting in an out of bounds error. This patch switches the ordinal we save to be the actual index used when creating the optTable, which feels janky, but is at least correct. Fixes: #151477 Release note (bug fix): A bug which could occasionally cause DML on regional by row tables with unique indexes that don't reference the region to fail under READ-COMMITTED isolation has been corrected.
4d4cdbb to
cdd312b
Compare
|
Thanks for opening a backport. Before merging, please confirm that it falls into one of the following categories (select one):
Add a brief release justification to the PR description explaining your selection. Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy. All backports must be reviewed by the TL and EM for the owning area. |
|
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
|
❌ PR #156133 does not comply with backport policy Confidence: medium As per the PR, the bug fix corrects a condition that could cause failures under specific circumstances ('occasionally cause DML... to fail under READ-COMMITTED isolation') impacting transaction performance and correctness. Although this might lead to incorrect results or suboptimal performance, a more explicit alignment with critical bug criteria or a description of the impact's severity would strengthen the justification. The changes do not seem to include a new feature flag for gating, and the backport does not directly mention its necessity due to critical nature or feature mitigation strategies. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Backport 1/1 commits from #156105 on behalf of @mw5h.
Previously, when the optimizer stored the ordinal of an index to use for writing tombstones in non-SERIALIZABLE transactions, it would call the Ordinal() method, which returns the value from the table's descriptor. We would later use this value as an input to the Index() method to retrieve the index in question. However, Ordinal() can differ from the catalog's view of the schema during schema change, resulting in sometimes getting the wrong index ordinal from the optimizer's point of view, sometimes resulting in an out of bounds error.
This patch switches the ordinal we save to be the actual index used when creating the optTable, which feels janky, but is at least correct.
Fixes: #151477
Release note (bug fix): A bug which could occasionally cause DML on regional by row tables with unique indexes that don't reference the region to fail under READ-COMMITTED isolation has been corrected.
Release justification: Simple fix for problem found in testing.