Commit 55c8934d authored by craig[bot]'s avatar craig[bot]

Merge #49748 #49765

49748: ui: Cypress regression visual testing r=koorosh a=koorosh

Resolves #49589

Visual regression testing is accomplished by `cypress-image-snapshot`
plugin.
The main issue solved with this change is how modules are loaded
from custom `node_modules` location (./opt/node_modules).
- for .ts files `baseUrl` and `typeRoots` are pointing to
`./opt/node_modules` to resolve packages and typings.
- Webpack configuration is extended with additional module
resolver.
- Plugin modules (which aren't processed by Webpack) use
helper function which appends path to `opt/node_modules` to
required module name.

Add screenshot testing for main pages in Admin UI.
These tests are quite flaky and might fail because
nondeterministic state of the server during tests run.


Release note: None

49765: sqlbase: Add system.scheduled_jobs table r=miretskiy a=miretskiy

Informs #49346

Add system.scheduled_job table to system catalog.
Add sql migration code to create table when upgrading.

See https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/20200414_scheduled_jobs.md

Release Notes: None
Co-authored-by: default avatarAndrii Vorobiov <[email protected]>
Co-authored-by: default avatarYevgeniy Miretskiy <[email protected]>
......@@ -71,6 +71,6 @@
<tr><td><code>trace.debug.enable</code></td><td>boolean</td><td><code>false</code></td><td>if set, traces for recent requests can be seen in the /debug page</td></tr>
<tr><td><code>trace.lightstep.token</code></td><td>string</td><td><code></code></td><td>if set, traces go to Lightstep using this token</td></tr>
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'); ignored if trace.lightstep.token is set</td></tr>
<tr><td><code>version</code></td><td>custom validation</td><td><code>20.1-6</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
<tr><td><code>version</code></td><td>custom validation</td><td><code>20.1-7</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
</tbody>
</table>
......@@ -54,7 +54,7 @@ requesting heap files for node 1... writing: debug/nodes/1/heapprof.err.txt
requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/1/ranges/1.json
writing: debug/nodes/1/ranges/2.json
writing: debug/nodes/1/ranges/3.json
......@@ -87,6 +87,7 @@ writing: debug/nodes/1/ranges/29.json
writing: debug/nodes/1/ranges/30.json
writing: debug/nodes/1/ranges/31.json
writing: debug/nodes/1/ranges/32.json
writing: debug/nodes/1/ranges/33.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
......@@ -178,7 +179,7 @@ requesting heap files for node 3... writing: debug/nodes/3/heapprof.err.txt
requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/3/ranges/1.json
writing: debug/nodes/3/ranges/2.json
writing: debug/nodes/3/ranges/3.json
......@@ -211,13 +212,14 @@ writing: debug/nodes/3/ranges/29.json
writing: debug/nodes/3/ranges/30.json
writing: debug/nodes/3/ranges/31.json
writing: debug/nodes/3/ranges/32.json
writing: debug/nodes/3/ranges/33.json
requesting list of SQL databases... 3 found
requesting database details for defaultdb... writing: debug/schema/[email protected]
0 tables found
requesting database details for postgres... writing: debug/schema/[email protected]
0 tables found
requesting database details for system... writing: debug/schema/[email protected]
27 tables found
28 tables found
requesting table details for system.comments... writing: debug/schema/system/comments.json
requesting table details for system.descriptor... writing: debug/schema/system/descriptor.json
requesting table details for system.eventlog... writing: debug/schema/system/eventlog.json
......@@ -235,6 +237,7 @@ requesting table details for system.replication_stats... writing: debug/schema/s
requesting table details for system.reports_meta... writing: debug/schema/system/reports_meta.json
requesting table details for system.role_members... writing: debug/schema/system/role_members.json
requesting table details for system.role_options... writing: debug/schema/system/role_options.json
requesting table details for system.scheduled_jobs... writing: debug/schema/system/scheduled_jobs.json
requesting table details for system.settings... writing: debug/schema/system/settings.json
requesting table details for system.statement_bundle_chunks... writing: debug/schema/system/statement_bundle_chunks.json
requesting table details for system.statement_diagnostics... writing: debug/schema/system/statement_diagnostics.json
......
......@@ -54,7 +54,7 @@ requesting heap files for node 1... writing: debug/nodes/1/heapprof.err.txt
requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/1/ranges/1.json
writing: debug/nodes/1/ranges/2.json
writing: debug/nodes/1/ranges/3.json
......@@ -87,6 +87,7 @@ writing: debug/nodes/1/ranges/29.json
writing: debug/nodes/1/ranges/30.json
writing: debug/nodes/1/ranges/31.json
writing: debug/nodes/1/ranges/32.json
writing: debug/nodes/1/ranges/33.json
writing: debug/nodes/2.skipped
writing: debug/nodes/3/status.json
using SQL connection URL for node 3: postgresql://...
......@@ -115,7 +116,7 @@ requesting heap files for node 3... writing: debug/nodes/3/heapprof.err.txt
requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/3/ranges/1.json
writing: debug/nodes/3/ranges/2.json
writing: debug/nodes/3/ranges/3.json
......@@ -148,13 +149,14 @@ writing: debug/nodes/3/ranges/29.json
writing: debug/nodes/3/ranges/30.json
writing: debug/nodes/3/ranges/31.json
writing: debug/nodes/3/ranges/32.json
writing: debug/nodes/3/ranges/33.json
requesting list of SQL databases... 3 found
requesting database details for defaultdb... writing: debug/schema/[email protected]
0 tables found
requesting database details for postgres... writing: debug/schema/[email protected]
0 tables found
requesting database details for system... writing: debug/schema/[email protected]
27 tables found
28 tables found
requesting table details for system.comments... writing: debug/schema/system/comments.json
requesting table details for system.descriptor... writing: debug/schema/system/descriptor.json
requesting table details for system.eventlog... writing: debug/schema/system/eventlog.json
......@@ -172,6 +174,7 @@ requesting table details for system.replication_stats... writing: debug/schema/s
requesting table details for system.reports_meta... writing: debug/schema/system/reports_meta.json
requesting table details for system.role_members... writing: debug/schema/system/role_members.json
requesting table details for system.role_options... writing: debug/schema/system/role_options.json
requesting table details for system.scheduled_jobs... writing: debug/schema/system/scheduled_jobs.json
requesting table details for system.settings... writing: debug/schema/system/settings.json
requesting table details for system.statement_bundle_chunks... writing: debug/schema/system/statement_bundle_chunks.json
requesting table details for system.statement_diagnostics... writing: debug/schema/system/statement_diagnostics.json
......
......@@ -54,7 +54,7 @@ requesting heap files for node 1... writing: debug/nodes/1/heapprof.err.txt
requesting goroutine files for node 1... writing: debug/nodes/1/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/1/ranges/1.json
writing: debug/nodes/1/ranges/2.json
writing: debug/nodes/1/ranges/3.json
......@@ -87,6 +87,7 @@ writing: debug/nodes/1/ranges/29.json
writing: debug/nodes/1/ranges/30.json
writing: debug/nodes/1/ranges/31.json
writing: debug/nodes/1/ranges/32.json
writing: debug/nodes/1/ranges/33.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
......@@ -114,7 +115,7 @@ requesting heap files for node 3... writing: debug/nodes/3/heapprof.err.txt
requesting goroutine files for node 3... writing: debug/nodes/3/goroutines.err.txt
^- resulted in ...
requesting log file ...
requesting ranges... 32 found
requesting ranges... 33 found
writing: debug/nodes/3/ranges/1.json
writing: debug/nodes/3/ranges/2.json
writing: debug/nodes/3/ranges/3.json
......@@ -147,13 +148,14 @@ writing: debug/nodes/3/ranges/29.json
writing: debug/nodes/3/ranges/30.json
writing: debug/nodes/3/ranges/31.json
writing: debug/nodes/3/ranges/32.json
writing: debug/nodes/3/ranges/33.json
requesting list of SQL databases... 3 found
requesting database details for defaultdb... writing: debug/schema/[email protected]
0 tables found
requesting database details for postgres... writing: debug/schema/[email protected]
0 tables found
requesting database details for system... writing: debug/schema/[email protected]
27 tables found
28 tables found
requesting table details for system.comments... writing: debug/schema/system/comments.json
requesting table details for system.descriptor... writing: debug/schema/system/descriptor.json
requesting table details for system.eventlog... writing: debug/schema/system/eventlog.json
......@@ -171,6 +173,7 @@ requesting table details for system.replication_stats... writing: debug/schema/s
requesting table details for system.reports_meta... writing: debug/schema/system/reports_meta.json
requesting table details for system.role_members... writing: debug/schema/system/role_members.json
requesting table details for system.role_options... writing: debug/schema/system/role_options.json
requesting table details for system.scheduled_jobs... writing: debug/schema/system/scheduled_jobs.json
requesting table details for system.settings... writing: debug/schema/system/settings.json
requesting table details for system.statement_bundle_chunks... writing: debug/schema/system/statement_bundle_chunks.json
requesting table details for system.statement_diagnostics... writing: debug/schema/system/statement_diagnostics.json
......
......@@ -21,7 +21,7 @@ requesting table details for defaultdb.pg_catalog.pg_class... writing: debug/sch
requesting database details for postgres... writing: debug/schema/[email protected]
0 tables found
requesting database details for system... writing: debug/schema/[email protected]
27 tables found
28 tables found
requesting table details for system.comments... writing: debug/schema/system-1/comments.json
requesting table details for system.descriptor... writing: debug/schema/system-1/descriptor.json
requesting table details for system.eventlog... writing: debug/schema/system-1/eventlog.json
......@@ -39,6 +39,7 @@ requesting table details for system.replication_stats... writing: debug/schema/s
requesting table details for system.reports_meta... writing: debug/schema/system-1/reports_meta.json
requesting table details for system.role_members... writing: debug/schema/system-1/role_members.json
requesting table details for system.role_options... writing: debug/schema/system-1/role_options.json
requesting table details for system.scheduled_jobs... writing: debug/schema/system-1/scheduled_jobs.json
requesting table details for system.settings... writing: debug/schema/system-1/settings.json
requesting table details for system.statement_bundle_chunks... writing: debug/schema/system-1/statement_bundle_chunks.json
requesting table details for system.statement_diagnostics... writing: debug/schema/system-1/statement_diagnostics.json
......
......@@ -52,7 +52,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... 32 found
requesting ranges... 33 found
writing: debug/nodes/1/ranges/1.json
writing: debug/nodes/1/ranges/2.json
writing: debug/nodes/1/ranges/3.json
......@@ -85,13 +85,14 @@ writing: debug/nodes/1/ranges/29.json
writing: debug/nodes/1/ranges/30.json
writing: debug/nodes/1/ranges/31.json
writing: debug/nodes/1/ranges/32.json
writing: debug/nodes/1/ranges/33.json
requesting list of SQL databases... 3 found
requesting database details for defaultdb... writing: debug/schema/[email protected]
0 tables found
requesting database details for postgres... writing: debug/schema/[email protected]
0 tables found
requesting database details for system... writing: debug/schema/[email protected]
27 tables found
28 tables found
requesting table details for system.comments... writing: debug/schema/system/comments.json
requesting table details for system.descriptor... writing: debug/schema/system/descriptor.json
requesting table details for system.eventlog... writing: debug/schema/system/eventlog.json
......@@ -109,6 +110,7 @@ requesting table details for system.replication_stats... writing: debug/schema/s
requesting table details for system.reports_meta... writing: debug/schema/system/reports_meta.json
requesting table details for system.role_members... writing: debug/schema/system/role_members.json
requesting table details for system.role_options... writing: debug/schema/system/role_options.json
requesting table details for system.scheduled_jobs... writing: debug/schema/system/scheduled_jobs.json
requesting table details for system.settings... writing: debug/schema/system/settings.json
requesting table details for system.statement_bundle_chunks... writing: debug/schema/system/statement_bundle_chunks.json
requesting table details for system.statement_diagnostics... writing: debug/schema/system/statement_diagnostics.json
......
......@@ -66,6 +66,7 @@ const (
VersionRangefeedLeases
VersionAlterColumnTypeGeneral
VersionAlterSystemJobsAddCreatedByColumns
VersionAddScheduledJobsTable
// Add new versions here (step one of two).
)
......@@ -501,11 +502,15 @@ var versionsSingleton = keyedVersions([]keyedVersion{
Version: roachpb.Version{Major: 20, Minor: 1, Unstable: 5},
},
{
// VersionAlterSystemJobsTable is a version which modified system.jobs table
//
// VersionAlterSystemJobsTable is a version which modified system.jobs table.
Key: VersionAlterSystemJobsAddCreatedByColumns,
Version: roachpb.Version{Major: 20, Minor: 1, Unstable: 6},
},
{
// VersionAddScheduledJobsTable is a version which adds system.scheduled_jobs table.
Key: VersionAddScheduledJobsTable,
Version: roachpb.Version{Major: 20, Minor: 1, Unstable: 7},
},
// Add new versions here (step two of two).
......
......@@ -42,11 +42,12 @@ func _() {
_ = x[VersionRangefeedLeases-31]
_ = x[VersionAlterColumnTypeGeneral-32]
_ = x[VersionAlterSystemJobsAddCreatedByColumns-33]
_ = x[VersionAddScheduledJobsTable-34]
}
const _VersionKey_name = "Version19_1VersionStart19_2VersionLearnerReplicasVersionTopLevelForeignKeysVersionAtomicChangeReplicasTriggerVersionAtomicChangeReplicasVersionTableDescModificationTimeFromMVCCVersionPartitionedBackupVersion19_2VersionStart20_1VersionContainsEstimatesCounterVersionChangeReplicasDemotionVersionSecondaryIndexColumnFamiliesVersionNamespaceTableWithSchemasVersionProtectedTimestampsVersionPrimaryKeyChangesVersionAuthLocalAndTrustRejectMethodsVersionPrimaryKeyColumnsOutOfFamilyZeroVersionRootPasswordVersionNoExplicitForeignKeyIndexIDsVersionHashShardedIndexesVersionCreateRolePrivilegeVersionStatementDiagnosticsSystemTablesVersionSchemaChangeJobVersionSavepointsVersionTimeTZTypeVersionTimePrecisionVersion20_1VersionStart20_2VersionGeospatialTypeVersionEnumsVersionRangefeedLeasesVersionAlterColumnTypeGeneralVersionAlterSystemJobsAddCreatedByColumns"
const _VersionKey_name = "Version19_1VersionStart19_2VersionLearnerReplicasVersionTopLevelForeignKeysVersionAtomicChangeReplicasTriggerVersionAtomicChangeReplicasVersionTableDescModificationTimeFromMVCCVersionPartitionedBackupVersion19_2VersionStart20_1VersionContainsEstimatesCounterVersionChangeReplicasDemotionVersionSecondaryIndexColumnFamiliesVersionNamespaceTableWithSchemasVersionProtectedTimestampsVersionPrimaryKeyChangesVersionAuthLocalAndTrustRejectMethodsVersionPrimaryKeyColumnsOutOfFamilyZeroVersionRootPasswordVersionNoExplicitForeignKeyIndexIDsVersionHashShardedIndexesVersionCreateRolePrivilegeVersionStatementDiagnosticsSystemTablesVersionSchemaChangeJobVersionSavepointsVersionTimeTZTypeVersionTimePrecisionVersion20_1VersionStart20_2VersionGeospatialTypeVersionEnumsVersionRangefeedLeasesVersionAlterColumnTypeGeneralVersionAlterSystemJobsAddCreatedByColumnsVersionAddScheduledJobsTable"
var _VersionKey_index = [...]uint16{0, 11, 27, 49, 75, 109, 136, 176, 200, 211, 227, 258, 287, 322, 354, 380, 404, 441, 480, 499, 534, 559, 585, 624, 646, 663, 680, 700, 711, 727, 748, 760, 782, 811, 852}
var _VersionKey_index = [...]uint16{0, 11, 27, 49, 75, 109, 136, 176, 200, 211, 227, 258, 287, 322, 354, 380, 404, 441, 480, 499, 534, 559, 585, 624, 646, 663, 680, 700, 711, 727, 748, 760, 782, 811, 852, 880}
func (i VersionKey) String() string {
if i < 0 || i >= VersionKey(len(_VersionKey_index)-1) {
......
......@@ -380,6 +380,8 @@ const (
StatementDiagnosticsRequestsTableID = 35
StatementDiagnosticsTableID = 36
ScheduledJobsTableID = 37
// CommentType is type for system.comments
DatabaseCommentType = 0
TableCommentType = 1
......
......@@ -659,6 +659,7 @@ system public role_options BASE TABLE
system public statement_bundle_chunks BASE TABLE YES 1
system public statement_diagnostics_requests BASE TABLE YES 1
system public statement_diagnostics BASE TABLE YES 1
system public scheduled_jobs BASE TABLE YES 1
statement ok
ALTER TABLE other_db.xyz ADD COLUMN j INT
......@@ -801,6 +802,12 @@ system public primary system p
system public 630200280_33_1_not_null system public role_options CHECK NO NO
system public 630200280_33_2_not_null system public role_options CHECK NO NO
system public primary system public role_options PRIMARY KEY NO NO
system public 630200280_37_1_not_null system public scheduled_jobs CHECK NO NO
system public 630200280_37_2_not_null system public scheduled_jobs CHECK NO NO
system public 630200280_37_3_not_null system public scheduled_jobs CHECK NO NO
system public 630200280_37_8_not_null system public scheduled_jobs CHECK NO NO
system public 630200280_37_9_not_null system public scheduled_jobs CHECK NO NO
system public primary system public scheduled_jobs PRIMARY KEY NO NO
system public 630200280_6_1_not_null system public settings CHECK NO NO
system public 630200280_6_2_not_null system public settings CHECK NO NO
system public 630200280_6_3_not_null system public settings CHECK NO NO
......@@ -943,6 +950,11 @@ system public 630200280_36_1_not_null id IS NOT NULL
system public 630200280_36_2_not_null statement_fingerprint IS NOT NULL
system public 630200280_36_3_not_null statement IS NOT NULL
system public 630200280_36_4_not_null collected_at IS NOT NULL
system public 630200280_37_1_not_null schedule_id IS NOT NULL
system public 630200280_37_2_not_null schedule_name IS NOT NULL
system public 630200280_37_3_not_null created IS NOT NULL
system public 630200280_37_8_not_null executor_type IS NOT NULL
system public 630200280_37_9_not_null execution_args IS NOT NULL
system public 630200280_3_1_not_null id IS NOT NULL
system public 630200280_4_1_not_null username IS NOT NULL
system public 630200280_4_3_not_null isRole IS NOT NULL
......@@ -997,6 +1009,7 @@ system public role_members member sy
system public role_members role system public primary
system public role_options option system public primary
system public role_options username system public primary
system public scheduled_jobs schedule_id system public primary
system public settings name system public primary
system public statement_bundle_chunks id system public primary
system public statement_diagnostics id system public primary
......@@ -1186,6 +1199,16 @@ system public role_members role
system public role_options option 2
system public role_options username 1
system public role_options value 3
system public scheduled_jobs created 3
system public scheduled_jobs execution_args 9
system public scheduled_jobs executor_type 8
system public scheduled_jobs next_run 5
system public scheduled_jobs owner 4
system public scheduled_jobs schedule_changes 10
system public scheduled_jobs schedule_details 7
system public scheduled_jobs schedule_expr 6
system public scheduled_jobs schedule_id 1
system public scheduled_jobs schedule_name 2
system public settings lastUpdated 3
system public settings name 1
system public settings value 2
......@@ -1811,6 +1834,16 @@ NULL root system public role_options
NULL root system public role_options INSERT NULL NO
NULL root system public role_options SELECT NULL YES
NULL root system public role_options UPDATE NULL NO
NULL admin system public scheduled_jobs DELETE NULL NO
NULL admin system public scheduled_jobs GRANT NULL NO
NULL admin system public scheduled_jobs INSERT NULL NO
NULL admin system public scheduled_jobs SELECT NULL YES
NULL admin system public scheduled_jobs UPDATE NULL NO
NULL root system public scheduled_jobs DELETE NULL NO
NULL root system public scheduled_jobs GRANT NULL NO
NULL root system public scheduled_jobs INSERT NULL NO
NULL root system public scheduled_jobs SELECT NULL YES
NULL root system public scheduled_jobs UPDATE NULL NO
NULL admin system public settings DELETE NULL NO
NULL admin system public settings GRANT NULL NO
NULL admin system public settings INSERT NULL NO
......@@ -2258,6 +2291,16 @@ NULL root system public statement_diagnostics
NULL root system public statement_diagnostics INSERT NULL NO
NULL root system public statement_diagnostics SELECT NULL YES
NULL root system public statement_diagnostics UPDATE NULL NO
NULL admin system public scheduled_jobs DELETE NULL NO
NULL admin system public scheduled_jobs GRANT NULL NO
NULL admin system public scheduled_jobs INSERT NULL NO
NULL admin system public scheduled_jobs SELECT NULL YES
NULL admin system public scheduled_jobs UPDATE NULL NO
NULL root system public scheduled_jobs DELETE NULL NO
NULL root system public scheduled_jobs GRANT NULL NO
NULL root system public scheduled_jobs INSERT NULL NO
NULL root system public scheduled_jobs SELECT NULL YES
NULL root system public scheduled_jobs UPDATE NULL NO
statement ok
CREATE TABLE other_db.xyz (i INT)
......
......@@ -654,6 +654,8 @@ indexrelid indrelid indnatts indisunique indisprimary indisexclusion indim
1628632029 19 1 false false false false false true false false true false 4 0 0 2 NULL NULL
1628632031 19 1 true true false true false true false false true false 1 0 0 2 NULL NULL
1841972634 6 1 true true false true false true false false true false 1 3903121477 0 2 NULL NULL
2008917577 37 1 true true false true false true false false true false 1 0 0 2 NULL NULL
2008917578 37 1 false false false false false true false false true false 5 0 0 2 NULL NULL
2101708905 5 1 true true false true false true false false true false 1 0 0 2 NULL NULL
2148104569 21 2 true true false true false true false false true false 1 2 3903121477 3903121477 0 0 2 2 NULL NULL
2361445172 8 1 true true false true false true false false true false 1 0 0 2 NULL NULL
......@@ -673,7 +675,7 @@ indexrelid indrelid indnatts indisunique indisprimary indisexclusion indim
3966258450 14 1 true true false true false true false false true false 1 3903121477 0 2 NULL NULL
4012654114 30 3 true true false true false true false false true false 1 2 3 0 0 3903121477 0 0 0 2 2 2 NULL NULL
4225994721 13 2 true true false true false true false false true false 1 7 0 0 0 0 2 2 NULL NULL
# From #26504
query OOI colnames
SELECT indexrelid,
......@@ -706,6 +708,8 @@ indexrelid operator_argument_type_oid operator_argument_position
1628632029 0 1
1628632031 0 1
1841972634 0 1
2008917577 0 1
2008917578 0 1
2101708905 0 1
2148104569 0 1
2148104569 0 2
......
......@@ -213,6 +213,7 @@ public role_options table
public statement_bundle_chunks table
public statement_diagnostics_requests table
public statement_diagnostics table
public scheduled_jobs table
query TTTT colnames,rowsort
SELECT * FROM [SHOW TABLES FROM system WITH COMMENT]
......@@ -245,6 +246,7 @@ public role_options table ·
public statement_bundle_chunks table ·
public statement_diagnostics_requests table ·
public statement_diagnostics table ·
public scheduled_jobs table ·
query ITTT colnames
SELECT node_id, user_name, application_name, active_queries
......
......@@ -27,6 +27,7 @@ public replication_stats table
public reports_meta table
public role_members table
public role_options table
public scheduled_jobs table
public settings table
public statement_bundle_chunks table
public statement_diagnostics table
......@@ -69,6 +70,7 @@ SELECT id FROM system.descriptor
34
35
36
37
50
51
52
......@@ -331,6 +333,16 @@ system public role_options root GRANT
system public role_options root INSERT
system public role_options root SELECT
system public role_options root UPDATE
system public scheduled_jobs admin DELETE
system public scheduled_jobs admin GRANT
system public scheduled_jobs admin INSERT
system public scheduled_jobs admin SELECT
system public scheduled_jobs admin UPDATE
system public scheduled_jobs root DELETE
system public scheduled_jobs root GRANT
system public scheduled_jobs root INSERT
system public scheduled_jobs root SELECT
system public scheduled_jobs root UPDATE
system public settings admin DELETE
system public settings admin GRANT
system public settings admin INSERT
......
......@@ -24,6 +24,7 @@ SELECT * FROM system.namespace
1 29 reports_meta 28
1 29 role_members 23
1 29 role_options 33
1 29 scheduled_jobs 37
1 29 settings 6
1 29 statement_bundle_chunks 34
1 29 statement_diagnostics 36
......
......@@ -216,9 +216,9 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
WHERE message LIKE '%DelRange%' OR message LIKE '%DelRng%'
----
flow DelRange /Table/57/1 - /Table/57/2
dist sender send r32: sending batch 1 DelRng to (n1,s1):1
dist sender send r33: sending batch 1 DelRng to (n1,s1):1
flow DelRange /Table/57/1/601/0 - /Table/57/2
dist sender send r32: sending batch 1 DelRng to (n1,s1):1
dist sender send r33: sending batch 1 DelRng to (n1,s1):1
# Ensure that DelRange requests are autocommitted when DELETE FROM happens on a
# chunk of fewer than 600 keys.
......@@ -234,7 +234,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
WHERE message LIKE '%DelRange%' OR message LIKE '%sending batch%'
----
flow DelRange /Table/57/1/5 - /Table/57/1/5/#
dist sender send r32: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1
dist sender send r33: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1
# Test use of fast path when there are interleaved tables.
......
......@@ -255,7 +255,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
table reader Scan /Table/57/1/2{-/#}
flow CPut /Table/57/1/2/0 -> /TUPLE/2:2:Int/3
flow InitPut /Table/57/2/3/0 -> /BYTES/0x8a
kv.DistSender: sending partial batch r32: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
kv.DistSender: sending partial batch r33: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
flow fast path completed
exec stmt rows affected: 1
......@@ -269,7 +269,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
table reader Scan /Table/57/1/1{-/#}
flow CPut /Table/57/1/1/0 -> /TUPLE/2:2:Int/2
flow InitPut /Table/57/2/2/0 -> /BYTES/0x89
kv.DistSender: sending partial batch r32: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
kv.DistSender: sending partial batch r33: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
flow fast path completed
exec stmt rows affected: 1
......@@ -286,7 +286,7 @@ table reader fetched: /kv/primary/2/v -> /3
flow Put /Table/57/1/2/0 -> /TUPLE/2:2:Int/2
flow Del /Table/57/2/3/0
flow CPut /Table/57/2/2/0 -> /BYTES/0x8a (expecting does not exist)
kv.DistSender: sending partial batch r32: sending batch 1 Put, 1 EndTxn to (n1,s1):1
kv.DistSender: sending partial batch r33: sending batch 1 Put, 1 EndTxn to (n1,s1):1
exec stmt execution failed after 0 rows: duplicate key value (v)=(2) violates unique constraint "woo"
......
......@@ -550,7 +550,7 @@ func TestPGPreparedQuery(t *testing.T) {
baseTest.Results("users", "primary", false, 1, "username", "ASC", false, false),
}},
{"SHOW TABLES FROM system", []preparedQueryTest{
baseTest.Results("public", "comments", "table").Others(26),
baseTest.Results("public", "comments", "table").Others(27),
}},
{"SHOW SCHEMAS FROM system", []preparedQueryTest{
baseTest.Results("crdb_internal").Others(4),
......
......@@ -309,6 +309,28 @@ create table system.statement_diagnostics(
FAMILY "primary" (id, statement_fingerprint, statement, collected_at, trace, bundle_chunks, error)
);`
ScheduledJobsTableSchema = `
CREATE TABLE system.scheduled_jobs (
schedule_id INT DEFAULT unique_rowid() PRIMARY KEY NOT NULL,
schedule_name STRING NOT NULL,
created TIMESTAMPTZ NOT NULL DEFAULT now(),
owner STRING,
next_run TIMESTAMPTZ,
schedule_expr STRING,
schedule_details BYTES,
executor_type STRING NOT NULL,
execution_args BYTES NOT NULL,
schedule_changes BYTES,
INDEX "next_run_idx" (next_run),
FAMILY sched (schedule_id, next_run),
FAMILY other (
schedule_name, created, owner, schedule_expr,
schedule_details, executor_type, execution_args, schedule_changes
)
)`
)
func pk(name string) IndexDescriptor {
......@@ -363,6 +385,7 @@ var SystemAllowedPrivileges = map[ID]privilege.List{
keys.StatementBundleChunksTableID: privilege.ReadWriteData,
keys.StatementDiagnosticsRequestsTableID: privilege.ReadWriteData,
keys.StatementDiagnosticsTableID: privilege.ReadWriteData,
keys.ScheduledJobsTableID: privilege.ReadWriteData,
}
// Helpers used to make some of the TableDescriptor literals below more concise.
......@@ -808,7 +831,8 @@ var (
NextMutationID: 1,
}
nowString = "now():::TIMESTAMP"
nowString = "now():::TIMESTAMP"
nowTZString = "now():::TIMESTAMPTZ"
// JobsTable is the descriptor for the jobs table.
JobsTable = TableDescriptor{
......@@ -1561,6 +1585,62 @@ var (
FormatVersion: InterleavedFormatVersion,
NextMutationID: 1,
}
// ScheduledJobsTable is the descriptor for the scheduled jobs table.
ScheduledJobsTable = TableDescriptor{
Name: "scheduled_jobs",
ID: keys.ScheduledJobsTableID,
ParentID: keys.SystemDatabaseID,
UnexposedParentSchemaID: keys.PublicSchemaID,
Version: 1,
Columns: []ColumnDescriptor{
{Name: "schedule_id", ID: 1, Type: types.Int, DefaultExpr: &uniqueRowIDString, Nullable: false},
{Name: "schedule_name", ID: 2, Type: types.String, Nullable: false},
{Name: "created", ID: 3, Type: types.TimestampTZ, DefaultExpr: &nowTZString, Nullable: false},
{Name: "owner", ID: 4, Type: types.String, Nullable: true},
{Name: "next_run", ID: 5, Type: types.TimestampTZ, Nullable: true},
{Name: "schedule_expr", ID: 6, Type: types.String, Nullable: true},
{Name: "schedule_details", ID: 7, Type: types.Bytes, Nullable: true},
{Name: "executor_type", ID: 8, Type: types.String, Nullable: false},
{Name: "execution_args", ID: 9, Type: types.Bytes, Nullable: false},
{Name: "schedule_changes", ID: 10, Type: types.Bytes, Nullable: true},
},
NextColumnID: 11,
Families: []ColumnFamilyDescriptor{
{
Name: "sched",
ID: 0,
ColumnNames: []string{"schedule_id", "next_run"},
ColumnIDs: []ColumnID{1, 5},
DefaultColumnID: 5,
},
{
Name: "other",
ID: 1,
ColumnNames: []string{"schedule_name", "created", "owner", "schedule_expr", "schedule_details",
"executor_type", "execution_args", "schedule_changes"},
ColumnIDs: []ColumnID{2, 3, 4, 6, 7, 8, 9, 10},
},
},
NextFamilyID: 2,
PrimaryIndex: pk("schedule_id"),
Indexes: []IndexDescriptor{
{
Name: "next_run_idx",
ID: 2,
Unique: false,
ColumnNames: []string{"next_run"},
ColumnDirections: []IndexDescriptor_Direction{IndexDescriptor_ASC},
ColumnIDs: []ColumnID{5},
ExtraColumnIDs: []ColumnID{1},
Version: SecondaryIndexFamilyFormatVersion,
},
},
NextIndexID: 3,
Privileges: NewCustomSuperuserPrivilegeDescriptor(SystemAllowedPrivileges[keys.ScheduledJobsTableID]),
FormatVersion: InterleavedFormatVersion,
NextMutationID: 1,
}
)
// addSystemDescriptorsToSchema populates the supplied MetadataSchema
......@@ -1618,6 +1698,9 @@ func addSystemDescriptorsToSchema(target *MetadataSchema) {
target.AddDescriptor(keys.SystemDatabaseID, &StatementBundleChunksTable)
target.AddDescriptor(keys.SystemDatabaseID, &StatementDiagnosticsRequestsTable)
target.AddDescriptor(keys.SystemDatabaseID, &StatementDiagnosticsTable)
// Tables introduced in 20.2.
target.AddDescriptor(keys.SystemDatabaseID, &ScheduledJobsTable)
}
// addSplitIDs adds a split point for each of the PseudoTableIDs to the supplied
......
......@@ -181,6 +181,7 @@ func TestSystemTableLiterals(t *testing.T) {
{keys.StatementBundleChunksTableID, sqlbase.StatementBundleChunksTableSchema, sqlbase.StatementBundleChunksTable},
{keys.StatementDiagnosticsRequestsTableID, sqlbase.StatementDiagnosticsRequestsTableSchema, sqlbase.StatementDiagnosticsRequestsTable},
{keys.StatementDiagnosticsTableID, sqlbase.StatementDiagnosticsTableSchema, sqlbase.StatementDiagnosticsTable},
{keys.ScheduledJobsTableID, sqlbase.ScheduledJobsTableSchema, sqlbase.ScheduledJobsTable},
} {
privs := *test.pkg.Privileges
gen, err := sql.CreateTestTableDescriptor(
......
initial-keys tenant=system
----
65 keys:
67 keys:
/System/"desc-idgen"
/Table/3/1/1/2/1
/Table/3/1/2/2/1
......@@ -30,6 +30,7 @@ initial-keys tenant=system
/Table/3/1/34/2/1
/Table/3/1/35/2/1
/Table/3/1/36/2/1
/Table/3/1/37/2/1
/Table/5/1/0/2/1
/Table/5/1/1/2/1
/Table/5/1/16/2/1
......@@ -56,6 +57,7 @@ initial-keys tenant=system
/NamespaceTable/30/1/1/29/"reports_meta"/4/1
/NamespaceTable/30/1/1/29/"role_members"/4/1
/NamespaceTable/30/1/1/29/"role_options"/4/1
/NamespaceTable/30/1/1/29/"scheduled_jobs"/4/1
/NamespaceTable/30/1/1/29/"settings"/4/1
/NamespaceTable/30/1/1/29/"statement_bundle_chunks"/4/1
/NamespaceTable/30/1/1/29/"statement_diagnostics"/4/1
......@@ -66,7 +68,7 @@ initial-keys tenant=system
/NamespaceTable/30/1/1/29/"users"/4/1
/NamespaceTable/30/1/1/29/"web_sessions"/4/1
/NamespaceTable/30/1/1/29/"zones"/4/1
26 splits:
27 splits:
/Table/11
/Table/12
/Table/13
......@@ -93,10 +95,11 @@ initial-keys tenant=system
/Table/34
/Table/35
/Table/36
/Table/37
initial-keys tenant=5
----
56 keys:
58 keys:
/Tenant/5/Table/3/1/1/2/1
/Tenant/5/Table/3/1/2/2/1
/Tenant/5/Table/3/1/3/2/1
......@@ -124,6 +127,7 @@ initial-keys tenant=5
/Tenant/5/Table/3/1/34/2/1
/Tenant/5/Table/3/1/35/2/1
/Tenant/5/Table/3/1/36/2/1
/Tenant/5/Table/3/1/37/2/1
/Tenant/5/Table/7/1/0/0
/Tenant/5/NamespaceTable/30/1/0/0/"system"/4/1
/Tenant/5/NamespaceTable/30/1/1/0/"public"/4/1
......@@ -145,6 +149,7 @@ initial-keys tenant=5
/Tenant/5/NamespaceTable/30/1/1/29/"reports_meta"/4/1