-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
59760: migration,jobs: refactor long-running migrations and hook up job r=ajwerner a=ajwerner This PR comes in three commits. The first commit reworks the package structure of long-running migrations a bit. The second introduces a migration job. The third introduces a `system.migrations` table to store completion state for migrations. The idea is that running long-running migrations in a job is handy because it provides leasing, observability, and control to users. Fixes #58183. Co-authored-by: Andrew Werner <[email protected]>
- Loading branch information
Showing
78 changed files
with
4,047 additions
and
2,180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
doctor cluster | ||
---- | ||
debug doctor cluster | ||
Examining 34 descriptors and 35 namespace entries... | ||
Examining 35 descriptors and 36 namespace entries... | ||
Table 53: ParentID 50, ParentSchemaID 29, Name 'foo': not being dropped but no namespace entry found | ||
Examining 1 running jobs... | ||
ERROR: validation failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/1/ranges/1.json | ||
writing: debug/nodes/1/ranges/2.json | ||
writing: debug/nodes/1/ranges/3.json | ||
|
@@ -94,6 +94,7 @@ writing: debug/nodes/1/ranges/32.json | |
writing: debug/nodes/1/ranges/33.json | ||
writing: debug/nodes/1/ranges/34.json | ||
writing: debug/nodes/1/ranges/35.json | ||
writing: debug/nodes/1/ranges/36.json | ||
writing: debug/nodes/2/status.json | ||
using SQL connection URL for node 2: postgresql://... | ||
retrieving SQL data for crdb_internal.feature_usage... writing: debug/nodes/2/crdb_internal.feature_usage.txt | ||
|
@@ -194,7 +195,7 @@ requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/3/ranges/1.json | ||
writing: debug/nodes/3/ranges/2.json | ||
writing: debug/nodes/3/ranges/3.json | ||
|
@@ -230,6 +231,7 @@ writing: debug/nodes/3/ranges/32.json | |
writing: debug/nodes/3/ranges/33.json | ||
writing: debug/nodes/3/ranges/34.json | ||
writing: debug/nodes/3/ranges/35.json | ||
writing: debug/nodes/3/ranges/36.json | ||
doctor examining cluster...No problems found! | ||
writing: debug/reports/doctor.txt | ||
requesting list of SQL databases... 3 found | ||
|
@@ -238,7 +240,7 @@ requesting database details for defaultdb... writing: debug/schema/defaultdb@det | |
requesting database details for postgres... writing: debug/schema/[email protected] | ||
0 tables found | ||
requesting database details for system... writing: debug/schema/[email protected] | ||
29 tables found | ||
30 tables found | ||
requesting table details for system.public.namespace... writing: debug/schema/system/public_namespace.json | ||
requesting table details for system.public.descriptor... writing: debug/schema/system/public_descriptor.json | ||
requesting table details for system.public.users... writing: debug/schema/system/public_users.json | ||
|
@@ -268,5 +270,6 @@ requesting table details for system.public.statement_diagnostics_requests... wri | |
requesting table details for system.public.statement_diagnostics... writing: debug/schema/system/public_statement_diagnostics.json | ||
requesting table details for system.public.scheduled_jobs... writing: debug/schema/system/public_scheduled_jobs.json | ||
requesting table details for system.public.sqlliveness... writing: debug/schema/system/public_sqlliveness.json | ||
requesting table details for system.public.migrations... writing: debug/schema/system/public_migrations.json | ||
writing: debug/pprof-summary.sh | ||
writing: debug/hot-ranges.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/1/ranges/1.json | ||
writing: debug/nodes/1/ranges/2.json | ||
writing: debug/nodes/1/ranges/3.json | ||
|
@@ -94,6 +94,7 @@ writing: debug/nodes/1/ranges/32.json | |
writing: debug/nodes/1/ranges/33.json | ||
writing: debug/nodes/1/ranges/34.json | ||
writing: debug/nodes/1/ranges/35.json | ||
writing: debug/nodes/1/ranges/36.json | ||
writing: debug/nodes/2.skipped | ||
writing: debug/nodes/3/status.json | ||
using SQL connection URL for node 3: postgresql://... | ||
|
@@ -125,7 +126,7 @@ requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/3/ranges/1.json | ||
writing: debug/nodes/3/ranges/2.json | ||
writing: debug/nodes/3/ranges/3.json | ||
|
@@ -161,6 +162,7 @@ writing: debug/nodes/3/ranges/32.json | |
writing: debug/nodes/3/ranges/33.json | ||
writing: debug/nodes/3/ranges/34.json | ||
writing: debug/nodes/3/ranges/35.json | ||
writing: debug/nodes/3/ranges/36.json | ||
doctor examining cluster...No problems found! | ||
writing: debug/reports/doctor.txt | ||
requesting list of SQL databases... 3 found | ||
|
@@ -169,7 +171,7 @@ requesting database details for defaultdb... writing: debug/schema/defaultdb@det | |
requesting database details for postgres... writing: debug/schema/[email protected] | ||
0 tables found | ||
requesting database details for system... writing: debug/schema/[email protected] | ||
29 tables found | ||
30 tables found | ||
requesting table details for system.public.namespace... writing: debug/schema/system/public_namespace.json | ||
requesting table details for system.public.descriptor... writing: debug/schema/system/public_descriptor.json | ||
requesting table details for system.public.users... writing: debug/schema/system/public_users.json | ||
|
@@ -199,5 +201,6 @@ requesting table details for system.public.statement_diagnostics_requests... wri | |
requesting table details for system.public.statement_diagnostics... writing: debug/schema/system/public_statement_diagnostics.json | ||
requesting table details for system.public.scheduled_jobs... writing: debug/schema/system/public_scheduled_jobs.json | ||
requesting table details for system.public.sqlliveness... writing: debug/schema/system/public_sqlliveness.json | ||
requesting table details for system.public.migrations... writing: debug/schema/system/public_migrations.json | ||
writing: debug/pprof-summary.sh | ||
writing: debug/hot-ranges.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/1/ranges/1.json | ||
writing: debug/nodes/1/ranges/2.json | ||
writing: debug/nodes/1/ranges/3.json | ||
|
@@ -94,6 +94,7 @@ writing: debug/nodes/1/ranges/32.json | |
writing: debug/nodes/1/ranges/33.json | ||
writing: debug/nodes/1/ranges/34.json | ||
writing: debug/nodes/1/ranges/35.json | ||
writing: debug/nodes/1/ranges/36.json | ||
writing: debug/nodes/3/status.json | ||
using SQL connection URL for node 3: postgresql://... | ||
retrieving SQL data for crdb_internal.feature_usage... writing: debug/nodes/3/crdb_internal.feature_usage.txt | ||
|
@@ -124,7 +125,7 @@ requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.t | |
^- resulted in ... | ||
requesting log file ... | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/3/ranges/1.json | ||
writing: debug/nodes/3/ranges/2.json | ||
writing: debug/nodes/3/ranges/3.json | ||
|
@@ -160,6 +161,7 @@ writing: debug/nodes/3/ranges/32.json | |
writing: debug/nodes/3/ranges/33.json | ||
writing: debug/nodes/3/ranges/34.json | ||
writing: debug/nodes/3/ranges/35.json | ||
writing: debug/nodes/3/ranges/36.json | ||
doctor examining cluster...No problems found! | ||
writing: debug/reports/doctor.txt | ||
requesting list of SQL databases... 3 found | ||
|
@@ -168,7 +170,7 @@ requesting database details for defaultdb... writing: debug/schema/defaultdb@det | |
requesting database details for postgres... writing: debug/schema/[email protected] | ||
0 tables found | ||
requesting database details for system... writing: debug/schema/[email protected] | ||
29 tables found | ||
30 tables found | ||
requesting table details for system.public.namespace... writing: debug/schema/system/public_namespace.json | ||
requesting table details for system.public.descriptor... writing: debug/schema/system/public_descriptor.json | ||
requesting table details for system.public.users... writing: debug/schema/system/public_users.json | ||
|
@@ -198,5 +200,6 @@ requesting table details for system.public.statement_diagnostics_requests... wri | |
requesting table details for system.public.statement_diagnostics... writing: debug/schema/system/public_statement_diagnostics.json | ||
requesting table details for system.public.scheduled_jobs... writing: debug/schema/system/public_scheduled_jobs.json | ||
requesting table details for system.public.sqlliveness... writing: debug/schema/system/public_sqlliveness.json | ||
requesting table details for system.public.migrations... writing: debug/schema/system/public_migrations.json | ||
writing: debug/pprof-summary.sh | ||
writing: debug/hot-ranges.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ requesting table details for defaultdb.public."../system"... writing: debug/sche | |
requesting database details for postgres... writing: debug/schema/[email protected] | ||
0 tables found | ||
requesting database details for system... writing: debug/schema/[email protected] | ||
29 tables found | ||
30 tables found | ||
requesting table details for system.public.namespace... writing: debug/schema/system-1/public_namespace.json | ||
requesting table details for system.public.descriptor... writing: debug/schema/system-1/public_descriptor.json | ||
requesting table details for system.public.users... writing: debug/schema/system-1/public_users.json | ||
|
@@ -52,3 +52,4 @@ requesting table details for system.public.statement_diagnostics_requests... wri | |
requesting table details for system.public.statement_diagnostics... writing: debug/schema/system-1/public_statement_diagnostics.json | ||
requesting table details for system.public.scheduled_jobs... writing: debug/schema/system-1/public_scheduled_jobs.json | ||
requesting table details for system.public.sqlliveness... writing: debug/schema/system-1/public_sqlliveness.json | ||
requesting table details for system.public.migrations... writing: debug/schema/system-1/public_migrations.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ requesting heap profile for node 1... writing: debug/nodes/1/heap.pprof | |
requesting heap files for node 1... ? found | ||
requesting goroutine files for node 1... 0 found | ||
requesting log file ... | ||
requesting ranges... 35 found | ||
requesting ranges... 36 found | ||
writing: debug/nodes/1/ranges/1.json | ||
writing: debug/nodes/1/ranges/2.json | ||
writing: debug/nodes/1/ranges/3.json | ||
|
@@ -93,6 +93,7 @@ writing: debug/nodes/1/ranges/32.json | |
writing: debug/nodes/1/ranges/33.json | ||
writing: debug/nodes/1/ranges/34.json | ||
writing: debug/nodes/1/ranges/35.json | ||
writing: debug/nodes/1/ranges/36.json | ||
doctor examining cluster...No problems found! | ||
writing: debug/reports/doctor.txt | ||
requesting list of SQL databases... 3 found | ||
|
@@ -101,7 +102,7 @@ requesting database details for defaultdb... writing: debug/schema/defaultdb@det | |
requesting database details for postgres... writing: debug/schema/[email protected] | ||
0 tables found | ||
requesting database details for system... writing: debug/schema/[email protected] | ||
29 tables found | ||
30 tables found | ||
requesting table details for system.public.namespace... writing: debug/schema/system/public_namespace.json | ||
requesting table details for system.public.descriptor... writing: debug/schema/system/public_descriptor.json | ||
requesting table details for system.public.users... writing: debug/schema/system/public_users.json | ||
|
@@ -131,5 +132,6 @@ requesting table details for system.public.statement_diagnostics_requests... wri | |
requesting table details for system.public.statement_diagnostics... writing: debug/schema/system/public_statement_diagnostics.json | ||
requesting table details for system.public.scheduled_jobs... writing: debug/schema/system/public_scheduled_jobs.json | ||
requesting table details for system.public.sqlliveness... writing: debug/schema/system/public_sqlliveness.json | ||
requesting table details for system.public.migrations... writing: debug/schema/system/public_migrations.json | ||
writing: debug/pprof-summary.sh | ||
writing: debug/hot-ranges.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.