-
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
sql: use leased database descriptors, implement db schema changes in job #52975
Conversation
22a2e7f
to
18d7987
Compare
a15e3ff
to
ad1554e
Compare
7470508
to
71f782c
Compare
Still need to add the mixed-version logic tests but this is ready for a look. |
06e6f61
to
e622663
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.
What's up with the tenant tests?
Reviewed 5 of 10 files at r1, 2 of 55 files at r3, 65 of 65 files at r4.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @lucy-zhang and @rohany)
pkg/sql/catalog/descs/collection.go, line 418 at r4 (raw file):
// func (tc *Collection) GetDatabaseVersion() { // // }
?
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.
What's up with the tenant tests?
I'm unskipping the 3node-tenant
configuration for these tests, which will close #52567. I need to write a commit message.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajwerner, @lucy-zhang, and @rohany)
pkg/sql/catalog/descs/collection.go, line 418 at r4 (raw file):
Previously, ajwerner wrote…
// func (tc *Collection) GetDatabaseVersion() { // // }
?
Oops.
e9da118
to
9415d79
Compare
bfe5202
to
c47a3ea
Compare
This commit introduces the use of leased database descriptors, and implements database schema changes in the schema change job. The main changes: * The descriptor collection now provides access to database descriptors, and name resolution uses leased database descriptors where appropriate. * The resolver API now allows resolving mutable database descriptors, which we now fetch and use consistently in schema changes. * The former incoherent database cache (`database.Cache`) has been replaced, and database caching no longer relies on gossip. However: * The deprecated database cache and `uncommittedDatabases` set are still in use in the 20.1 mixed-version state, and the use of leased descriptors is version-gated. The cache itself is no longer exposed to users of the descriptor collection, and when reading descriptors, the choice of caching mechanism should be mostly transparent to the caller. * The schema change job now handles database schema changes (rename, drop, grant/revoke), which involves draining names, waiting for old leases to drain, etc. Release note (sql change, bug fix): Renaming and dropping databases now satisfy the same transactional guarantees as online schema changes on tables: Changes will become visible if and only if the transaction commits, and a successful result indicates changes having propagated to the entire cluster. This fixes some long-standing problems with inconsistent database state being visible after renames and drops. (As a side effect of coherent caching for databases, database names can no longer be recycled in multiple schema changes in the same transaction.)
bors r+ |
Build succeeded: |
This commit introduces the use of leased database descriptors, and
implements database schema changes in the schema change job.
The main changes:
and name resolution uses leased database descriptors where
appropriate.
which we now fetch and use consistently in schema changes.
database.Cache
) has beenreplaced, and database caching no longer relies on gossip. However:
uncommittedDatabases
set arestill in use in the 20.1 mixed-version state, and the use of leased
descriptors is version-gated. The cache itself is no longer exposed to
users of the descriptor collection, and when reading descriptors, the
choice of caching mechanism should be mostly transparent to the
caller.
drop, grant/revoke), which involves draining names, waiting for old
leases to drain, etc.
Closes #41942.
Closes #52567.
Release note (sql change, bug fix): Renaming and dropping databases now
satisfy the same transactional guarantees as online schema changes on
tables: Changes will become visible if and only if the transaction
commits, and a successful result indicates changes having propagated to
the entire cluster. This fixes some long-standing problems with
inconsistent database state being visible after renames and drops. (As a
side effect of coherent caching for databases, database names can no
longer be recycled in multiple schema changes in the same transaction.)