-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stats: use available type metadata when hydrating UDTs
This commit updates the table stats cache to use the correct metadata when hydrating the UDTs for the table stats read from disk. Previously, we would always use the `DescsTxn` helper to run a separate txn to create the type resolved, which I think meant that we would use latest _committed_ metadata; however, if the UDT modification happened within the current not-yet-committed txn, then we would use stale metadata which could lead to failing an assertion later (that we used enums of different versions). In particular, this would happen if we added a new value to the UDT and then would use the previously-existing value in a filter. Note that we correctly determined that the stats cache entry was stale, we simply used stale type metadata to hydrate the UDTs. To fix the problem this commit plumbs the type resolver all the way from the caller who is requesting the table stats. The previous behavior is acceptable in some cases (in backups), so the type resolver is optional. Release note (bug fix): Previously, CockroachDB could encounter an internal error `comparison of two different versions of enum` in some cases when a user-defined type was modified within a transaction and following statements read the column of that user-defined type. The bug was introduced in 24.2 version and is now fixed.
- Loading branch information
1 parent
d58f071
commit 032e1be
Showing
10 changed files
with
96 additions
and
51 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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 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 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 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