-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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-22.1: opt: check UDTs by name when checking metadata dependencies #100358
Merged
DrewKimball
merged 2 commits into
cockroachdb:release-22.1
from
DrewKimball:backport22.1-96045
Apr 3, 2023
Merged
release-22.1: opt: check UDTs by name when checking metadata dependencies #100358
DrewKimball
merged 2 commits into
cockroachdb:release-22.1
from
DrewKimball:backport22.1-96045
Apr 3, 2023
Conversation
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 commit performs some refactoring for the way data source objects are tracked in `opt.Metadata` in order to make future changes to UDT and UDF dependency tracking easier. More particularly, UDTs and UDFs will be able to re-resolve any references by name. This is necessary in order to handle cases where changes to the search-path cause names in the query to resolve to different objects. Release note: None
Previously, it was possible for invalid queries to be kept in the cache after a schema change, since user-defined types were tracked only by OID. This missed cases where the search path changed which object a name in the query resolved to (or whether it resolved at all). This patch fixes this behavior by tracking UDT references by name, similar to what was already done for data sources. This ensures that the query staleness check doesn't miss changes to the search path. Fixes cockroachdb#96674 Release note (bug fix): Fixed a bug that could prevent a cached query with a user-defined type reference from being invalidated even after a schema change that should prevent the type from being resolved.
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
DrewKimball
changed the title
release-22.1: opt: check UDFs and UDTs by name when checking metadata dependencies
release-22.1: opt: check UDTs by name when checking metadata dependencies
Mar 31, 2023
mgartner
approved these changes
Apr 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TFYR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 2/4 commits from #96045.
/cc @cockroachdb/release
opt: refactor metadata dependency tracking
This commit performs some refactoring for the way data source objects
are tracked in
opt.Metadata
in order to make future changes to UDTand UDF dependency tracking easier. More particularly, UDTs and UDFs
will be able to re-resolve any references by name. This is necessary
in order to handle cases where changes to the search-path cause names
in the query to resolve to different objects.
opt: track UDT references by name in the Metadata
Previously, it was possible for invalid queries to be kept in the cache
after a schema change, since user-defined types were tracked only by OID.
This missed cases where the search path changed which object a name in
the query resolved to (or whether it resolved at all).
This patch fixes this behavior by tracking UDT references by name, similar
to what was already done for data sources. This ensures that the query
staleness check doesn't miss changes to the search path.
Fixes #96674
Release note (bug fix): Fixed a bug that could prevent a cached query from being invalidated when a UDT referenced by that query was altered or dropped, or when the schema or database of a UDT was altered or dropped.
Release Justification: low-risk bug fix for rare incorrect results for UDTs