-
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
catalog: add SystemDatabaseSchemaVersion field to DatabaseDescriptor #111404
Conversation
b8c65da
to
6d9c521
Compare
1525bcb
to
773258c
Compare
6928098
to
15875bb
Compare
21028de
to
235f465
Compare
235f465
to
9469b52
Compare
bc3b422
to
b0efa2a
Compare
b0efa2a
to
d793e67
Compare
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.
Just some minor things. Great work, Andy!
Reviewed 5 of 10 files at r1, 12 of 12 files at r3, 7 of 7 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890, @knz, and @rafiss)
pkg/sql/catalog/systemschema/system.go
line 1059 at r3 (raw file):
// that should be used during bootstrap. It should be bumped up alongside any // upgrade that creates or modifies the schema of a system table. var SystemDatabaseSchemaBootstrapVersion = clusterversion.ByKey(clusterversion.V23_2_RegionaLivenessTable)
Should we add something to the bootstrap test so that we make sure people bump this up?
pkg/upgrade/upgrades/schema_changes.go
line 428 at r4 (raw file):
} if sv := systemDBDesc.GetSystemDatabaseSchemaVersion(); sv != nil { if cs.Version.Less(*sv) {
I think the validation layer will also catch it right before we write. So this might be redundant?
This patch adds a new `SystemDatabaseSchemaVersion` field to `descpb.DatabaseDescriptor` that will be used to store the schema version of the system database. Release note: None
This patch adds a helper function that should be used by upgrades that create or modify the schema of system tables to bump the schema version field on the `system` database descriptor. Release note: None
d793e67
to
367d4cc
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @fqazi, @knz, and @rafiss)
pkg/sql/catalog/systemschema/system.go
line 1059 at r3 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Should we add something to the bootstrap test so that we make sure people bump this up?
Added a new test to check this!
pkg/upgrade/upgrades/schema_changes.go
line 428 at r4 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
I think the validation layer will also catch it right before we write. So this might be redundant?
We discussed this offline already but just noting it here for posterity, the check in ValidateSelf
is checking that we're setting it to a valid version relative to BinaryMinSupportedVersion
and BinaryVersion
while this check is making sure we can't decrease the version.
We also discussed moving that check to ValidateSelf
but since that operates only on an *dbdesc.immutable
(not an *dbdesc.Mutable
which has access to the previous descriptor), we decided that was too complex and unnecessary for now.
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.
Reviewed 9 of 9 files at r5, 7 of 7 files at r6, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @andyyang890, @knz, and @rafiss)
pkg/sql/catalog/systemschema/system.go
line 1059 at r3 (raw file):
Previously, andyyang890 (Andy Yang) wrote…
Added a new test to check this!
Great work 😊
TFTRs! bors r=dt,fqazi |
Build succeeded: |
catalog: add SystemDatabaseSchemaVersion field to DatabaseDescriptor
This patch adds a new
SystemDatabaseSchemaVersion
field todescpb.DatabaseDescriptor
that will be used to store the schemaversion of the system database.
Release note: None
upgrades: add helper function to bump SystemDatabaseSchemaVersion
This patch adds a helper function that should be used by upgrades that
create or modify the schema of system tables to bump the schema version
field on the
system
database descriptor.Release note: None
Fixes #109039