-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: some schema changes use incorrect mutable descriptor #79704
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-masterFailures and bugs on the master branch.Failures and bugs on the master branch.branch-release-22.1Used to mark GA and release blockers, technical advisories, and bugs for 22.1Used to mark GA and release blockers, technical advisories, and bugs for 22.1
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-masterFailures and bugs on the master branch.Failures and bugs on the master branch.branch-release-22.1Used to mark GA and release blockers, technical advisories, and bugs for 22.1Used to mark GA and release blockers, technical advisories, and bugs for 22.1
Describe the problem
The
Mutableform of descriptors track internally the "original" version of the descriptor. This is useful for various things, including the split calculation done in #77337. When the mutable form of the descriptor is always retrieved from the collection, the "original" version will be properly maintained. There are, for better or for worse, other ways to get your hands on a mutable descriptor. In particular, one can use aBuilderto get from an immutable to a mutable. Sadly, when you do that, you lose the history of the descriptor.One example of this bug was #79561.
Generally, detecting this bug turns out to be easy: #79580
Unfortunately, there are other cases where we'd hit this issue. One is here:
cockroach/pkg/sql/database.go
Line 101 in d61df4c
Additional context
This is loosely related to #64673.
Jira issue: CRDB-14986