Skip to content

sql: some schema changes use incorrect mutable descriptor #79704

@ajwerner

Description

@ajwerner

Describe the problem

The Mutable form 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 a Builder to 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:

func (p *planner) forEachMutableTableInDatabase(

Additional context

This is loosely related to #64673.

Jira issue: CRDB-14986

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCode 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)branch-masterFailures and bugs on the master branch.branch-release-22.1Used to mark GA and release blockers, technical advisories, and bugs for 22.1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions