Skip to content
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

sql/catalog/descs: enforce invariant that OriginalVersion does not ch… #79580

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/sql/catalog/descs/uncommitted_descriptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ func (ud *uncommittedDescriptors) add(
for _, n := range uNew.immutable.GetDrainingNames() {
ud.descNames.Add(n)
}
if prev, ok := ud.descs.GetByID(mut.GetID()).(*uncommittedDescriptor); ok {
if prev.mutable.OriginalVersion() != mut.OriginalVersion() {
return nil, errors.AssertionFailedf(
"cannot add a version of descriptor with a different original version" +
" than it was previously added with")
}
}
ud.descs.Upsert(uNew)
return uNew.immutable, err
}
Expand Down