diff --git a/docs/generated/settings/settings-for-tenants.txt b/docs/generated/settings/settings-for-tenants.txt index f99306bfc433..05684189bbe2 100644 --- a/docs/generated/settings/settings-for-tenants.txt +++ b/docs/generated/settings/settings-for-tenants.txt @@ -392,4 +392,4 @@ trace.snapshot.rate duration 0s if non-zero, interval at which background trace trace.span_registry.enabled boolean true if set, ongoing traces can be seen at https:///#/debug/tracez application trace.zipkin.collector string the address of a Zipkin instance to receive traces, as :. If no port is specified, 9411 will be used. application ui.display_timezone enumeration etc/utc the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1] application -version version 1000024.2-upgrading-to-1000024.3-step-006 set the active cluster version in the format '.' application +version version 1000024.2-upgrading-to-1000024.3-step-008 set the active cluster version in the format '.' application diff --git a/docs/generated/settings/settings.html b/docs/generated/settings/settings.html index d3f4a4474cd0..12214aea5546 100644 --- a/docs/generated/settings/settings.html +++ b/docs/generated/settings/settings.html @@ -348,6 +348,6 @@
trace.span_registry.enabled
booleantrueif set, ongoing traces can be seen at https://<ui>/#/debug/tracezServerless/Dedicated/Self-Hosted
trace.zipkin.collector
stringthe address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used.Serverless/Dedicated/Self-Hosted
ui.display_timezone
enumerationetc/utcthe timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1]Serverless/Dedicated/Self-Hosted -
version
version1000024.2-upgrading-to-1000024.3-step-006set the active cluster version in the format '<major>.<minor>'Serverless/Dedicated/Self-Hosted +
version
version1000024.2-upgrading-to-1000024.3-step-008set the active cluster version in the format '<major>.<minor>'Serverless/Dedicated/Self-Hosted diff --git a/docs/generated/sql/bnf/BUILD.bazel b/docs/generated/sql/bnf/BUILD.bazel index 1b4c9958e4f1..6c13d6c0c67d 100644 --- a/docs/generated/sql/bnf/BUILD.bazel +++ b/docs/generated/sql/bnf/BUILD.bazel @@ -86,6 +86,7 @@ FILES = [ "col_qualification", "column_table_def", "comment", + "commit_prepared_stmt", "commit_transaction", "copy_stmt", "copy_to_stmt", @@ -181,6 +182,7 @@ FILES = [ "pause_stmt", "preparable_stmt", "prepare_stmt", + "prepare_transaction_stmt", "primary_key_column_level", "primary_key_table_level", "reassign_owned_by_stmt", @@ -202,6 +204,7 @@ FILES = [ "resume_schedule", "resume_stmt", "revoke_stmt", + "rollback_prepared_stmt", "rollback_transaction", "routine_body_stmt", "routine_return_stmt", diff --git a/docs/generated/sql/bnf/commit_prepared_stmt.bnf b/docs/generated/sql/bnf/commit_prepared_stmt.bnf new file mode 100644 index 000000000000..83c66a25a07b --- /dev/null +++ b/docs/generated/sql/bnf/commit_prepared_stmt.bnf @@ -0,0 +1,2 @@ +commit_prepared_stmt ::= + 'COMMIT' 'PREPARED' 'SCONST' diff --git a/docs/generated/sql/bnf/prepare_transaction_stmt.bnf b/docs/generated/sql/bnf/prepare_transaction_stmt.bnf new file mode 100644 index 000000000000..29f1fac86799 --- /dev/null +++ b/docs/generated/sql/bnf/prepare_transaction_stmt.bnf @@ -0,0 +1,2 @@ +prepare_transaction_stmt ::= + 'PREPARE' 'TRANSACTION' 'SCONST' diff --git a/docs/generated/sql/bnf/rollback_prepared_stmt.bnf b/docs/generated/sql/bnf/rollback_prepared_stmt.bnf new file mode 100644 index 000000000000..0c89356ba55f --- /dev/null +++ b/docs/generated/sql/bnf/rollback_prepared_stmt.bnf @@ -0,0 +1,2 @@ +rollback_prepared_stmt ::= + 'ROLLBACK' 'PREPARED' 'SCONST' diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index bb9163d130b1..f1cd4819f371 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -153,6 +153,9 @@ transaction_stmt ::= | commit_stmt | rollback_stmt | abort_stmt + | prepare_transaction_stmt + | commit_prepared_stmt + | rollback_prepared_stmt close_cursor_stmt ::= 'CLOSE' 'ALL' @@ -472,6 +475,15 @@ rollback_stmt ::= abort_stmt ::= 'ABORT' opt_abort_mod +prepare_transaction_stmt ::= + 'PREPARE' 'TRANSACTION' 'SCONST' + +commit_prepared_stmt ::= + 'COMMIT' 'PREPARED' 'SCONST' + +rollback_prepared_stmt ::= + 'ROLLBACK' 'PREPARED' 'SCONST' + cursor_name ::= name @@ -1342,6 +1354,7 @@ unreserved_keyword ::= | 'POLYGONZM' | 'PRECEDING' | 'PREPARE' + | 'PREPARED' | 'PRESERVE' | 'PRIOR' | 'PRIORITY' @@ -4050,6 +4063,7 @@ bare_label_keywords ::= | 'POSITION' | 'PRECEDING' | 'PREPARE' + | 'PREPARED' | 'PRESERVE' | 'PRIMARY' | 'PRIOR' diff --git a/docs/generated/sql/bnf/transaction_stmt.bnf b/docs/generated/sql/bnf/transaction_stmt.bnf index bd4bd638aecb..a2c2c71209a4 100644 --- a/docs/generated/sql/bnf/transaction_stmt.bnf +++ b/docs/generated/sql/bnf/transaction_stmt.bnf @@ -3,3 +3,6 @@ transaction_stmt ::= | commit_stmt | rollback_stmt | abort_stmt + | prepare_transaction_stmt + | commit_prepared_stmt + | rollback_prepared_stmt diff --git a/pkg/ccl/backupccl/system_schema.go b/pkg/ccl/backupccl/system_schema.go index 9d5cbb877392..1493b4232a65 100644 --- a/pkg/ccl/backupccl/system_schema.go +++ b/pkg/ccl/backupccl/system_schema.go @@ -847,6 +847,9 @@ var systemTableBackupConfiguration = map[string]systemBackupConfiguration{ systemschema.TransactionExecInsightsTable.GetName(): { shouldIncludeInClusterBackup: optOutOfClusterBackup, }, + systemschema.PreparedTransactionsTable.GetName(): { + shouldIncludeInClusterBackup: optOutOfClusterBackup, + }, } func rekeySystemTable( diff --git a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant index 4871a3b224eb..814d39cc5ac2 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant +++ b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant @@ -357,12 +357,12 @@ txn_id txn_fingerprint_id query implicit_txn session_id start_time end_tim query ITTI SELECT range_id, start_pretty, end_pretty, lease_holder FROM crdb_internal.ranges ---- -69 /Tenant/10 /Tenant/11 1 +70 /Tenant/10 /Tenant/11 1 query ITT SELECT range_id, start_pretty, end_pretty FROM crdb_internal.ranges_no_leases ---- -69 /Tenant/10 /Tenant/11 +70 /Tenant/10 /Tenant/11 query IT SELECT zone_id, target FROM crdb_internal.zones ORDER BY 1 diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error index 9acc9c61e1a0..d8c35bb168c0 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error @@ -463,7 +463,7 @@ skipif config multiregion-9node-3region-3azs-vec-off query I retry SELECT DISTINCT range_id FROM [SHOW RANGES FROM TABLE messages_rbr] ---- -74 +75 # Update does not fail when accessing all rows in messages_rbr because lookup # join does not error out the lookup table in phase 1. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_insert_fast_path b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_insert_fast_path index 82e471282428..8f25d5c8ce72 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_insert_fast_path +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_insert_fast_path @@ -200,7 +200,7 @@ query T rowsort SELECT message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%batch%' AND message LIKE '%Scan%' ---- -r68: sending batch 4 Scan to (n1,s1):1 +r69: sending batch 4 Scan to (n1,s1):1 # Regression test for #115377. statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior index a3111dca5d35..e19558343f50 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior @@ -264,7 +264,7 @@ ap-southeast-2 23 query TT SELECT start_key, end_key FROM [SHOW RANGE FROM TABLE regional_by_row_table FOR ROW ('ap-southeast-2', 1)] ---- - … + … query TIIII SELECT crdb_region, pk, pk2, a, b FROM regional_by_row_table @@ -402,7 +402,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX r ORDER BY 1 ---- start_key end_key replicas lease_holder - …/"\x80"/0 {1} 1 + …/"\x80"/0 {1} 1 …/"\x80"/0 …/"\xc0"/0 {4} 4 …/"\xc0"/0 {7} 7 diff --git a/pkg/ccl/logictestccl/testdata/logic_test/show_create b/pkg/ccl/logictestccl/testdata/logic_test/show_create index 7db494238417..72e2311e5610 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/show_create +++ b/pkg/ccl/logictestccl/testdata/logic_test/show_create @@ -89,7 +89,6 @@ r1 CREATE FUNCTION public.r1(i INT8) SELECT 1; $$ -skipif config local-mixed-23.1 query TT SELECT * FROM [SHOW CREATE PROCEDURE r1] ORDER BY 2 ---- diff --git a/pkg/ccl/multiregionccl/multiregion_system_table_test.go b/pkg/ccl/multiregionccl/multiregion_system_table_test.go index 3c9b92de27e8..1eacaa70f9a8 100644 --- a/pkg/ccl/multiregionccl/multiregion_system_table_test.go +++ b/pkg/ccl/multiregionccl/multiregion_system_table_test.go @@ -280,6 +280,7 @@ func TestMrSystemDatabase(t *testing.T) { {"TABLE system.public.locations"}, {"TABLE system.public.migrations"}, {"TABLE system.public.mvcc_statistics"}, + {"TABLE system.public.prepared_transactions"}, {"TABLE system.public.protected_ts_meta"}, {"TABLE system.public.protected_ts_records"}, {"TABLE system.public.rangelog"}, @@ -321,6 +322,7 @@ func TestMrSystemDatabase(t *testing.T) { {"TABLE system.public.locations"}, {"TABLE system.public.migrations"}, {"TABLE system.public.mvcc_statistics"}, + {"TABLE system.public.prepared_transactions"}, {"TABLE system.public.protected_ts_meta"}, {"TABLE system.public.protected_ts_records"}, {"TABLE system.public.rangelog"}, diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/basic b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/basic index 85d3f1a1b0c7..38c7a9cbd7e5 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/basic +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/basic @@ -74,6 +74,7 @@ upsert /Table/6{3-4} database system (host) upsert /Table/6{4-5} database system (host) upsert /Table/6{5-6} database system (host) upsert /Table/6{6-7} database system (host) +upsert /Table/6{7-8} database system (host) exec-sql CREATE DATABASE db; @@ -130,6 +131,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} num_replicas=7 num_voters=5 /Table/10{7-8} num_replicas=7 /Table/11{2-3} num_replicas=7 @@ -247,6 +249,8 @@ delete /Table/6{5-6} upsert /Table/6{5-6} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true delete /Table/6{6-7} upsert /Table/6{6-7} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true +delete /Table/6{7-8} +upsert /Table/6{7-8} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true state offset=5 limit=42 ---- diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/indexes b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/indexes index badedd2ef41c..f14ef9b03779 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/indexes +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/indexes @@ -41,6 +41,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} range default exec-sql @@ -82,6 +83,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/2} num_replicas=7 /Table/106/{2-3} num_replicas=7 num_voters=5 /Table/10{6/3-7} num_replicas=7 @@ -125,6 +127,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/2} ttl_seconds=3600 num_replicas=7 /Table/106/{2-3} ttl_seconds=25 num_replicas=7 num_voters=5 /Table/10{6/3-7} ttl_seconds=3600 num_replicas=7 @@ -158,6 +161,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/2} ttl_seconds=3600 num_replicas=9 /Table/106/{2-3} ttl_seconds=25 num_replicas=9 num_voters=5 /Table/10{6/3-7} ttl_seconds=3600 num_replicas=9 @@ -205,3 +209,4 @@ state offset=46 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/basic b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/basic index 6e381711e8a2..f3cd74c1dbf4 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/basic +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/basic @@ -42,6 +42,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/10{-\x00} database system (tenant) /Tenant/11{-\x00} database system (tenant) /Tenant/12{-\x00} database system (tenant) @@ -109,6 +110,7 @@ upsert /Tenant/10/Table/6{3-4} database system (tenant) upsert /Tenant/10/Table/6{4-5} database system (tenant) upsert /Tenant/10/Table/6{5-6} database system (tenant) upsert /Tenant/10/Table/6{6-7} database system (tenant) +upsert /Tenant/10/Table/6{7-8} database system (tenant) state offset=47 ---- @@ -133,6 +135,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/10{-/Table/4} database system (tenant) /Tenant/10/Table/{4-5} database system (tenant) /Tenant/10/Table/{5-6} database system (tenant) @@ -189,6 +192,7 @@ state offset=47 /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/11{-\x00} database system (tenant) /Tenant/12{-\x00} database system (tenant) @@ -213,6 +217,7 @@ upsert /Tenant/10/Table/11{3-4} rangefeed_enabled=true state offset=81 ---- ... +/Tenant/10/Table/2{0-1} database system (tenant) /Tenant/10/Table/2{1-2} database system (tenant) /Tenant/10/Table/2{3-4} database system (tenant) /Tenant/10/Table/2{4-5} database system (tenant) @@ -255,6 +260,7 @@ state offset=81 /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/10/Table/10{6-7} rangefeed_enabled=true /Tenant/10/Table/10{7-8} rangefeed_enabled=true /Tenant/10/Table/11{2-3} rangefeed_enabled=true diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/protectedts b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/protectedts index 7c85774d1e0c..bb5e06b987d8 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/protectedts +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/protectedts @@ -39,6 +39,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/10{-\x00} database system (tenant) /Tenant/11{-\x00} database system (tenant) @@ -125,6 +126,7 @@ upsert /Tenant/10/Table/6{3-4} database system (tenant) upsert /Tenant/10/Table/6{4-5} database system (tenant) upsert /Tenant/10/Table/6{5-6} database system (tenant) upsert /Tenant/10/Table/6{6-7} database system (tenant) +upsert /Tenant/10/Table/6{7-8} database system (tenant) exec-sql tenant=10 CREATE DATABASE db; diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/range_tenants b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/range_tenants index ccdad786844e..240c0c4752ef 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/range_tenants +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/range_tenants @@ -58,6 +58,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/10{-\x00} database system (tenant) /Tenant/11{-\x00} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true /Tenant/12{-\x00} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true @@ -94,6 +95,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/10{-/Table/4} database system (tenant) /Tenant/10/Table/{4-5} database system (tenant) /Tenant/10/Table/{5-6} database system (tenant) @@ -150,6 +152,7 @@ state offset=47 /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/11{-\x00} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true /Tenant/12{-\x00} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true @@ -187,6 +190,7 @@ mutations discard tenant=11 state offset=81 ---- ... +/Tenant/10/Table/2{0-1} database system (tenant) /Tenant/10/Table/2{1-2} database system (tenant) /Tenant/10/Table/2{3-4} database system (tenant) /Tenant/10/Table/2{4-5} database system (tenant) @@ -229,6 +233,7 @@ state offset=81 /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/10/Table/10{6-7} rangefeed_enabled=true /Tenant/10/Table/10{7-8} rangefeed_enabled=true /Tenant/11{-/Table/4} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true @@ -287,6 +292,7 @@ state offset=81 /Tenant/11/Table/6{4-5} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true /Tenant/11/Table/6{5-6} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true /Tenant/11/Table/6{6-7} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true +/Tenant/11/Table/6{7-8} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true /Tenant/12{-\x00} ttl_seconds=18000 ignore_strict_gc=true rangefeed_enabled=true query-sql tenant=11 diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/tenant_end_key_split b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/tenant_end_key_split index bab0223a3ef3..26b28cb40571 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/tenant_end_key_split +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/multitenant/tenant_end_key_split @@ -25,6 +25,7 @@ state offset=59 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Tenant/11{-\x00} database system (tenant) /Tenant/12{-\x00} database system (tenant) @@ -53,6 +54,7 @@ state offset=60 limit=3 state offset=103 ---- ... +/Tenant/11/Table/4{5-6} ignore_strict_gc=true rangefeed_enabled=true exclude_data_from_backup=true /Tenant/11/Table/4{6-7} database system (tenant) /Tenant/11/Table/4{7-8} ignore_strict_gc=true rangefeed_enabled=true exclude_data_from_backup=true /Tenant/11/Table/4{8-9} database system (tenant) @@ -73,6 +75,7 @@ state offset=103 /Tenant/11/Table/6{4-5} database system (tenant) /Tenant/11/Table/6{5-6} database system (tenant) /Tenant/11/Table/6{6-7} database system (tenant) +/Tenant/11/Table/6{7-8} database system (tenant) /Tenant/12{-\x00} database system (tenant) # Just another view of what the tenant's reconciler actually did. It got rid of @@ -138,6 +141,7 @@ upsert /Tenant/11/Table/6{3-4} database system (tenant) upsert /Tenant/11/Table/6{4-5} database system (tenant) upsert /Tenant/11/Table/6{5-6} database system (tenant) upsert /Tenant/11/Table/6{6-7} database system (tenant) +upsert /Tenant/11/Table/6{7-8} database system (tenant) # Initialize a new tenant, tenant=10, that DOES have a pre-existing tenant, # tenant=11, next to it. diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/named_zones b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/named_zones index 3efbf1218381..acdc6fc99700 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/named_zones +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/named_zones @@ -144,6 +144,7 @@ state offset=46 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} ttl_seconds=50 # Make sure future descendants observe the same. @@ -179,6 +180,7 @@ state offset=46 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} ttl_seconds=50 /Table/10{7-8} ttl_seconds=50 diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/partitions b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/partitions index a6c9fc6a7f0e..7dd22d33850e 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/partitions +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/partitions @@ -33,6 +33,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) exec-sql CREATE DATABASE db; @@ -72,6 +73,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} range default # All parent schema zone config changes cascade to the entire table's span. @@ -108,6 +110,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} num_replicas=7 num_voters=5 # Apply a zone configuration on one of the partitions, `one_two`, which @@ -149,6 +152,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/1/1} num_replicas=7 num_voters=5 /Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5 /Table/106/1/{2-3} global_reads=true num_replicas=7 num_voters=5 @@ -190,6 +194,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/1/1} num_replicas=7 num_voters=5 /Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5 /Table/106/1/{2-3} global_reads=true num_replicas=7 num_voters=5 @@ -245,6 +250,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/1} num_replicas=7 num_voters=5 /Table/106/1{-/1} num_replicas=7 num_voters=6 /Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5 @@ -298,6 +304,7 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/106{-/1} num_replicas=7 /Table/106/1{-/1} num_replicas=7 num_voters=6 /Table/106/1/{1-2} global_reads=true num_replicas=7 @@ -345,3 +352,4 @@ state offset=47 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) diff --git a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/protectedts b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/protectedts index 0e6bbe3cae56..df1a1d8508f4 100644 --- a/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/protectedts +++ b/pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/protectedts @@ -96,6 +96,7 @@ state offset=51 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} protection_policies=[{ts: 3} {ts: 4}] /Table/10{7-8} protection_policies=[{ts: 3} {ts: 4}] @@ -154,6 +155,7 @@ state offset=57 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} protection_policies=[{ts: 3} {ts: 4}] /Table/10{7-8} protection_policies=[{ts: 3} {ts: 4}] @@ -178,5 +180,6 @@ state offset=57 /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/10{6-7} range default /Table/10{7-8} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate index 70cc62ac4439..e3cd919048cb 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate @@ -90,6 +90,7 @@ full-translate /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) /Table/11{0-1} range default /Table/11{1-2} range default /Table/11{2-3} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate_named_zones_deleted b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate_named_zones_deleted index dc1446d9e896..1d066d0cc22e 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate_named_zones_deleted +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/full_translate_named_zones_deleted @@ -116,3 +116,4 @@ full-translate /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/system_database b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/system_database index 6265954731c2..431ed189fea2 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/system_database +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/system_database @@ -66,6 +66,7 @@ translate database=system /Table/6{4-5} database system (host) /Table/6{5-6} database system (host) /Table/6{6-7} database system (host) +/Table/6{7-8} database system (host) # Alter zone config fields on the database to ensure the effects cascade. exec-sql @@ -136,6 +137,7 @@ translate database=system /Table/6{4-5} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true /Table/6{5-6} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true /Table/6{6-7} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true +/Table/6{7-8} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true # Alter a named range that maps to a pseudo table ID, ensuring that its effects # are independent. @@ -212,3 +214,4 @@ full-translate /Table/6{4-5} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true /Table/6{5-6} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true /Table/6{6-7} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true +/Table/6{7-8} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/tenant/full_translate b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/tenant/full_translate index 223cff735db4..9a226d9c7f20 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/tenant/full_translate +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/tenant/full_translate @@ -73,6 +73,7 @@ full-translate /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/10/Table/11{0-1} rangefeed_enabled=true /Tenant/10/Table/11{1-2} rangefeed_enabled=true /Tenant/10/Table/11{2-3} rangefeed_enabled=true @@ -136,6 +137,7 @@ translate named-zone=default /Tenant/10/Table/6{4-5} database system (tenant) /Tenant/10/Table/6{5-6} database system (tenant) /Tenant/10/Table/6{6-7} database system (tenant) +/Tenant/10/Table/6{7-8} database system (tenant) /Tenant/10/Table/11{0-1} rangefeed_enabled=true /Tenant/10/Table/11{1-2} rangefeed_enabled=true /Tenant/10/Table/11{2-3} rangefeed_enabled=true diff --git a/pkg/cli/testdata/doctor/test_examine_cluster b/pkg/cli/testdata/doctor/test_examine_cluster index 40c4339e5705..a05a7f1e495d 100644 --- a/pkg/cli/testdata/doctor/test_examine_cluster +++ b/pkg/cli/testdata/doctor/test_examine_cluster @@ -1,7 +1,7 @@ debug doctor examine cluster ---- debug doctor examine cluster -Examining 63 descriptors and 62 namespace entries... +Examining 64 descriptors and 63 namespace entries... ParentID 100, ParentSchemaID 101: relation "foo" (105): expected matching namespace entry, found none Examining 10 jobs... ERROR: validation failed diff --git a/pkg/cli/testdata/doctor/test_examine_cluster_dropped b/pkg/cli/testdata/doctor/test_examine_cluster_dropped index 2118e0bd3469..34dd837c7581 100644 --- a/pkg/cli/testdata/doctor/test_examine_cluster_dropped +++ b/pkg/cli/testdata/doctor/test_examine_cluster_dropped @@ -1,6 +1,6 @@ debug doctor examine cluster ---- debug doctor examine cluster -Examining 62 descriptors and 62 namespace entries... +Examining 63 descriptors and 63 namespace entries... Examining 8 jobs... No problems found! diff --git a/pkg/cli/testdata/doctor/test_examine_cluster_jobs b/pkg/cli/testdata/doctor/test_examine_cluster_jobs index 8ba58ad8df93..071b037ed902 100644 --- a/pkg/cli/testdata/doctor/test_examine_cluster_jobs +++ b/pkg/cli/testdata/doctor/test_examine_cluster_jobs @@ -1,7 +1,7 @@ debug doctor examine cluster ---- debug doctor examine cluster -Examining 62 descriptors and 63 namespace entries... +Examining 63 descriptors and 64 namespace entries... ParentID 183, ParentSchemaID 381: relation "foo" (104): referenced database ID 183: referenced descriptor not found ParentID 183, ParentSchemaID 381: relation "foo" (104): referenced schema ID 381: referenced descriptor not found ParentID 183, ParentSchemaID 381: relation "foo" (104): expected matching namespace entry, found none diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index 442457c01ace..67ab1e158b58 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -224,6 +224,11 @@ const ( // config for the timeseries range if one does not exist currently. V24_3_AddTimeseriesZoneConfig + // V24_3_PreparedTransactionsTable adds the system.prepared_transactions + // table. The table is used to store information about prepared transaction + // that are part of the XA two-phase commit protocol. + V24_3_PreparedTransactionsTable + // ************************************************* // Step (1) Add new versions above this comment. // Do not add new versions to a patch release. @@ -276,6 +281,8 @@ var versionTable = [numKeys]roachpb.Version{ V24_3_AddTimeseriesZoneConfig: {Major: 24, Minor: 2, Internal: 6}, + V24_3_PreparedTransactionsTable: {Major: 24, Minor: 2, Internal: 8}, + // ************************************************* // Step (2): Add new versions above this comment. // Do not add new versions to a patch release. diff --git a/pkg/cmd/roachtest/tests/pgjdbc.go b/pkg/cmd/roachtest/tests/pgjdbc.go index fc56989ffcfc..56ae244d9cc7 100644 --- a/pkg/cmd/roachtest/tests/pgjdbc.go +++ b/pkg/cmd/roachtest/tests/pgjdbc.go @@ -114,6 +114,21 @@ func registerPgjdbc(r registry.Registry) { t.Fatal(err) } + // Remove an unsupported deferrable qualifier (#31632) from the XA test + // suite setup. This prevents XADataSourceTest.mappingOfConstraintViolations + // from running properly (it fails either way), but it allows the rest of + // the XA tests to run. + if err := repeatRunE( + ctx, + t, + c, + node, + "removing unsupported deferrable qualifier from test", + "sed -i 's/ deferrable//' /mnt/data1/pgjdbc/pgjdbc/src/test/java/org/postgresql/test/xa/XADataSourceTest.java", + ); err != nil { + t.Fatal(err) + } + t.Status("building pgjdbc (without tests)") // Build pgjdbc and run a single test, this step involves some // downloading, so it needs a retry loop as well. Just building was not diff --git a/pkg/cmd/roachtest/tests/pgjdbc_blocklist.go b/pkg/cmd/roachtest/tests/pgjdbc_blocklist.go index 5024692c0020..6787e76773fe 100644 --- a/pkg/cmd/roachtest/tests/pgjdbc_blocklist.go +++ b/pkg/cmd/roachtest/tests/pgjdbc_blocklist.go @@ -649,7 +649,34 @@ var pgjdbcBlockList = blocklist{ `org.postgresql.test.util.PasswordUtilTest.encryptionTypeValueOfOn()`: "73337", `org.postgresql.test.util.PasswordUtilTest.mD5()`: "73337", `org.postgresql.test.util.PasswordUtilTest.scramSha256()`: "unknown", - `org.postgresql.test.xa.XADataSourceTest.initializationError`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.autoCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.closeBeforeCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.commitByDifferentConnection()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.commitUnknownXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.committingCommittedXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.databaseRemovesPreparedBeforeCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.databaseRemovesPreparedBeforeRollback()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.endThenJoin()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.mappingOfConstraintViolations()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.networkIssueOnCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.networkIssueOnOnePhaseCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.networkIssueOnRollback()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.onePhase()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.onePhaseCommitOfPrepared()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.onePhaseCommitUnknownXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.onePhaseCommittingCommittedXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.prepareUnknownXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.preparingPreparedXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.recover()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.repeatedRolledBack()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.restoreOfAutoCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.restoreOfAutoCommitEndThenJoin()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.rollback()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.rollbackByDifferentConnection()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.rollbackUnknownXid()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.rollbackWithoutPrepare()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.twoPhaseCommit()`: "unknown", + `org.postgresql.test.xa.XADataSourceTest.wrapperEquals()`: "unknown", } var pgjdbcIgnoreList = blocklist{ diff --git a/pkg/gen/bnf.bzl b/pkg/gen/bnf.bzl index 610f8432500c..62cf48697d59 100644 --- a/pkg/gen/bnf.bzl +++ b/pkg/gen/bnf.bzl @@ -86,6 +86,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:col_qualification.bnf", "//docs/generated/sql/bnf:column_table_def.bnf", "//docs/generated/sql/bnf:comment.bnf", + "//docs/generated/sql/bnf:commit_prepared_stmt.bnf", "//docs/generated/sql/bnf:commit_transaction.bnf", "//docs/generated/sql/bnf:copy_stmt.bnf", "//docs/generated/sql/bnf:copy_to_stmt.bnf", @@ -181,6 +182,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:pause_stmt.bnf", "//docs/generated/sql/bnf:preparable_stmt.bnf", "//docs/generated/sql/bnf:prepare_stmt.bnf", + "//docs/generated/sql/bnf:prepare_transaction_stmt.bnf", "//docs/generated/sql/bnf:primary_key_column_level.bnf", "//docs/generated/sql/bnf:primary_key_table_level.bnf", "//docs/generated/sql/bnf:reassign_owned_by_stmt.bnf", @@ -202,6 +204,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:resume_schedule.bnf", "//docs/generated/sql/bnf:resume_stmt.bnf", "//docs/generated/sql/bnf:revoke_stmt.bnf", + "//docs/generated/sql/bnf:rollback_prepared_stmt.bnf", "//docs/generated/sql/bnf:rollback_transaction.bnf", "//docs/generated/sql/bnf:routine_body_stmt.bnf", "//docs/generated/sql/bnf:routine_return_stmt.bnf", diff --git a/pkg/gen/diagrams.bzl b/pkg/gen/diagrams.bzl index cd6bfd6d5b3d..917d6717ce5c 100644 --- a/pkg/gen/diagrams.bzl +++ b/pkg/gen/diagrams.bzl @@ -86,6 +86,7 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:col_qualification.html", "//docs/generated/sql/bnf:column_table_def.html", "//docs/generated/sql/bnf:comment.html", + "//docs/generated/sql/bnf:commit_prepared.html", "//docs/generated/sql/bnf:commit_transaction.html", "//docs/generated/sql/bnf:copy.html", "//docs/generated/sql/bnf:copy_to.html", @@ -181,6 +182,7 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:pause_schedule.html", "//docs/generated/sql/bnf:preparable.html", "//docs/generated/sql/bnf:prepare.html", + "//docs/generated/sql/bnf:prepare_transaction.html", "//docs/generated/sql/bnf:primary_key_column_level.html", "//docs/generated/sql/bnf:primary_key_table_level.html", "//docs/generated/sql/bnf:reassign_owned_by.html", @@ -202,6 +204,7 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:resume_job.html", "//docs/generated/sql/bnf:resume_schedule.html", "//docs/generated/sql/bnf:revoke.html", + "//docs/generated/sql/bnf:rollback_prepared.html", "//docs/generated/sql/bnf:rollback_transaction.html", "//docs/generated/sql/bnf:routine_body.html", "//docs/generated/sql/bnf:routine_return.html", diff --git a/pkg/gen/docs.bzl b/pkg/gen/docs.bzl index dcee960884c4..da323c8b792b 100644 --- a/pkg/gen/docs.bzl +++ b/pkg/gen/docs.bzl @@ -99,6 +99,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:col_qualification.bnf", "//docs/generated/sql/bnf:column_table_def.bnf", "//docs/generated/sql/bnf:comment.bnf", + "//docs/generated/sql/bnf:commit_prepared_stmt.bnf", "//docs/generated/sql/bnf:commit_transaction.bnf", "//docs/generated/sql/bnf:copy_stmt.bnf", "//docs/generated/sql/bnf:copy_to_stmt.bnf", @@ -194,6 +195,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:pause_stmt.bnf", "//docs/generated/sql/bnf:preparable_stmt.bnf", "//docs/generated/sql/bnf:prepare_stmt.bnf", + "//docs/generated/sql/bnf:prepare_transaction_stmt.bnf", "//docs/generated/sql/bnf:primary_key_column_level.bnf", "//docs/generated/sql/bnf:primary_key_table_level.bnf", "//docs/generated/sql/bnf:reassign_owned_by_stmt.bnf", @@ -215,6 +217,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:resume_schedule.bnf", "//docs/generated/sql/bnf:resume_stmt.bnf", "//docs/generated/sql/bnf:revoke_stmt.bnf", + "//docs/generated/sql/bnf:rollback_prepared_stmt.bnf", "//docs/generated/sql/bnf:rollback_transaction.bnf", "//docs/generated/sql/bnf:routine_body_stmt.bnf", "//docs/generated/sql/bnf:routine_return_stmt.bnf", diff --git a/pkg/kv/db.go b/pkg/kv/db.go index 97899c6435b2..22bfc3cebe08 100644 --- a/pkg/kv/db.go +++ b/pkg/kv/db.go @@ -1115,6 +1115,46 @@ func runTxn(ctx context.Context, txn *Txn, retryable func(context.Context, *Txn) return err } +// CommitPrepared commits the prepared transaction. +func (db *DB) CommitPrepared(ctx context.Context, txn *roachpb.Transaction) error { + return db.endPrepared(ctx, txn, true /* commit */) +} + +// RollbackPrepared rolls back the prepared transaction. +func (db *DB) RollbackPrepared(ctx context.Context, txn *roachpb.Transaction) error { + return db.endPrepared(ctx, txn, false /* commit */) +} + +func (db *DB) endPrepared(ctx context.Context, txn *roachpb.Transaction, commit bool) error { + if txn.Status != roachpb.PREPARED { + return errors.WithContextTags(errors.AssertionFailedf("transaction %v is not in a prepared state", txn), ctx) + } + if txn.Key == nil { + // If the transaction key is nil, the transaction was read-only and never + // wrote a transaction record when preparing. Committing or rolling back + // such a transaction is a no-op. + return nil + } + + // NOTE: an EndTxn sent to a prepared transaction does not need a deadline, + // because the commit deadline was already checked when the transaction was + // prepared and the transaction can not have been pushed to a later commit + // timestamp when prepared. + et := endTxnReq(commit, hlc.Timestamp{} /* deadline */) + et.req.Key = txn.Key + // TODO(nvanbenschoten): it's unfortunate that we have to set the txn's + // LockSpans here. cmd_end_transaction.go should be able to read them from the + // transaction record. Unfortunately, it currently doesn't. Address this + // before merging this commit. + et.req.LockSpans = txn.LockSpans + ba := &kvpb.BatchRequest{Requests: et.unionArr[:]} + ba.Txn = txn + // NOTE: bypass the CrossRangeTxnWrapperSender, which does not support + // transactional requests. Use the underlying sender directly. + _, pErr := db.sendUsingSender(ctx, ba, db.factory.NonTransactionalSender()) + return pErr.GoError() +} + // send runs the specified calls synchronously in a single batch and returns // any errors. Returns (nil, nil) for an empty batch. func (db *DB) send(ctx context.Context, ba *kvpb.BatchRequest) (*kvpb.BatchResponse, *kvpb.Error) { diff --git a/pkg/kv/kvclient/kvcoord/txn_coord_sender.go b/pkg/kv/kvclient/kvcoord/txn_coord_sender.go index 961cd7298bc1..00c204849d8d 100644 --- a/pkg/kv/kvclient/kvcoord/txn_coord_sender.go +++ b/pkg/kv/kvclient/kvcoord/txn_coord_sender.go @@ -63,6 +63,11 @@ const ( // batches except EndTxn(commit=false) will be rejected. txnError + // txnPrepared means that an EndTxn(commit=true,prepare=true) has been + // executed successfully. Further batches except EndTxn(commit=*) will + // be rejected. + txnPrepared + // txnFinalized means that an EndTxn(commit=true) has been executed // successfully, or an EndTxn(commit=false) was sent - regardless of // whether it executed successfully or not. Further batches except @@ -458,19 +463,23 @@ func (tc *TxnCoordSender) finalizeNonLockingTxnLocked( ba.Txn = txn return tc.updateStateLocked(ctx, ba, nil /* br */, pErr) } - // Mark the transaction as committed so that, in case this commit is done by - // the closure passed to db.Txn()), db.Txn() doesn't attempt to commit again. - // Also so that the correct metric gets incremented. - tc.mu.txn.Status = roachpb.COMMITTED tc.interceptorAlloc.txnMetricRecorder.setReadOnlyCommit() - } else { - tc.mu.txn.Status = roachpb.ABORTED - } - tc.finalizeAndCleanupTxnLocked(ctx) - if et.Commit { + if et.Prepare { + tc.mu.txn.Status = roachpb.PREPARED + tc.markTxnPreparedLocked(ctx) + } else { + // Mark the transaction as committed so that, in case this commit is done + // by the closure passed to db.Txn()), db.Txn() doesn't attempt to commit + // again. Also, so that the correct metric gets incremented. + tc.mu.txn.Status = roachpb.COMMITTED + tc.finalizeAndCleanupTxnLocked(ctx) + } if err := tc.maybeCommitWait(ctx, false /* deferred */); err != nil { return kvpb.NewError(err) } + } else { + tc.mu.txn.Status = roachpb.ABORTED + tc.finalizeAndCleanupTxnLocked(ctx) } return nil } @@ -541,16 +550,22 @@ func (tc *TxnCoordSender) Send( pErr = tc.updateStateLocked(ctx, ba, br, pErr) // If we succeeded to commit, or we attempted to rollback, we move to - // txnFinalized. + // txnFinalized. If we succeeded to prepare, we move to txnPrepared. if req, ok := ba.GetArg(kvpb.EndTxn); ok { et := req.(*kvpb.EndTxnRequest) - if (et.Commit && pErr == nil) || !et.Commit { - tc.finalizeAndCleanupTxnLocked(ctx) - if et.Commit { + if et.Commit { + if pErr == nil { + if et.Prepare { + tc.markTxnPreparedLocked(ctx) + } else { + tc.finalizeAndCleanupTxnLocked(ctx) + } if err := tc.maybeCommitWait(ctx, false /* deferred */); err != nil { return nil, kvpb.NewError(err) } } + } else /* !et.Commit */ { + tc.finalizeAndCleanupTxnLocked(ctx) } } @@ -635,8 +650,8 @@ func (tc *TxnCoordSender) Send( // For more, see https://www.cockroachlabs.com/blog/consistency-model/ and // docs/RFCS/20200811_non_blocking_txns.md. func (tc *TxnCoordSender) maybeCommitWait(ctx context.Context, deferred bool) error { - if tc.mu.txn.Status != roachpb.COMMITTED { - log.Fatalf(ctx, "maybeCommitWait called when not committed") + if tc.mu.txn.Status != roachpb.PREPARED && tc.mu.txn.Status != roachpb.COMMITTED { + log.Fatalf(ctx, "maybeCommitWait called when not prepared/committed") } if tc.mu.commitWaitDeferred && !deferred { // If this is an automatic commit-wait call and the user of this @@ -732,6 +747,15 @@ func (tc *TxnCoordSender) maybeRejectClientLocked( return kvpb.NewError(tc.mu.storedRetryableErr) case txnError: return tc.mu.storedErr + case txnPrepared: + endTxn := ba != nil && ba.IsSingleEndTxnRequest() + if endTxn { + return nil + } + msg := redact.Sprintf("client already prepared the transaction. "+ + "Trying to execute: %s", ba.Summary()) + reason := kvpb.TransactionStatusError_REASON_UNKNOWN + return kvpb.NewErrorWithTxn(kvpb.NewTransactionStatusError(reason, msg), &tc.mu.txn) case txnFinalized: msg := redact.Sprintf("client already committed or rolled back the transaction. "+ "Trying to execute: %s", ba.Summary()) @@ -789,6 +813,13 @@ func (tc *TxnCoordSender) finalizeAndCleanupTxnLocked(ctx context.Context) { tc.cleanupTxnLocked(ctx) } +// markTxnPreparedLocked marks the transaction state as prepared and closes all +// interceptors. +func (tc *TxnCoordSender) markTxnPreparedLocked(ctx context.Context) { + tc.mu.txnState = txnPrepared + tc.cleanupTxnLocked(ctx) +} + // cleanupTxnLocked closes all the interceptors. func (tc *TxnCoordSender) cleanupTxnLocked(ctx context.Context) { if tc.mu.closed { diff --git a/pkg/kv/kvclient/kvcoord/txn_interceptor_committer.go b/pkg/kv/kvclient/kvcoord/txn_interceptor_committer.go index 282fc8587d08..0afc7ea87942 100644 --- a/pkg/kv/kvclient/kvcoord/txn_interceptor_committer.go +++ b/pkg/kv/kvclient/kvcoord/txn_interceptor_committer.go @@ -207,6 +207,9 @@ func (tc *txnCommitter) SendLocked( switch br.Txn.Status { case roachpb.STAGING: // Continue with STAGING-specific validation and cleanup. + case roachpb.PREPARED: + // The transaction is prepared. + return br, nil case roachpb.COMMITTED: // The transaction is explicitly committed. This is possible if all // in-flight writes were sent to the same range as the EndTxn request, @@ -353,6 +356,11 @@ func (tc *txnCommitter) canCommitInParallel(ba *kvpb.BatchRequest, et *kvpb.EndT return false } + // We don't support a parallel prepare. + if et.Prepare { + return false + } + // If the transaction has a commit trigger, we don't allow it to commit in // parallel with writes. There's no fundamental reason for this restriction, // but for now it's not worth the complication. diff --git a/pkg/kv/kvclient/kvcoord/txn_interceptor_committer_test.go b/pkg/kv/kvclient/kvcoord/txn_interceptor_committer_test.go index 8065fda16ce5..dc8496ad05fb 100644 --- a/pkg/kv/kvclient/kvcoord/txn_interceptor_committer_test.go +++ b/pkg/kv/kvclient/kvcoord/txn_interceptor_committer_test.go @@ -243,6 +243,35 @@ func TestTxnCommitterStripsInFlightWrites(t *testing.T) { require.Nil(t, pErr) require.NotNil(t, br) + // Send the same batch but with an EndTxn with the Prepare flag set. In-flight + // writes should not be attached because the XA two-phase commit protocol + // disables parallel commits. + ba.Requests = nil + etArgsPrepare := etArgs + etArgsPrepare.Prepare = true + ba.Add(&putArgs, &qiArgs, &etArgsPrepare) + + mockSender.MockSend(func(ba *kvpb.BatchRequest) (*kvpb.BatchResponse, *kvpb.Error) { + require.Len(t, ba.Requests, 3) + require.IsType(t, &kvpb.EndTxnRequest{}, ba.Requests[2].GetInner()) + + et := ba.Requests[2].GetInner().(*kvpb.EndTxnRequest) + require.True(t, et.Commit) + require.True(t, et.Prepare) + require.Len(t, et.LockSpans, 2) + require.Equal(t, []roachpb.Span{{Key: keyA}, {Key: keyB}}, et.LockSpans) + require.Len(t, et.InFlightWrites, 0) + + br = ba.CreateReply() + br.Txn = ba.Txn + br.Txn.Status = roachpb.PREPARED + return br, nil + }) + + br, pErr = tc.SendLocked(ctx, ba) + require.Nil(t, pErr) + require.NotNil(t, br) + // Send the same batch but with an EndTxn containing a commit trigger. // In-flight writes should not be attached because commit triggers disable // parallel commits. diff --git a/pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go b/pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go index 45a9795fbbd2..949173bbf320 100644 --- a/pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go +++ b/pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go @@ -444,13 +444,22 @@ func (h *txnHeartbeater) heartbeat(ctx context.Context) bool { // Returns true if heartbeating should continue, false if the transaction is no // longer Pending and so there's no point in heartbeating further. func (h *txnHeartbeater) heartbeatLocked(ctx context.Context) bool { - if h.mu.txn.Status != roachpb.PENDING { - if h.mu.txn.Status == roachpb.COMMITTED { - log.Fatalf(ctx, "txn committed but heartbeat loop hasn't been signaled to stop: %s", h.mu.txn) - } + switch h.mu.txn.Status { + case roachpb.PENDING: + // Continue heartbeating. + case roachpb.PREPARED: + // If the transaction is prepared, there's no point in heartbeating. The + // transaction will remain active without heartbeats until it is committed + // or rolled back. + return false + case roachpb.ABORTED: // If the transaction is aborted, there's no point in heartbeating. The // client needs to send a rollback. return false + case roachpb.COMMITTED: + log.Fatalf(ctx, "txn committed but heartbeat loop hasn't been signaled to stop: %s", h.mu.txn) + default: + log.Fatalf(ctx, "unexpected txn status in heartbeat loop: %s", h.mu.txn) } // Clone the txn in order to put it in the heartbeat request. diff --git a/pkg/kv/kvclient/kvcoord/txn_interceptor_metric_recorder.go b/pkg/kv/kvclient/kvcoord/txn_interceptor_metric_recorder.go index ce4b1c5e6fb1..5252a3497f14 100644 --- a/pkg/kv/kvclient/kvcoord/txn_interceptor_metric_recorder.go +++ b/pkg/kv/kvclient/kvcoord/txn_interceptor_metric_recorder.go @@ -134,5 +134,7 @@ func (m *txnMetricRecorder) closeLocked() { // Note that successful read-only txn are also counted as committed, even // though they never had a txn record. m.metrics.Commits.Inc(1) + case roachpb.PREPARED: + m.metrics.Prepares.Inc(1) } } diff --git a/pkg/kv/kvclient/kvcoord/txn_metrics.go b/pkg/kv/kvclient/kvcoord/txn_metrics.go index 95f152c58912..546b0ba0189c 100644 --- a/pkg/kv/kvclient/kvcoord/txn_metrics.go +++ b/pkg/kv/kvclient/kvcoord/txn_metrics.go @@ -26,6 +26,7 @@ type TxnMetrics struct { ParallelCommits *metric.Counter // Commits which entered the STAGING state ParallelCommitAutoRetries *metric.Counter // Commits which were retried after entering the STAGING state CommitWaits *metric.Counter // Commits that waited for linearizability + Prepares *metric.Counter ClientRefreshSuccess *metric.Counter ClientRefreshFail *metric.Counter @@ -105,6 +106,12 @@ var ( Measurement: "KV Transactions", Unit: metric.Unit_COUNT, } + metaPreparesRates = metric.Metadata{ + Name: "txn.prepares", + Help: "Number of prepared KV transactions", + Measurement: "KV Transactions", + Unit: metric.Unit_COUNT, + } metaClientRefreshSuccess = metric.Metadata{ Name: "txn.refresh.success", Help: "Number of successful client-side transaction refreshes. A refresh may be " + @@ -294,6 +301,7 @@ func MakeTxnMetrics(histogramWindow time.Duration) TxnMetrics { ParallelCommits: metric.NewCounter(metaParallelCommitsRates), ParallelCommitAutoRetries: metric.NewCounter(metaParallelCommitAutoRetries), CommitWaits: metric.NewCounter(metaCommitWaitCount), + Prepares: metric.NewCounter(metaPreparesRates), ClientRefreshSuccess: metric.NewCounter(metaClientRefreshSuccess), ClientRefreshFail: metric.NewCounter(metaClientRefreshFail), ClientRefreshFailWithCondensedSpans: metric.NewCounter(metaClientRefreshFailWithCondensedSpans), diff --git a/pkg/kv/kvclient/kvcoord/txn_test.go b/pkg/kv/kvclient/kvcoord/txn_test.go index 17c301561624..d218fd2ed083 100644 --- a/pkg/kv/kvclient/kvcoord/txn_test.go +++ b/pkg/kv/kvclient/kvcoord/txn_test.go @@ -495,30 +495,36 @@ func TestTxnReadCommittedPerStatementReadSnapshot(t *testing.T) { func TestTxnWriteReadConflict(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) + s := createTestDB(t) + defer s.Stop() + ctx := context.Background() run := func(t *testing.T, writeIsoLevel, readIsoLevel isolation.Level) { - s := createTestDB(t) - defer s.Stop() - ctx := context.Background() + key := fmt.Sprintf("key-%s-%s", writeIsoLevel, readIsoLevel) - // Begin the test's writer and reader transactions. + // Begin the test's writer transaction. writeTxn := s.DB.NewTxn(ctx, "writer") require.NoError(t, writeTxn.SetIsoLevel(writeIsoLevel)) + + // Perform a write to key in the writer transaction. + require.NoError(t, writeTxn.Put(ctx, key, "value")) + + // Begin the test's reader transaction. + // NOTE: we do this after the write because if the writer is Read Committed, + // it will select a new write timestamp on each batch. We want the reader's + // read timestamp to be above the writer's write timestamp. readTxn := s.DB.NewTxn(ctx, "reader") require.NoError(t, readTxn.SetIsoLevel(readIsoLevel)) - // Perform a write to key "a" in the writer transaction. - require.NoError(t, writeTxn.Put(ctx, "a", "value")) - - // Read from key "a" in the reader transaction. + // Read from key in the reader transaction. expBlocking := writeIsoLevel == isolation.Serializable && readIsoLevel == isolation.Serializable readCtx := ctx if expBlocking { var cancel func() - readCtx, cancel = context.WithTimeout(ctx, 500*time.Millisecond) + readCtx, cancel = context.WithTimeout(ctx, 50*time.Millisecond) defer cancel() } - res, err := readTxn.Get(readCtx, "a") + res, err := readTxn.Get(readCtx, key) // Verify the expected blocking behavior. if expBlocking { @@ -1401,3 +1407,127 @@ func TestTxnUpdateFromTxnRecordDoesNotOverwriteFields(t *testing.T) { // OmitInRangefeeds is still true. require.True(t, txn.GetOmitInRangefeeds()) } + +// TestTxnPrepare tests that a transaction can be prepared and committed or +// rolled back. +// +// The test exercises both methods of finalizing a prepared transaction: +// - using the DB methods CommitPrepared and RollbackPrepared +// - using the Txn methods Commit and Rollback +// +// The test also exercises all combinations of isolation levels, read-only vs. +// read-write, and commit vs. rollback. +func TestTxnPrepare(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + ctx := context.Background() + s := createTestDB(t) + defer s.Stop() + + run := func(t *testing.T, isoLevel isolation.Level, readOnly, withProto, commit bool) { + key := fmt.Sprintf("key-%s-%t-%t-%t", isoLevel, readOnly, withProto, commit) + txn := s.DB.NewTxn(ctx, "test txn") + require.NoError(t, txn.SetIsoLevel(isoLevel)) + + var err error + if readOnly { + _, err = txn.Get(ctx, key) + } else { + err = txn.Put(ctx, key, "value") + } + require.NoError(t, err) + + err = txn.Prepare(ctx) + require.NoError(t, err) + require.False(t, txn.IsOpen()) + require.False(t, txn.IsCommitted()) + require.False(t, txn.IsAborted()) + require.True(t, txn.IsPrepared()) + + if withProto { + txnPrepared := txn.TestingCloneTxn() + require.Equal(t, roachpb.PREPARED, txnPrepared.Status) + + if commit { + err = s.DB.CommitPrepared(ctx, txnPrepared) + } else { + err = s.DB.RollbackPrepared(ctx, txnPrepared) + } + } else { + if commit { + err = txn.Commit(ctx) + } else { + err = txn.Rollback(ctx) + } + } + require.NoError(t, err) + + if !readOnly { + res, err := s.DB.Get(ctx, key) + require.NoError(t, err) + require.Equal(t, commit, res.Exists()) + } + } + + isolation.RunEachLevel(t, func(t *testing.T, isoLevel isolation.Level) { + testutils.RunTrueAndFalse(t, "readOnly", func(t *testing.T, readOnly bool) { + testutils.RunTrueAndFalse(t, "withProto", func(t *testing.T, withProto bool) { + testutils.RunTrueAndFalse(t, "commit", func(t *testing.T, commit bool) { + run(t, isoLevel, readOnly, withProto, commit) + }) + }) + }) + }) +} + +// TestTxnPreparedWriteReadConflict verifies that write-read conflicts with a +// prepared writer are blocking to the reader until the writer is committed or +// rolled back, regardless of isolation level. +func TestTxnPreparedWriteReadConflict(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + s := createTestDB(t) + defer s.Stop() + ctx := context.Background() + + run := func(t *testing.T, writeIsoLevel, readIsoLevel isolation.Level) { + key := fmt.Sprintf("key-%s-%s", writeIsoLevel, readIsoLevel) + + // Begin the test's writer transaction. + writeTxn := s.DB.NewTxn(ctx, "writer") + require.NoError(t, writeTxn.SetIsoLevel(writeIsoLevel)) + + // Perform a write to key in the writer transaction. + require.NoError(t, writeTxn.Put(ctx, key, "value")) + + // Prepare the writer transaction. + err := writeTxn.Prepare(ctx) + require.NoError(t, err) + + // Begin the test's reader transaction. + // NOTE: we do this after the write and prepare because if the writer is Read Committed, + // it will select a new write timestamp on each batch. We want the reader's + // read timestamp to be above the writer's write timestamp. + readTxn := s.DB.NewTxn(ctx, "reader") + require.NoError(t, readTxn.SetIsoLevel(readIsoLevel)) + + // Read from key in the reader transaction. + readCtx, cancel := context.WithTimeout(ctx, 50*time.Millisecond) + defer cancel() + _, err = readTxn.Get(readCtx, key) + + // Verify the expected blocking behavior. + require.Error(t, err) + require.ErrorIs(t, err, context.DeadlineExceeded) + + require.NoError(t, writeTxn.Rollback(ctx)) + require.NoError(t, readTxn.Rollback(ctx)) + } + + for _, writeIsoLevel := range isolation.Levels() { + for _, readIsoLevel := range isolation.Levels() { + name := fmt.Sprintf("writeIso=%s,readIso=%s", writeIsoLevel, readIsoLevel) + t.Run(name, func(t *testing.T) { run(t, writeIsoLevel, readIsoLevel) }) + } + } +} diff --git a/pkg/kv/kvclient/kvcoord/txnstate_string.go b/pkg/kv/kvclient/kvcoord/txnstate_string.go index af3e23e5565f..f02fc0b2a4de 100644 --- a/pkg/kv/kvclient/kvcoord/txnstate_string.go +++ b/pkg/kv/kvclient/kvcoord/txnstate_string.go @@ -11,7 +11,8 @@ func _() { _ = x[txnPending-0] _ = x[txnRetryableError-1] _ = x[txnError-2] - _ = x[txnFinalized-3] + _ = x[txnPrepared-3] + _ = x[txnFinalized-4] } func (i txnState) String() string { @@ -22,6 +23,8 @@ func (i txnState) String() string { return "txnRetryableError" case txnError: return "txnError" + case txnPrepared: + return "txnPrepared" case txnFinalized: return "txnFinalized" default: diff --git a/pkg/kv/kvpb/api.proto b/pkg/kv/kvpb/api.proto index 2e668ff73602..910a8c46282e 100644 --- a/pkg/kv/kvpb/api.proto +++ b/pkg/kv/kvpb/api.proto @@ -966,6 +966,16 @@ message EndTxnRequest { // from the TxnCoordSender on a failed heartbeat. It should only be set to // true when commit=false. bool poison = 9; + // Prepare, if true, causes the end transaction to proceed as though + // committing, but the transaction state is set to PREPARED instead of + // COMMITTED on success. If true, commit must be set to true as well. + // + // Prepare cannot be used in conjunction with the InFlightWrites field. + // All in-flight writes must be confirmed to have succeeded before the + // transaction can be prepared. + // + // The field is used to support the XA two-phase commit protocol. + bool prepare = 12; reserved 7, 8, 10; } diff --git a/pkg/kv/kvserver/batcheval/cmd_end_transaction.go b/pkg/kv/kvserver/batcheval/cmd_end_transaction.go index cd2e853fac93..df4666a98e12 100644 --- a/pkg/kv/kvserver/batcheval/cmd_end_transaction.go +++ b/pkg/kv/kvserver/batcheval/cmd_end_transaction.go @@ -251,7 +251,7 @@ func EndTxn( ms := cArgs.Stats reply := resp.(*kvpb.EndTxnResponse) - if err := VerifyTransaction(h, args, roachpb.PENDING, roachpb.STAGING, roachpb.ABORTED); err != nil { + if err := VerifyTransaction(h, args, roachpb.PENDING, roachpb.PREPARED, roachpb.STAGING, roachpb.ABORTED); err != nil { return result.Result{}, err } if args.Require1PC { @@ -263,6 +263,14 @@ func EndTxn( if args.Commit && args.Poison { return result.Result{}, errors.AssertionFailedf("cannot poison during a committing EndTxn request") } + if args.Prepare { + if !args.Commit { + return result.Result{}, errors.AssertionFailedf("cannot prepare a rollback") + } + if args.IsParallelCommit() { + return result.Result{}, errors.AssertionFailedf("cannot prepare a parallel commit") + } + } key := keys.TransactionKey(h.Txn.Key, h.Txn.ID) @@ -349,6 +357,16 @@ func EndTxn( "programming error: epoch regression: %d", h.Txn.Epoch) } + case roachpb.PREPARED: + if h.Txn.Epoch != reply.Txn.Epoch { + return result.Result{}, errors.AssertionFailedf( + "programming error: epoch mismatch with prepared transaction: %d != %d", h.Txn.Epoch, reply.Txn.Epoch) + } + if args.IsParallelCommit() { + return result.Result{}, errors.AssertionFailedf( + "programming error: cannot parallel commit a prepared transaction") + } + case roachpb.STAGING: if h.Txn.Epoch < reply.Txn.Epoch { return result.Result{}, errors.AssertionFailedf( @@ -378,6 +396,12 @@ func EndTxn( switch { case !recordAlreadyExisted, existingTxn.Status == roachpb.PENDING: BumpToMinTxnCommitTS(ctx, cArgs.EvalCtx, reply.Txn) + case existingTxn.Status == roachpb.PREPARED: + // Don't check timestamp cache. The transaction could not have been pushed + // while its record was in the PREPARED state. Furthermore, checking the + // timestamp cache and increasing the commit timestamp at this point would + // be incorrect, because the transaction must not fail to commit after + // being prepared. case existingTxn.Status == roachpb.STAGING: // Don't check timestamp cache. The transaction could not have been pushed // while its record was in the STAGING state so checking is unnecessary. @@ -397,6 +421,16 @@ func EndTxn( return result.Result{}, kvpb.NewTransactionRetryError(reason, extraMsg) } + // If the transaction is being prepared to commit, mark it as such. Do not + // proceed to release locks or resolve intents. + if args.Prepare { + reply.Txn.Status = roachpb.PREPARED + if err := updatePreparedTxn(ctx, readWriter, ms, key, args, reply.Txn); err != nil { + return result.Result{}, err + } + return result.Result{}, nil + } + // If the transaction needs to be staged as part of an implicit commit // before being explicitly committed, write the staged transaction // record and return without running commit triggers or resolving local @@ -463,6 +497,10 @@ func EndTxn( // we position the transaction record next to the first write of a transaction. // This avoids the need for the intentResolver to have to return to this range // to resolve locks for this transaction in the future. + // TODO(nvanbenschoten): clean up the handling of args and reply.Txn in these + // functions. Ideally, only reply.Txn would be passed through and fields from + // args would be extracted. This would help us re-use LockSpans from the txn + // record when they're not provided in args. resolvedLocks, releasedReplLocks, externalLocks, err := resolveLocalLocks( ctx, readWriter, cArgs.EvalCtx, ms, args, reply.Txn) if err != nil { @@ -718,6 +756,25 @@ func resolveLocalLocksWithPagination( return resolvedLocks, releasedReplLocks, externalLocks, nil } +// updatePreparedTxn persists the PREPARED transaction record with updated +// status (and possibly timestamp). It persists the record with all of the +// transaction's (local and remote) locks. +func updatePreparedTxn( + ctx context.Context, + readWriter storage.ReadWriter, + ms *enginepb.MVCCStats, + key []byte, + args *kvpb.EndTxnRequest, + txn *roachpb.Transaction, +) error { + txn.LockSpans = args.LockSpans + txn.InFlightWrites = nil + txnRecord := txn.AsRecord() + return storage.MVCCPutProto( + ctx, readWriter, key, hlc.Timestamp{}, &txnRecord, + storage.MVCCWriteOptions{Stats: ms, Category: fs.BatchEvalReadCategory}) +} + // updateStagingTxn persists the STAGING transaction record with updated status // (and possibly timestamp). It persists the record with the EndTxn request's // declared in-flight writes along with all of the transaction's (local and diff --git a/pkg/kv/kvserver/batcheval/cmd_end_transaction_test.go b/pkg/kv/kvserver/batcheval/cmd_end_transaction_test.go index bba1b2d9b881..26fc6e9a3af1 100644 --- a/pkg/kv/kvserver/batcheval/cmd_end_transaction_test.go +++ b/pkg/kv/kvserver/batcheval/cmd_end_transaction_test.go @@ -152,6 +152,8 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { restartedAndPushedHeaderTxn.WriteTimestamp.Forward(ts3) committedHeaderTxn := txn.Clone() committedHeaderTxn.Status = roachpb.COMMITTED + preparedHeaderTxn := txn.Clone() + preparedHeaderTxn.Status = roachpb.PREPARED pendingRecord := func() *roachpb.TransactionRecord { record := txn.AsRecord() @@ -177,6 +179,12 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { record.LockSpans = intents return &record }() + preparedRecord := func() *roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.PREPARED + record.LockSpans = intents + return &record + }() testCases := []struct { name string @@ -187,6 +195,7 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Request state. headerTxn *roachpb.Transaction commit bool + prepare bool noLockSpans bool inFlightWrites []roachpb.SequencedWrite deadline hlc.Timestamp @@ -252,6 +261,21 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", }, + { + // Either a PushTxn(ABORT) request succeeded or this is a replay + // and the transaction has already been finalized. Either way, + // the request isn't allowed to create a new transaction record. + name: "record missing, can't create, try prepare", + // Replica state. + existingTxn: nil, + canCreateTxn: false, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + }, { // Standard case where a transaction record is created during a // parallel commit. @@ -279,6 +303,20 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expTxn: committedRecord, }, + { + // Standard case where a transaction record is created in the prepared + // state during an XA two-phase commit. + name: "record missing, can create, try prepare", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: preparedRecord, + }, { // Standard case where a transaction record is created during a // parallel commit when all writes are still in-flight. @@ -316,6 +354,25 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // need to record any remote intents won't create it. expTxn: nil, }, + { + // Non-standard case where a transaction record is created during the + // prepare stage of an XA two-phase commit when there are no intents. + name: "record missing, can create, try prepare without intents", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + noLockSpans: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.LockSpans = nil + return &record + }(), + }, { // The transaction's commit timestamp was increased during its // lifetime, but it hasn't refreshed up to its new commit timestamp. @@ -345,6 +402,21 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", }, + { + // The transaction's commit timestamp was increased during its + // lifetime, but it hasn't refreshed up to its new commit timestamp. + // The prepare will be rejected. + name: "record missing, can create, try prepare at pushed timestamp", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + // Request state. + headerTxn: pushedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + }, { // The transaction's commit timestamp was increased during its // lifetime and it has refreshed up to this timestamp. The stage @@ -382,6 +454,25 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { return &record }(), }, + { + // The transaction's commit timestamp was increased during its + // lifetime and it has refreshed up to this timestamp. The prepare + // will succeed. + name: "record missing, can create, try prepare at pushed timestamp after refresh", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + // Request state. + headerTxn: refreshedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.WriteTimestamp.Forward(ts2) + return &record + }(), + }, { // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that the // transaction can be committed with. This will trigger a retry error. @@ -411,6 +502,22 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", }, + { + // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that the + // transaction can be committed (or prepared) with. This will trigger + // a retry error. + name: "record missing, can commit with min timestamp, try prepare", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + minTxnCommitTS: ts2, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + }, { // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that // the transaction can be committed with. Luckily, the transaction has @@ -450,6 +557,27 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { return &record }(), }, + { + // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that + // the transaction can be committed (or prepared) with. Luckily, the + // transaction has already refreshed above this time, so it can + // avoid a retry error. + name: "record missing, can commit with min timestamp, try prepare at pushed timestamp after refresh", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + minTxnCommitTS: ts2, + // Request state. + headerTxn: refreshedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.WriteTimestamp.Forward(ts2) + return &record + }(), + }, { // The transaction has run into a WriteTooOld error during its // lifetime. The stage will be rejected. @@ -470,7 +598,7 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { }, { // The transaction has run into a WriteTooOld error during its - // lifetime. The stage will be rejected. + // lifetime. The commit will be rejected. name: "record missing, can create, try commit after write too old", // Replica state. existingTxn: nil, @@ -485,6 +613,24 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_WRITE_TOO_OLD)", }, + { + // The transaction has run into a WriteTooOld error during its + // lifetime. The prepare will be rejected. + name: "record missing, can create, try prepare after write too old", + // Replica state. + existingTxn: nil, + canCreateTxn: true, + // Request state. + headerTxn: func() *roachpb.Transaction { + clone := txn.Clone() + clone.WriteTooOld = true + return clone + }(), + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_WRITE_TOO_OLD)", + }, { // Standard case where a transaction is rolled back. The record // already exists because it has been heartbeated. @@ -523,6 +669,20 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expTxn: committedRecord, }, + { + // Standard case where a transaction record is updated to the prepared + // state during an XA two-phase commit. The record already exists because + // it has been heartbeated. + name: "record pending, try prepare", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: preparedRecord, + }, { // The transaction's commit timestamp was increased during its // lifetime, but it hasn't refreshed up to its new commit timestamp. @@ -550,6 +710,20 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", }, + { + // The transaction's commit timestamp was increased during its + // lifetime, but it hasn't refreshed up to its new commit timestamp. + // The prepare will be rejected. + name: "record pending, try prepare at pushed timestamp", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: pushedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + }, { // The transaction's commit timestamp was increased during its // lifetime and it has refreshed up to this timestamp. The stage @@ -585,6 +759,24 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { return &record }(), }, + { + // The transaction's commit timestamp was increased during its + // lifetime and it has refreshed up to this timestamp. The prepare + // will succeed. + name: "record pending, try prepare at pushed timestamp after refresh", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: refreshedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.WriteTimestamp.Forward(ts2) + return &record + }(), + }, { // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that the // transaction can be committed with. The record already exists because @@ -614,6 +806,21 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", }, + { + // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that the + // transaction can be committed with. The record already exists because + // it has been heartbeated. This will trigger a retry error. + name: "record pending, can commit with min timestamp, try prepare", + // Replica state. + existingTxn: pendingRecord, + minTxnCommitTS: ts2, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + }, { // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that // the transaction can be committed with. The record already exists @@ -653,6 +860,26 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { return &record }(), }, + { + // A PushTxn(TIMESTAMP) request bumped the minimum timestamp that the + // transaction can be committed (or prepared) with. The record already + // exists because it has been heartbeated. Luckily, the transaction has + // already refreshed above this time, so it can avoid a retry error. + name: "record pending, can commit with min timestamp, try prepare at pushed timestamp after refresh", + // Replica state. + existingTxn: pendingRecord, + minTxnCommitTS: ts2, + // Request state. + headerTxn: refreshedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.WriteTimestamp.Forward(ts2) + return &record + }(), + }, { // The transaction has run into a WriteTooOld error during its // lifetime. The stage will be rejected. @@ -672,7 +899,7 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { }, { // The transaction has run into a WriteTooOld error during its - // lifetime. The stage will be rejected. + // lifetime. The commit will be rejected. name: "record pending, try commit after write too old", // Replica state. existingTxn: pendingRecord, @@ -686,6 +913,23 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_WRITE_TOO_OLD)", }, + { + // The transaction has run into a WriteTooOld error during its + // lifetime. The prepare will be rejected. + name: "record pending, try prepare after write too old", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: func() *roachpb.Transaction { + clone := txn.Clone() + clone.WriteTooOld = true + return clone + }(), + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_WRITE_TOO_OLD)", + }, { // Standard case where a transaction is rolled back after it has // written a record at a lower epoch. The existing record is @@ -741,6 +985,25 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { return &record }(), }, + { + // Standard case where a transaction record is updated to the prepared + // state during an XA two-phase commit after it has written a record at a + // lower epoch. The existing record is upgraded. + name: "record pending, try prepare at higher epoch", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: restartedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.Epoch++ + record.WriteTimestamp.Forward(ts2) + return &record + }(), + }, { // The transaction's commit timestamp was increased during the // current epoch, but it hasn't refreshed up to its new commit @@ -768,6 +1031,20 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", }, + { + // The transaction's commit timestamp was increased during the + // current epoch, but it hasn't refreshed up to its new commit + // timestamp. The prepare will be rejected. + name: "record pending, try prepare at higher epoch and pushed timestamp", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: restartedAndPushedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + }, { // Standard case where a transaction is rolled back. The record // already exists because of a failed parallel commit attempt in @@ -969,6 +1246,76 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expTxn: abortedRecord, }, + { + // The transaction has been prepared. The client rolls it back. + name: "record prepared, try rollback", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: headerTxn, + commit: false, + // Expected result. + expTxn: abortedRecord, + }, + { + // The transaction has been prepared. The client commits it. + name: "record prepared, try rollback", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + // Expected result. + expTxn: committedRecord, + }, + { + // The transaction has been prepared. The client sends another prepare + // request. This is a no-op. + name: "record prepared, try re-prepare", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: preparedRecord, + }, + { + // The transaction has been prepared. The client rolls it back. + name: "record and header prepared, try rollback", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: preparedHeaderTxn, + commit: false, + // Expected result. + expTxn: abortedRecord, + }, + { + // The transaction has been prepared. The client commits it. + name: "record and header prepared, try rollback", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: preparedHeaderTxn, + commit: true, + // Expected result. + expTxn: committedRecord, + }, + { + // The transaction has been prepared. The client sends another prepare + // request. This is a no-op. + name: "record and header prepared, try re-prepare", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: preparedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expTxn: preparedRecord, + }, /////////////////////////////////////////////////////////////////////// // INVALID REQUEST ERROR CASES // /////////////////////////////////////////////////////////////////////// @@ -1015,6 +1362,44 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "programming error: epoch regression", }, + { + name: "record pending, try prepare at lower epoch", + // Replica state. + existingTxn: func() *roachpb.TransactionRecord { + record := *pendingRecord + record.Epoch++ + return &record + }(), + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "programming error: epoch regression", + }, + { + name: "record pending, try prepare without commit", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: headerTxn, + commit: false, + prepare: true, + // Expected result. + expError: "cannot prepare a rollback", + }, + { + name: "record pending, try prepare with in-flight writes", + // Replica state. + existingTxn: pendingRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + inFlightWrites: writes, + // Expected result. + expError: "cannot prepare a parallel commit", + }, { name: "record committed, try rollback", // Replica state. @@ -1087,6 +1472,128 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { // Expected result. expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", }, + { + name: "record aborted, try prepare", + // Replica state. + existingTxn: abortedRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + }, + { + name: "record prepared, try stage", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: headerTxn, + commit: true, + inFlightWrites: writes, + // Expected result. + expError: "cannot parallel commit a prepared transaction", + }, + { + name: "record prepared, try rollback at higher epoch", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: restartedHeaderTxn, + commit: false, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try stage at higher epoch", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: restartedHeaderTxn, + commit: true, + inFlightWrites: writes, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try commit at higher epoch", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: restartedHeaderTxn, + commit: true, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try re-prepare at higher epoch", + // Replica state. + existingTxn: preparedRecord, + // Request state. + headerTxn: restartedHeaderTxn, + commit: true, + prepare: true, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try rollback at lower epoch", + // Replica state. + existingTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.Epoch++ + return &record + }(), + // Request state. + headerTxn: headerTxn, + commit: false, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try stage at lower epoch", + // Replica state. + existingTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.Epoch++ + return &record + }(), + // Request state. + headerTxn: headerTxn, + commit: true, + inFlightWrites: writes, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try commit at lower epoch", + // Replica state. + existingTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.Epoch++ + return &record + }(), + // Request state. + headerTxn: headerTxn, + commit: true, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, + { + name: "record prepared, try re-prepare at lower epoch", + // Replica state. + existingTxn: func() *roachpb.TransactionRecord { + record := *preparedRecord + record.Epoch++ + return &record + }(), + // Request state. + headerTxn: headerTxn, + commit: true, + prepare: true, + // Expected result. + expError: "epoch mismatch with prepared transaction", + }, } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { @@ -1113,6 +1620,7 @@ func TestEndTxnUpdatesTransactionRecord(t *testing.T) { req := kvpb.EndTxnRequest{ RequestHeader: kvpb.RequestHeader{Key: txn.Key}, Commit: c.commit, + Prepare: c.prepare, InFlightWrites: c.inFlightWrites, Deadline: c.deadline, diff --git a/pkg/kv/kvserver/batcheval/cmd_heartbeat_txn.go b/pkg/kv/kvserver/batcheval/cmd_heartbeat_txn.go index 732e42b3850a..6fc39cebf58b 100644 --- a/pkg/kv/kvserver/batcheval/cmd_heartbeat_txn.go +++ b/pkg/kv/kvserver/batcheval/cmd_heartbeat_txn.go @@ -51,7 +51,7 @@ func HeartbeatTxn( h := cArgs.Header reply := resp.(*kvpb.HeartbeatTxnResponse) - if err := VerifyTransaction(h, args, roachpb.PENDING, roachpb.STAGING); err != nil { + if err := VerifyTransaction(h, args, roachpb.PENDING, roachpb.PREPARED, roachpb.STAGING); err != nil { return result.Result{}, err } diff --git a/pkg/kv/kvserver/batcheval/cmd_push_txn.go b/pkg/kv/kvserver/batcheval/cmd_push_txn.go index b198a10f5725..278d5bd9f188 100644 --- a/pkg/kv/kvserver/batcheval/cmd_push_txn.go +++ b/pkg/kv/kvserver/batcheval/cmd_push_txn.go @@ -310,6 +310,10 @@ func PushTxn( // Determine what to do with the pushee, based on the push type. switch pushType { case kvpb.PUSH_ABORT: + if reply.PusheeTxn.Status == roachpb.PREPARED { + return result.Result{}, errors.AssertionFailedf( + "PUSH_ABORT succeeded against a PREPARED txn: %+v", existTxn) + } // If aborting the transaction, set the new status. reply.PusheeTxn.Status = roachpb.ABORTED // Forward the timestamp to accommodate AbortSpan GC. See method comment for diff --git a/pkg/kv/kvserver/batcheval/cmd_recover_txn.go b/pkg/kv/kvserver/batcheval/cmd_recover_txn.go index 369994327e72..fd89d420e359 100644 --- a/pkg/kv/kvserver/batcheval/cmd_recover_txn.go +++ b/pkg/kv/kvserver/batcheval/cmd_recover_txn.go @@ -113,7 +113,7 @@ func RecoverTxn( // changed its epoch or timestamp, and the only other valid status // for it to have is COMMITTED. switch reply.RecoveredTxn.Status { - case roachpb.PENDING, roachpb.ABORTED: + case roachpb.PENDING, roachpb.PREPARED, roachpb.ABORTED: // Once implicitly committed, the transaction should never move back // to the PENDING status and it should never be ABORTED. // @@ -175,7 +175,7 @@ func RecoverTxn( // query then we could assert that the transaction record can only be // COMMITTED if legalChange=true. return result.Result{}, nil - case roachpb.PENDING: + case roachpb.PENDING, roachpb.PREPARED: if args.Txn.Epoch < reply.RecoveredTxn.Epoch { // Recovery not immediately needed because the transaction is // still in progress. @@ -186,8 +186,8 @@ func RecoverTxn( // ever be launched for a STAGING transaction and it is not possible for // a transaction to move back to the PENDING status in the same epoch. return result.Result{}, errors.AssertionFailedf( - "programming error: cannot recover PENDING transaction in same epoch: %s", reply.RecoveredTxn, - ) + "programming error: cannot recover %s transaction in same epoch: %s", + reply.RecoveredTxn.Status, reply.RecoveredTxn) case roachpb.STAGING: if legalChange { // Recovery not immediately needed because the transaction is diff --git a/pkg/kv/kvserver/batcheval/transaction.go b/pkg/kv/kvserver/batcheval/transaction.go index d349e92ef5d5..7b8a8183a9db 100644 --- a/pkg/kv/kvserver/batcheval/transaction.go +++ b/pkg/kv/kvserver/batcheval/transaction.go @@ -129,6 +129,12 @@ func CanCreateTxnRecord(ctx context.Context, rec EvalContext, txn *roachpb.Trans log.VEventf(ctx, 2, "txn tombstone present; transaction has been aborted") return kvpb.NewTransactionAbortedError(reason) } + // Verify that if the transaction record is being created, the client thinks + // it's in the PENDING state. + if txn.Status != roachpb.PENDING { + return errors.AssertionFailedf( + "cannot create transaction record with non-PENDING transaction: %v", txn) + } return nil } diff --git a/pkg/kv/kvserver/gc/gc.go b/pkg/kv/kvserver/gc/gc.go index bc2b9997fc7f..9e6e5678bfa6 100644 --- a/pkg/kv/kvserver/gc/gc.go +++ b/pkg/kv/kvserver/gc/gc.go @@ -227,6 +227,7 @@ type Info struct { // potentially necessary intent resolutions did not fail). TransactionSpanGCAborted, TransactionSpanGCCommitted int TransactionSpanGCStaging, TransactionSpanGCPending int + TransactionSpanGCPrepared int // AbortSpanTotal is the total number of transactions present in the AbortSpan. AbortSpanTotal int // AbortSpanConsidered is the number of AbortSpan entries old enough to be @@ -1222,6 +1223,8 @@ func processLocalKeyRange( switch txn.Status { case roachpb.PENDING: info.TransactionSpanGCPending++ + case roachpb.PREPARED: + info.TransactionSpanGCPrepared++ case roachpb.STAGING: info.TransactionSpanGCStaging++ case roachpb.ABORTED: diff --git a/pkg/kv/kvserver/metrics.go b/pkg/kv/kvserver/metrics.go index ad7d95630cd7..5d2524332c6b 100644 --- a/pkg/kv/kvserver/metrics.go +++ b/pkg/kv/kvserver/metrics.go @@ -2087,6 +2087,12 @@ The messages are dropped to help these replicas to recover from I/O overload.`, Measurement: "Txn Entries", Unit: metric.Unit_COUNT, } + metaGCTransactionSpanGCPrepared = metric.Metadata{ + Name: "queue.gc.info.transactionspangcprepared", + Help: "Number of GC'able entries corresponding to prepared txns", + Measurement: "Txn Entries", + Unit: metric.Unit_COUNT, + } metaGCAbortSpanScanned = metric.Metadata{ Name: "queue.gc.info.abortspanscanned", Help: "Number of transactions present in the AbortSpan scanned from the engine", @@ -2864,6 +2870,7 @@ type StoreMetrics struct { GCTransactionSpanGCCommitted *metric.Counter GCTransactionSpanGCStaging *metric.Counter GCTransactionSpanGCPending *metric.Counter + GCTransactionSpanGCPrepared *metric.Counter GCAbortSpanScanned *metric.Counter GCAbortSpanConsidered *metric.Counter GCAbortSpanGCNum *metric.Counter @@ -3629,6 +3636,7 @@ func newStoreMetrics(histogramWindow time.Duration) *StoreMetrics { GCTransactionSpanGCCommitted: metric.NewCounter(metaGCTransactionSpanGCCommitted), GCTransactionSpanGCStaging: metric.NewCounter(metaGCTransactionSpanGCStaging), GCTransactionSpanGCPending: metric.NewCounter(metaGCTransactionSpanGCPending), + GCTransactionSpanGCPrepared: metric.NewCounter(metaGCTransactionSpanGCPrepared), GCAbortSpanScanned: metric.NewCounter(metaGCAbortSpanScanned), GCAbortSpanConsidered: metric.NewCounter(metaGCAbortSpanConsidered), GCAbortSpanGCNum: metric.NewCounter(metaGCAbortSpanGCNum), diff --git a/pkg/kv/kvserver/mvcc_gc_queue.go b/pkg/kv/kvserver/mvcc_gc_queue.go index 9f24b7c4456b..70f5fa0b186b 100644 --- a/pkg/kv/kvserver/mvcc_gc_queue.go +++ b/pkg/kv/kvserver/mvcc_gc_queue.go @@ -846,6 +846,7 @@ func updateStoreMetricsWithGCInfo(metrics *StoreMetrics, info gc.Info) { metrics.GCTransactionSpanGCCommitted.Inc(int64(info.TransactionSpanGCCommitted)) metrics.GCTransactionSpanGCStaging.Inc(int64(info.TransactionSpanGCStaging)) metrics.GCTransactionSpanGCPending.Inc(int64(info.TransactionSpanGCPending)) + metrics.GCTransactionSpanGCPrepared.Inc(int64(info.TransactionSpanGCPrepared)) metrics.GCAbortSpanScanned.Inc(int64(info.AbortSpanTotal)) metrics.GCAbortSpanConsidered.Inc(int64(info.AbortSpanConsidered)) metrics.GCAbortSpanGCNum.Inc(int64(info.AbortSpanGCNum)) diff --git a/pkg/kv/kvserver/rangefeed/task.go b/pkg/kv/kvserver/rangefeed/task.go index b82838d583b0..9fa7f23c5da9 100644 --- a/pkg/kv/kvserver/rangefeed/task.go +++ b/pkg/kv/kvserver/rangefeed/task.go @@ -280,7 +280,7 @@ func (a *txnPushAttempt) pushOldTxns(ctx context.Context) error { var intentsToCleanup []roachpb.LockUpdate for i, txn := range pushedTxns { switch txn.Status { - case roachpb.PENDING, roachpb.STAGING: + case roachpb.PENDING, roachpb.PREPARED, roachpb.STAGING: // The transaction is still in progress but its timestamp was moved // forward to the current time. Inform the Processor that it can // forward the txn's timestamp in its unresolvedIntentQueue. diff --git a/pkg/kv/kvserver/replica.go b/pkg/kv/kvserver/replica.go index bcbbc4b91b59..38d29f279a56 100644 --- a/pkg/kv/kvserver/replica.go +++ b/pkg/kv/kvserver/replica.go @@ -2260,9 +2260,6 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) { var mergeCommitted bool switch pushTxnRes.PusheeTxn.Status { - case roachpb.PENDING, roachpb.STAGING: - log.Fatalf(ctx, "PushTxn returned while merge transaction %s was still %s", - intentRes.Intent.Txn.ID.Short(), pushTxnRes.PusheeTxn.Status) case roachpb.COMMITTED: // If PushTxn claims that the transaction committed, then the transaction // definitely committed. @@ -2317,6 +2314,9 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) { mergeCommitted = true } } + default: + log.Fatalf(ctx, "PushTxn returned while merge transaction %s was still %s", + intentRes.Intent.Txn.ID.Short(), pushTxnRes.PusheeTxn.Status) } r.raftMu.Lock() r.readOnlyCmdMu.Lock() diff --git a/pkg/kv/kvserver/replica_test.go b/pkg/kv/kvserver/replica_test.go index 0d2e74e3b1ac..2f10557fbee2 100644 --- a/pkg/kv/kvserver/replica_test.go +++ b/pkg/kv/kvserver/replica_test.go @@ -11930,6 +11930,15 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { // The transaction record will be eagerly GC-ed. expTxn: noTxnRecord, }, + { + name: "end transaction (prepare)", + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expTxn: txnWithStatus(roachpb.PREPARED), + }, { name: "push transaction (timestamp)", run: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { @@ -12051,6 +12060,19 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { // The transaction record will be eagerly GC-ed. expTxn: noTxnRecord, }, + { + name: "end transaction (prepare) after heartbeat transaction", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, txn.MinTimestamp) + return sendWrappedWithErr(tc, hbH, &hb) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expTxn: txnWithStatus(roachpb.PREPARED), + }, { name: "push transaction (timestamp) after heartbeat transaction", setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { @@ -12430,6 +12452,22 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { expError: "TransactionAbortedError(ABORT_REASON_RECORD_ALREADY_WRITTEN_POSSIBLE_REPLAY)", expTxn: noTxnRecord, }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (prepare) after end transaction (abort)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_RECORD_ALREADY_WRITTEN_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, { name: "push transaction (timestamp) after end transaction (abort)", setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { @@ -12511,6 +12549,20 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { expError: "TransactionAbortedError(ABORT_REASON_RECORD_ALREADY_WRITTEN_POSSIBLE_REPLAY)", expTxn: noTxnRecord, }, + { + name: "end transaction (prepare) after end transaction (commit)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_RECORD_ALREADY_WRITTEN_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, { name: "push transaction (timestamp) after end transaction (commit)", setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { @@ -12536,6 +12588,109 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { }, expTxn: noTxnRecord, }, + { + name: "heartbeat transaction after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(tc, hbH, &hb) + }, + expTxn: func(tc testContext, txn *roachpb.Transaction, hbTs hlc.Timestamp) roachpb.TransactionRecord { + record := txnWithStatus(roachpb.PREPARED)(tc, txn, hbTs) + record.LastHeartbeat.Forward(hbTs) + return record + }, + }, + { + name: "end transaction (stage) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.InFlightWrites = inFlightWrites + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "cannot parallel commit a prepared transaction", + expTxn: txnWithStatus(roachpb.PREPARED), + }, + { + name: "end transaction (abort) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (prepare) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expTxn: txnWithStatus(roachpb.PREPARED), + }, + { + name: "push transaction (timestamp) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(getTestPusher(tc), txn, kvpb.PUSH_TIMESTAMP) + pt.PushTo = now + return sendWrappedWithErr(tc, kvpb.Header{}, &pt) + }, + expError: "failed to push", + expTxn: txnWithStatus(roachpb.PREPARED), + }, + { + name: "push transaction (abort) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + pt := pushTxnArgs(getTestPusher(tc), txn, kvpb.PUSH_ABORT) + return sendWrappedWithErr(tc, kvpb.Header{}, &pt) + }, + expError: "failed to push", + expTxn: txnWithStatus(roachpb.PREPARED), + }, { name: "heartbeat transaction after push transaction (timestamp)", setup: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { @@ -12602,6 +12757,23 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { // if it hits a serializable retry error. expTxn: noTxnRecord, }, + { + name: "end transaction (prepare) after push transaction (timestamp)", + setup: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(getTestPusher(tc), txn, kvpb.PUSH_TIMESTAMP) + pt.PushTo = now + return sendWrappedWithErr(tc, kvpb.Header{}, &pt) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionRetryError: retry txn (RETRY_SERIALIZABLE)", + // The end transaction (prepare) does not write a transaction record + // if it hits a serializable retry error. + expTxn: noTxnRecord, + }, { name: "end transaction (one-phase commit) after push transaction (timestamp)", setup: func(tc testContext, txn *roachpb.Transaction, now hlc.Timestamp) error { @@ -12742,6 +12914,20 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", expTxn: noTxnRecord, }, + { + name: "end transaction (prepare) after push transaction (abort)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + pt := pushTxnArgs(getTestPusher(tc), txn, kvpb.PUSH_ABORT) + return sendWrappedWithErr(tc, kvpb.Header{}, &pt) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: noTxnRecord, + }, { // Should not be possible. name: "recover transaction (implicitly committed) after heartbeat transaction", @@ -12849,6 +13035,21 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { }, expTxn: noTxnRecord, }, + { + // Should not be possible. + name: "recover transaction (implicitly committed) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + rt := recoverTxnArgs(txn, true /* implicitlyCommitted */) + return sendWrappedWithErr(tc, kvpb.Header{}, &rt) + }, + expError: "found PREPARED record for implicitly committed transaction", + expTxn: txnWithStatus(roachpb.PREPARED), + }, { // Should not be possible. name: "recover transaction (not implicitly committed) after heartbeat transaction", @@ -12983,6 +13184,21 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { // the same assertion that it does in the case without eager gc. expTxn: noTxnRecord, }, + { + // Should not be possible. + name: "recover transaction (not implicitly committed) after end transaction (prepare)", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + rt := recoverTxnArgs(txn, false /* implicitlyCommitted */) + return sendWrappedWithErr(tc, kvpb.Header{}, &rt) + }, + expError: "cannot recover PREPARED transaction in same epoch", + expTxn: txnWithStatus(roachpb.PREPARED), + }, } testsWithoutEagerGC := []testCase{ { @@ -13118,6 +13334,22 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", expTxn: txnWithStatus(roachpb.ABORTED), }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (prepare) after end transaction (abort) without eager gc", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: txnWithStatus(roachpb.ABORTED), + }, { name: "push transaction (timestamp) after end transaction (abort) without eager gc", setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { @@ -13203,6 +13435,22 @@ func TestTxnRecordLifecycleTransitions(t *testing.T) { expError: "TransactionStatusError: already committed (REASON_TXN_COMMITTED)", expTxn: txnWithStatus(roachpb.COMMITTED), }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (prepare) after end transaction (commit) without eager gc", + setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(tc, etH, &et) + }, + run: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + et.Prepare = true + return sendWrappedWithErr(tc, etH, &et) + }, + expError: "TransactionStatusError: already committed (REASON_TXN_COMMITTED)", + expTxn: txnWithStatus(roachpb.COMMITTED), + }, { name: "push transaction (timestamp) after end transaction (commit) without eager gc", setup: func(tc testContext, txn *roachpb.Transaction, _ hlc.Timestamp) error { diff --git a/pkg/kv/kvserver/replica_tscache.go b/pkg/kv/kvserver/replica_tscache.go index 24c5aa98530e..261df78b56df 100644 --- a/pkg/kv/kvserver/replica_tscache.go +++ b/pkg/kv/kvserver/replica_tscache.go @@ -224,13 +224,17 @@ func (r *Replica) updateTimestampCache( var tombstone bool switch pushee.Status { - case roachpb.PENDING: + case roachpb.PENDING, roachpb.PREPARED: tombstone = false case roachpb.ABORTED: tombstone = true case roachpb.STAGING: // No need to update the timestamp cache. If a transaction // is in this state then it must have a transaction record. + // TODO(nvanbenschoten): is this correct? We don't allow a + // STAGING transaction to be pushed, so this might be dead code, + // but as of 3dbb321e, it seems like we should be updating the + // timestamp cache even if we have a transaction record continue case roachpb.COMMITTED: // No need to update the timestamp cache. It was already diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/admission_post_split_merge b/pkg/kv/kvserver/testdata/flow_control_integration/admission_post_split_merge index 87cf883bbef6..1fc1a9c3409a 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/admission_post_split_merge +++ b/pkg/kv/kvserver/testdata/flow_control_integration/admission_post_split_merge @@ -50,8 +50,8 @@ ORDER BY streams DESC; range_id | stream_count -----------+--------------- - 69 | 3 70 | 3 + 71 | 3 -- (Merging ranges.) @@ -81,7 +81,7 @@ ORDER BY streams DESC; range_id | stream_count -----------+--------------- - 69 | 3 + 70 | 3 -- (Allow below-raft admission to proceed.) diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/basic b/pkg/kv/kvserver/testdata/flow_control_integration/basic index a87990ecdd61..be7cd7632686 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/basic +++ b/pkg/kv/kvserver/testdata/flow_control_integration/basic @@ -42,7 +42,7 @@ ORDER BY streams DESC; range_id | stream_count -----------+--------------- - 69 | 3 + 70 | 3 -- Flow token metrics from n1 after issuing the regular 1MiB replicated write, diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/blocked_admission b/pkg/kv/kvserver/testdata/flow_control_integration/blocked_admission index 266191847de4..11c881e3214f 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/blocked_admission +++ b/pkg/kv/kvserver/testdata/flow_control_integration/blocked_admission @@ -28,9 +28,9 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 2 | 5.0 MiB - 69 | 3 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 2 | 5.0 MiB + 70 | 3 | 5.0 MiB -- Observe the individual tracked tokens per-stream on the scratch range. @@ -39,21 +39,21 @@ SELECT range_id, store_id, priority, crdb_internal.humanize_bytes(tokens::INT8) range_id | store_id | priority | tokens -----------+----------+------------+---------- - 69 | 1 | normal-pri | 1.0 MiB - 69 | 1 | normal-pri | 1.0 MiB - 69 | 1 | normal-pri | 1.0 MiB - 69 | 1 | normal-pri | 1.0 MiB - 69 | 1 | normal-pri | 1.0 MiB - 69 | 2 | normal-pri | 1.0 MiB - 69 | 2 | normal-pri | 1.0 MiB - 69 | 2 | normal-pri | 1.0 MiB - 69 | 2 | normal-pri | 1.0 MiB - 69 | 2 | normal-pri | 1.0 MiB - 69 | 3 | normal-pri | 1.0 MiB - 69 | 3 | normal-pri | 1.0 MiB - 69 | 3 | normal-pri | 1.0 MiB - 69 | 3 | normal-pri | 1.0 MiB - 69 | 3 | normal-pri | 1.0 MiB + 70 | 1 | normal-pri | 1.0 MiB + 70 | 1 | normal-pri | 1.0 MiB + 70 | 1 | normal-pri | 1.0 MiB + 70 | 1 | normal-pri | 1.0 MiB + 70 | 1 | normal-pri | 1.0 MiB + 70 | 2 | normal-pri | 1.0 MiB + 70 | 2 | normal-pri | 1.0 MiB + 70 | 2 | normal-pri | 1.0 MiB + 70 | 2 | normal-pri | 1.0 MiB + 70 | 2 | normal-pri | 1.0 MiB + 70 | 3 | normal-pri | 1.0 MiB + 70 | 3 | normal-pri | 1.0 MiB + 70 | 3 | normal-pri | 1.0 MiB + 70 | 3 | normal-pri | 1.0 MiB + 70 | 3 | normal-pri | 1.0 MiB -- (Allow below-raft admission to proceed.) diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/crashed_node b/pkg/kv/kvserver/testdata/flow_control_integration/crashed_node index cd656f2531b5..fdf9870913fe 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/crashed_node +++ b/pkg/kv/kvserver/testdata/flow_control_integration/crashed_node @@ -28,8 +28,8 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 2 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 2 | 5.0 MiB -- (Crashing n2 but disabling the raft-transport-break token return mechanism.) @@ -42,7 +42,7 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB + 70 | 1 | 5.0 MiB -- Flow token metrics from n1 after n2 crashed. Observe that we've returned the diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/granter_admit_one_by_one b/pkg/kv/kvserver/testdata/flow_control_integration/granter_admit_one_by_one index ecaf22eb8e58..c8e4297b348b 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/granter_admit_one_by_one +++ b/pkg/kv/kvserver/testdata/flow_control_integration/granter_admit_one_by_one @@ -28,9 +28,9 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 1.0 MiB - 69 | 2 | 1.0 MiB - 69 | 3 | 1.0 MiB + 70 | 1 | 1.0 MiB + 70 | 2 | 1.0 MiB + 70 | 3 | 1.0 MiB -- (Allow below-raft admission to proceed.) diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/raft_membership b/pkg/kv/kvserver/testdata/flow_control_integration/raft_membership index 437e878744e2..8f0f923f8923 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/raft_membership +++ b/pkg/kv/kvserver/testdata/flow_control_integration/raft_membership @@ -28,10 +28,10 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 1.0 MiB - 69 | 2 | 1.0 MiB - 69 | 3 | 1.0 MiB - 69 | 4 | 0 B + 70 | 1 | 1.0 MiB + 70 | 2 | 1.0 MiB + 70 | 3 | 1.0 MiB + 70 | 4 | 0 B -- (Issuing 1x1MiB, 4x replicated write that's not admitted.) @@ -45,10 +45,10 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 2.0 MiB - 69 | 2 | 2.0 MiB - 69 | 3 | 2.0 MiB - 69 | 4 | 1.0 MiB + 70 | 1 | 2.0 MiB + 70 | 2 | 2.0 MiB + 70 | 3 | 2.0 MiB + 70 | 4 | 1.0 MiB -- (Removing voting replica from n3.) @@ -69,10 +69,10 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 3.0 MiB - 69 | 2 | 3.0 MiB - 69 | 4 | 2.0 MiB - 69 | 5 | 1.0 MiB + 70 | 1 | 3.0 MiB + 70 | 2 | 3.0 MiB + 70 | 4 | 2.0 MiB + 70 | 5 | 1.0 MiB -- (Allow below-raft admission to proceed.) @@ -84,10 +84,10 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 0 B - 69 | 2 | 0 B - 69 | 4 | 0 B - 69 | 5 | 0 B + 70 | 1 | 0 B + 70 | 2 | 0 B + 70 | 4 | 0 B + 70 | 5 | 0 B -- Flow token metrics from n1 after work gets admitted. All {regular,elastic} diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/raft_snapshot b/pkg/kv/kvserver/testdata/flow_control_integration/raft_snapshot index e124e4a627e9..acbc2ebf1b55 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/raft_snapshot +++ b/pkg/kv/kvserver/testdata/flow_control_integration/raft_snapshot @@ -25,11 +25,11 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 1.0 MiB - 69 | 2 | 1.0 MiB - 69 | 3 | 1.0 MiB - 69 | 4 | 1.0 MiB - 69 | 5 | 1.0 MiB + 70 | 1 | 1.0 MiB + 70 | 2 | 1.0 MiB + 70 | 3 | 1.0 MiB + 70 | 4 | 1.0 MiB + 70 | 5 | 1.0 MiB -- (Killing n2 and n3, but preventing their tokens from being returned + @@ -45,11 +45,11 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 1.0 MiB - 69 | 2 | 1.0 MiB - 69 | 3 | 1.0 MiB - 69 | 4 | 1.0 MiB - 69 | 5 | 1.0 MiB + 70 | 1 | 1.0 MiB + 70 | 2 | 1.0 MiB + 70 | 3 | 1.0 MiB + 70 | 4 | 1.0 MiB + 70 | 5 | 1.0 MiB -- (Issuing another 1MiB of 5x replicated writes while n2 and n3 are down and @@ -84,11 +84,11 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 2.0 MiB - 69 | 2 | 2.0 MiB - 69 | 3 | 2.0 MiB - 69 | 4 | 2.0 MiB - 69 | 5 | 2.0 MiB + 70 | 1 | 2.0 MiB + 70 | 2 | 2.0 MiB + 70 | 3 | 2.0 MiB + 70 | 4 | 2.0 MiB + 70 | 5 | 2.0 MiB -- (Truncating raft log.) @@ -124,9 +124,9 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 2.0 MiB - 69 | 4 | 2.0 MiB - 69 | 5 | 2.0 MiB + 70 | 1 | 2.0 MiB + 70 | 4 | 2.0 MiB + 70 | 5 | 2.0 MiB -- (Allow below-raft admission to proceed.) @@ -164,11 +164,11 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 0 B - 69 | 2 | 0 B - 69 | 3 | 0 B - 69 | 4 | 0 B - 69 | 5 | 0 B + 70 | 1 | 0 B + 70 | 2 | 0 B + 70 | 3 | 0 B + 70 | 4 | 0 B + 70 | 5 | 0 B -- Another view of tokens, using /inspectz-backed vtables. diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_break b/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_break index f1bf6a3ae583..5673745ed7e3 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_break +++ b/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_break @@ -28,9 +28,9 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 2 | 5.0 MiB - 69 | 3 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 2 | 5.0 MiB + 70 | 3 | 5.0 MiB -- (Crashing n2 but disabling the last-updated token return mechanism.) @@ -44,8 +44,8 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 3 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 3 | 5.0 MiB -- Flow token metrics from n1 after n2 crashed. Observe that we've returned the diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_culled b/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_culled index 0050cd6e7aee..28d85e9325f9 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_culled +++ b/pkg/kv/kvserver/testdata/flow_control_integration/raft_transport_culled @@ -29,9 +29,9 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 2 | 5.0 MiB - 69 | 3 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 2 | 5.0 MiB + 70 | 3 | 5.0 MiB -- (Marking n2->n1 raft transport gRPC stream as idle.) @@ -46,8 +46,8 @@ SELECT range_id, store_id, crdb_internal.humanize_bytes(total_tracked_tokens::IN range_id | store_id | total_tracked_tokens -----------+----------+----------------------- - 69 | 1 | 5.0 MiB - 69 | 3 | 5.0 MiB + 70 | 1 | 5.0 MiB + 70 | 3 | 5.0 MiB -- Flow token metrics from n1 after n2->n1 raft transport stream is culled. diff --git a/pkg/kv/kvserver/testdata/flow_control_integration/split_merge b/pkg/kv/kvserver/testdata/flow_control_integration/split_merge index cbefd0d820cd..bb7b0645b083 100644 --- a/pkg/kv/kvserver/testdata/flow_control_integration/split_merge +++ b/pkg/kv/kvserver/testdata/flow_control_integration/split_merge @@ -49,8 +49,8 @@ ORDER BY streams DESC; range_id | stream_count -----------+--------------- - 69 | 3 70 | 3 + 71 | 3 -- (Merging ranges.) @@ -82,7 +82,7 @@ ORDER BY streams DESC; range_id | stream_count -----------+--------------- - 69 | 3 + 70 | 3 ---- ---- diff --git a/pkg/kv/kvserver/txnrecovery/manager.go b/pkg/kv/kvserver/txnrecovery/manager.go index ae0f4e510a26..315586e8dfc7 100644 --- a/pkg/kv/kvserver/txnrecovery/manager.go +++ b/pkg/kv/kvserver/txnrecovery/manager.go @@ -335,7 +335,7 @@ func (m *manager) updateMetrics() func(*roachpb.Transaction, error) { m.metrics.SuccessesAsCommitted.Inc(1) case roachpb.ABORTED: m.metrics.SuccessesAsAborted.Inc(1) - case roachpb.PENDING, roachpb.STAGING: + case roachpb.PENDING, roachpb.PREPARED, roachpb.STAGING: m.metrics.SuccessesAsPending.Inc(1) default: panic("unexpected") diff --git a/pkg/kv/kvserver/txnwait/queue.go b/pkg/kv/kvserver/txnwait/queue.go index c2583b8e107a..93528480b1bd 100644 --- a/pkg/kv/kvserver/txnwait/queue.go +++ b/pkg/kv/kvserver/txnwait/queue.go @@ -107,8 +107,24 @@ func CanPushWithPriority( pusherPri, pusheePri = normalize(pusherPri), normalize(pusheePri) switch pushType { case kvpb.PUSH_ABORT: + // If the pushee transaction is prepared, never let a PUSH_ABORT through. + // A prepared transaction must be guaranteed to succeed if it decides to + // commit. + if pusheeStatus == roachpb.PREPARED { + return false + } + + // Otherwise, let the ABORT through if the pusher has a higher priority. return pusherPri > pusheePri case kvpb.PUSH_TIMESTAMP: + // If the pushee transaction is prepared, never let a PUSH_TIMESTAMP through + // either. Even for isolation levels which tolerate write skew, this could + // prevent the transaction from committing due to schema-imposed commit + // deadlines. + if pusheeStatus == roachpb.PREPARED { + return false + } + // If the pushee transaction is STAGING, only let the PUSH_TIMESTAMP through // to disrupt the transaction commit if the pusher has a higher priority. If // the priorities are equal, the PUSH_TIMESTAMP should wait for the commit @@ -146,6 +162,10 @@ func isPushed(req *kvpb.PushTxnRequest, txn *roachpb.Transaction) bool { // TxnExpiration computes the timestamp after which the transaction will be // considered expired. func TxnExpiration(txn *roachpb.Transaction) hlc.Timestamp { + if txn.Status == roachpb.PREPARED { + // Prepared transactions have no expiration. + return hlc.MaxTimestamp + } return txn.LastActive().Add(TxnLivenessThreshold.Load(), 0) } diff --git a/pkg/kv/kvserver/txnwait/queue_test.go b/pkg/kv/kvserver/txnwait/queue_test.go index f7d77234ac10..90a94357642b 100644 --- a/pkg/kv/kvserver/txnwait/queue_test.go +++ b/pkg/kv/kvserver/txnwait/queue_test.go @@ -144,7 +144,7 @@ func testCanPushWithPriorityPushAbort(t *testing.T) { max := enginepb.MaxTxnPriority mid1 := enginepb.TxnPriority(1) mid2 := enginepb.TxnPriority(2) - statuses := []roachpb.TransactionStatus{roachpb.PENDING, roachpb.STAGING} + statuses := []roachpb.TransactionStatus{roachpb.PENDING, roachpb.STAGING, roachpb.PREPARED} testCases := []struct { pusherPri enginepb.TxnPriority pusheePri enginepb.TxnPriority @@ -167,7 +167,6 @@ func testCanPushWithPriorityPushAbort(t *testing.T) { {max, mid2, true}, {max, max, false}, } - // NOTE: the behavior of PUSH_ABORT pushes is agnostic to pushee status. for _, pusheeStatus := range statuses { // NOTE: the behavior of PUSH_ABORT pushes is agnostic to isolation levels. for _, pusherIso := range isolation.Levels() { @@ -176,9 +175,14 @@ func testCanPushWithPriorityPushAbort(t *testing.T) { name := fmt.Sprintf("pusheeStatus=%s/pusherIso=%s/pusheeIso=%s/pusherPri=%d/pusheePri=%d", pusheeStatus, pusherIso, pusheeIso, test.pusherPri, test.pusheePri) t.Run(name, func(t *testing.T) { + exp := test.exp + if pusheeStatus == roachpb.PREPARED { + // When the pushee is PREPARED, a PUSH_ABORT never succeeds. + exp = false + } canPush := CanPushWithPriority( kvpb.PUSH_ABORT, pusherIso, pusheeIso, test.pusherPri, test.pusheePri, pusheeStatus) - require.Equal(t, test.exp, canPush) + require.Equal(t, exp, canPush) }) } } @@ -188,6 +192,7 @@ func testCanPushWithPriorityPushAbort(t *testing.T) { func testCanPushWithPriorityPushTimestamp(t *testing.T) { t.Run("pusheeStatus="+roachpb.PENDING.String(), testCanPushWithPriorityPushTimestampPusheePending) + t.Run("pusheeStatus="+roachpb.PREPARED.String(), testCanPushWithPriorityPushTimestampPusheePrepared) t.Run("pusheeStatus="+roachpb.STAGING.String(), testCanPushWithPriorityPushTimestampPusheeStaging) } @@ -371,6 +376,33 @@ func testCanPushWithPriorityPushTimestampPusheePending(t *testing.T) { } } +func testCanPushWithPriorityPushTimestampPusheePrepared(t *testing.T) { + min := enginepb.MinTxnPriority + max := enginepb.MaxTxnPriority + mid1 := enginepb.TxnPriority(1) + mid2 := enginepb.TxnPriority(2) + priorities := []enginepb.TxnPriority{min, mid1, mid2, max} + // NOTE: the behavior of PUSH_TIMESTAMP pushes is agnostic to isolation levels + // when the pushee transaction is PREPARED. + for _, pusherIso := range isolation.Levels() { + for _, pusheeIso := range isolation.Levels() { + // NOTE: the behavior of PUSH_TIMESTAMP pushes is agnostic to priorities + // when the pushee transaction is PREPARED. + for _, pusherPri := range priorities { + for _, pusheePri := range priorities { + name := fmt.Sprintf("pusherIso=%s/pusheeIso=%s/pusherPri=%d/pusheePri=%d", + pusherIso, pusheeIso, pusherPri, pusheePri) + t.Run(name, func(t *testing.T) { + canPush := CanPushWithPriority( + kvpb.PUSH_TIMESTAMP, pusherIso, pusheeIso, pusherPri, pusheePri, roachpb.PREPARED) + require.False(t, canPush) + }) + } + } + } + } +} + func testCanPushWithPriorityPushTimestampPusheeStaging(t *testing.T) { min := enginepb.MinTxnPriority max := enginepb.MaxTxnPriority @@ -421,7 +453,7 @@ func testCanPushWithPriorityPushTouch(t *testing.T) { mid1 := enginepb.TxnPriority(1) mid2 := enginepb.TxnPriority(2) priorities := []enginepb.TxnPriority{min, mid1, mid2, max} - statuses := []roachpb.TransactionStatus{roachpb.PENDING, roachpb.STAGING} + statuses := []roachpb.TransactionStatus{roachpb.PENDING, roachpb.STAGING, roachpb.PREPARED} // NOTE: the behavior of PUSH_TOUCH pushes is agnostic to pushee status. for _, pusheeStatus := range statuses { // NOTE: the behavior of PUSH_TOUCH pushes is agnostic to isolation levels. diff --git a/pkg/kv/txn.go b/pkg/kv/txn.go index 167129c2d4d5..9b184c97f514 100644 --- a/pkg/kv/txn.go +++ b/pkg/kv/txn.go @@ -277,27 +277,25 @@ func (txn *Txn) statusLocked() roachpb.TransactionStatus { return txn.mu.sender.TxnStatus() } -// IsCommitted returns true iff the transaction has the committed status. -func (txn *Txn) IsCommitted() bool { +// hasStatus returns true iff the transaction has the provided status. +func (txn *Txn) hasStatus(s roachpb.TransactionStatus) bool { txn.mu.Lock() defer txn.mu.Unlock() - return txn.statusLocked() == roachpb.COMMITTED + return txn.statusLocked() == s } +// IsCommitted returns true iff the transaction has the committed status. +func (txn *Txn) IsCommitted() bool { return txn.hasStatus(roachpb.COMMITTED) } + // IsAborted returns true iff the transaction has the aborted status. -func (txn *Txn) IsAborted() bool { - txn.mu.Lock() - defer txn.mu.Unlock() - return txn.statusLocked() == roachpb.ABORTED -} +func (txn *Txn) IsAborted() bool { return txn.hasStatus(roachpb.ABORTED) } + +// IsPrepared returns true iff the transaction has the prepared status. +func (txn *Txn) IsPrepared() bool { return txn.hasStatus(roachpb.PREPARED) } // IsOpen returns true iff the transaction is in the open state where // it can accept further commands. -func (txn *Txn) IsOpen() bool { - txn.mu.Lock() - defer txn.mu.Unlock() - return txn.statusLocked() == roachpb.PENDING -} +func (txn *Txn) IsOpen() bool { return txn.hasStatus(roachpb.PENDING) } // isClientFinalized returns true if the client has issued an EndTxn request in // an attempt to finalize the transaction. @@ -999,6 +997,21 @@ func (txn *Txn) rollback(ctx context.Context) *kvpb.Error { return nil } +// Prepare sends an EndTxnRequest with Prepare=true. Once a transaction is +// prepared, it cannot be used to perform any more reads or writes. A prepared +// transaction can only be committed or rolled back. +func (txn *Txn) Prepare(ctx context.Context) error { + if txn.typ != RootTxn { + return errors.WithContextTags(errors.AssertionFailedf("Prepare() called on leaf txn"), ctx) + } + + et := endTxnReq(true, txn.deadline()) + et.req.Prepare = true + ba := &kvpb.BatchRequest{Requests: et.unionArr[:]} + _, pErr := txn.Send(ctx, ba) + return pErr.GoError() +} + // AddCommitTrigger adds a closure to be executed on successful commit // of the transaction. func (txn *Txn) AddCommitTrigger(trigger func(ctx context.Context)) { diff --git a/pkg/roachpb/data.go b/pkg/roachpb/data.go index 36645dc25486..5eda2c95b6cb 100644 --- a/pkg/roachpb/data.go +++ b/pkg/roachpb/data.go @@ -1294,6 +1294,10 @@ func (t *Transaction) Update(o *Transaction) { switch t.Status { case PENDING: t.Status = o.Status + case PREPARED: + if o.Status != PENDING { + t.Status = o.Status + } case STAGING: if o.Status != PENDING { t.Status = o.Status @@ -1304,6 +1308,8 @@ func (t *Transaction) Update(o *Transaction) { } case COMMITTED: // Nothing to do. + default: + log.Fatalf(ctx, "unexpected txn status: %s", t.Status) } if t.ReadTimestamp == o.ReadTimestamp { @@ -1344,8 +1350,8 @@ func (t *Transaction) Update(o *Transaction) { // have incremented the txn's epoch without realizing that it was // aborted. t.Status = ABORTED - case COMMITTED: - log.Warningf(ctx, "updating txn %s with COMMITTED txn at earlier epoch %s", t.String(), o.String()) + case PREPARED, COMMITTED: + log.Warningf(ctx, "updating txn %s with %s txn at earlier epoch %s", t.String(), o.Status, o.String()) } } diff --git a/pkg/roachpb/data.proto b/pkg/roachpb/data.proto index b3b5217c9f8a..49eed22dcd92 100644 --- a/pkg/roachpb/data.proto +++ b/pkg/roachpb/data.proto @@ -322,10 +322,18 @@ enum TransactionStatus { option (gogoproto.goproto_enum_prefix) = false; // PENDING is the default state for a new transaction. Transactions - // move from PENDING to one of COMMITTED or ABORTED. Mutations made - // as part of a PENDING transactions are recorded as "intents" in - // the underlying MVCC model. + // move from PENDING to one of PREPARED, STAGING, COMMITTED, or + // ABORTED. Mutations made as part of a PENDING transactions are + // recorded as "intents" in the underlying MVCC model. PENDING = 0; + // PREPARED is the state for a transaction which has been prepared as + // part of the XA two-phase commit protocol. Transactions in state + // PREPARED can be subsequently moved to either state COMMITTED or + // ABORTED. Once a transaction is in state PREPARED, it is guaranteed + // to be able to commit if the coordinator node decides to do so; + // conflicting transactions cannot prevent it from doing so by pushing + // it to a higher timestamp or aborting it. + PREPARED = 4; // STAGING is the state for a transaction which has issued all of // its writes and is in the process of committing. Mutations made // as part of a transaction in this state may still be in-flight diff --git a/pkg/roachpb/data_test.go b/pkg/roachpb/data_test.go index 101a7c34fd72..ba0edf9ceae0 100644 --- a/pkg/roachpb/data_test.go +++ b/pkg/roachpb/data_test.go @@ -736,6 +736,32 @@ func TestTransactionUpdateMinTimestamp(t *testing.T) { } } +func TestTransactionUpdatePrepared(t *testing.T) { + txn := nonZeroTxn + txn.Status = PENDING + + txn2 := nonZeroTxn + txn2.Status = PREPARED + + // In same epoch, PENDING < PREPARED. + txn.Update(&txn2) + if a, e := txn.Status, PREPARED; a != e { + t.Errorf("expected status %s; got %s", e, a) + } + + txn2.Status = PENDING + txn.Update(&txn2) + if a, e := txn.Status, PREPARED; a != e { + t.Errorf("expected status %s; got %s", e, a) + } + + txn2.Status = COMMITTED + txn.Update(&txn2) + if a, e := txn.Status, COMMITTED; a != e { + t.Errorf("expected status %s; got %s", e, a) + } +} + func TestTransactionUpdateStaging(t *testing.T) { txn := nonZeroTxn txn.Status = PENDING diff --git a/pkg/sql/catalog/bootstrap/metadata.go b/pkg/sql/catalog/bootstrap/metadata.go index 5dd28f26e40d..8e88cfac03bd 100644 --- a/pkg/sql/catalog/bootstrap/metadata.go +++ b/pkg/sql/catalog/bootstrap/metadata.go @@ -455,6 +455,9 @@ func addSystemDescriptorsToSchema(target *MetadataSchema) { target.AddDescriptor(systemschema.TransactionExecInsightsTable) target.AddDescriptor(systemschema.StatementExecInsightsTable) + // Tables introduced in 24.3. + target.AddDescriptor(systemschema.PreparedTransactionsTable) + // Adding a new system table? It should be added here to the metadata schema, // and also created as a migration for older clusters. // If adding a call to AddDescriptor or AddDescriptorForSystemTenant, please @@ -467,7 +470,7 @@ func addSystemDescriptorsToSchema(target *MetadataSchema) { // NumSystemTablesForSystemTenant is the number of system tables defined on // the system tenant. This constant is only defined to avoid having to manually // update auto stats tests every time a new system table is added. -const NumSystemTablesForSystemTenant = 56 +const NumSystemTablesForSystemTenant = 57 // addSplitIDs adds a split point for each of the PseudoTableIDs to the supplied // MetadataSchema. diff --git a/pkg/sql/catalog/bootstrap/testdata/testdata b/pkg/sql/catalog/bootstrap/testdata/testdata index 6843820f90c9..4bf379d1d887 100644 --- a/pkg/sql/catalog/bootstrap/testdata/testdata +++ b/pkg/sql/catalog/bootstrap/testdata/testdata @@ -1,7 +1,7 @@ -system hash=2ae2763375bdffaed3ccc39f6c4f9cabd4aa28567c542cc8e6e150c3497e3b4b +system hash=2b708d022c125ea239e9e27f0726580f8fecbd57ae7ff01d74a58db95af0ebf4 ---- [{"key":"8b"} -,{"key":"8b89898a89","value":"0312450a0673797374656d10011a250a0d0a0561646d696e1080101880100a0c0a04726f6f7410801018801012046e6f646518032200280140004a006a0a08d8843d100218002006"} +,{"key":"8b89898a89","value":"0312450a0673797374656d10011a250a0d0a0561646d696e1080101880100a0c0a04726f6f7410801018801012046e6f646518032200280140004a006a0a08d8843d100218002008"} ,{"key":"8b898b8a89","value":"030a8e030a0a64657363726970746f721803200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a64657363726970746f7210021a0c08081000180030005011600020013000680070007800800100880100980100480352710a077072696d61727910011801220269642a0a64657363726970746f72300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a210a0b0a0561646d696e102018200a0a0a04726f6f741020182012046e6f64651803800101880103980100b201130a077072696d61727910001a02696420012800b201240a1066616d5f325f64657363726970746f7210021a0a64657363726970746f7220022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} ,{"key":"8b898c8a89","value":"030ac7050a0575736572731804200128013a00422d0a08757365726e616d6510011a0c0807100018003000501960002000300068007000780080010088010098010042330a0e68617368656450617373776f726410021a0c0808100018003000501160002001300068007000780080010088010098010042320a066973526f6c6510031a0c08001000180030005010600020002a0566616c73653000680070007800800100880100980100422c0a07757365725f696410041a0c080c100018003000501a60002000300068007000780080010088010098010048055290010a077072696d617279100118012208757365726e616d652a0e68617368656450617373776f72642a066973526f6c652a07757365725f6964300140004a10080010001a00200028003000380040005a007002700370047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00102e00100e90100000000000000005a740a1175736572735f757365725f69645f696478100218012207757365725f69643004380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060036a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100b201240a077072696d61727910001a08757365726e616d651a07757365725f6964200120042804b2012c0a1466616d5f325f68617368656450617373776f726410021a0e68617368656450617373776f726420022802b2011c0a0c66616d5f335f6973526f6c6510031a066973526f6c6520032803b80104c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b898d8a89","value":"030afd020a057a6f6e65731805200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422b0a06636f6e66696710021a0c080810001800300050116000200130006800700078008001008801009801004803526d0a077072696d61727910011801220269642a06636f6e666967300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100b201130a077072696d61727910001a02696420012800b2011c0a0c66616d5f325f636f6e66696710021a06636f6e66696720022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} @@ -58,6 +58,7 @@ system hash=2ae2763375bdffaed3ccc39f6c4f9cabd4aa28567c542cc8e6e150c3497e3b4b ,{"key":"8b89c88a89","value":"030abf0a0a0f6d7663635f737461746973746963731840200128013a0042450a0a637265617465645f617410011a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042300a0b64617461626173655f696410021a0c08011040180030005014600020003000680070007800800100880100980100422d0a087461626c655f696410031a0c08011040180030005014600020003000680070007800800100880100980100422d0a08696e6465785f696410041a0c0801104018003000501460002000300068007000780080010088010098010042300a0a7374617469737469637310051a0d081210001800300050da1d60002000300068007000780080010088010098010042ab010a3f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313610061a0c080110201800300050176000200030015a456d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328637265617465645f61742929292c2031363a3a3a494e543829680070007800800101880100980100480752e4020a146d7663635f737461746973746963735f706b657910011801223f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f3136220a637265617465645f6174220b64617461626173655f696422087461626c655f69642208696e6465785f69642a0a7374617469737469637330063001300230033004400040004000400040004a10080010001a00200028003000380040005a0070057a0408002000800100880100900104980101a201720801123f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f31361810220a637265617465645f6174220b64617461626173655f69642208696e6465785f696422087461626c655f6964a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a201bd020ae901637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291245636865636b5f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313618002806300038014002b201500a077072696d61727910001a0a637265617465645f61741a0b64617461626173655f69641a087461626c655f69641a08696e6465785f69641a0a73746174697374696373200120022003200420052805b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b89c98a89","value":"030ab5170a1e7472616e73616374696f6e5f657865637574696f6e5f696e7369676874731841200128013a0042340a0e7472616e73616374696f6e5f696410011a0d080e100018003000508617600020003000680070007800800100880100980100423f0a1a7472616e73616374696f6e5f66696e6765727072696e745f696410021a0c0808100018003000501160002000300068007000780080010088010098010042320a0d71756572795f73756d6d61727910031a0c0807100018003000501960002001300068007000780080010088010098010042310a0c696d706c696369745f74786e10041a0c08001000180030005010600020013000680070007800800100880100980100422f0a0a73657373696f6e5f696410051a0c0807100018003000501960002000300068007000780080010088010098010042300a0a73746172745f74696d6510061a0d080910001800300050a009600020013000680070007800800100880100980100422e0a08656e645f74696d6510071a0d080910001800300050a009600020013000680070007800800100880100980100422e0a09757365725f6e616d6510081a0c08071000180030005019600020013000680070007800800100880100980100422d0a086170705f6e616d6510091a0c0807100018003000501960002001300068007000780080010088010098010042320a0d757365725f7072696f72697479100a1a0c08071000180030005019600020013000680070007800800100880100980100422c0a0772657472696573100b1a0c0801104018003000501460002001300068007000780080010088010098010042360a116c6173745f72657472795f726561736f6e100c1a0c08071000180030005019600020013000680070007800800100880100980100423e0a0870726f626c656d73100d1a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100423c0a06636175736573100e1a1d080f104018003000380150f8075a0c08011040180030005014600060002001300068007000780080010088010098010042480a1273746d745f657865637574696f6e5f696473100f1a1d080f100018003000380750f1075a0c08071000180030005019600060002001300068007000780080010088010098010042320a0d6370755f73716c5f6e616e6f7310101a0c0801104018003000501460002001300068007000780080010088010098010042340a0f6c6173745f6572726f725f636f646510111a0c08071000180030005019600020013000680070007800800100880100980100422b0a0673746174757310121a0c08011040180030005014600020013000680070007800800100880100980100423b0a0f636f6e74656e74696f6e5f74696d6510131a13080610001800300050a20960006a04080010002001300068007000780080010088010098010042350a0f636f6e74656e74696f6e5f696e666f10141a0d081210001800300050da1d600020013000680070007800800100880100980100422d0a0764657461696c7310151a0d081210001800300050da1d60002001300068007000780080010088010098010042420a076372656174656410161a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042a0010a2a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313610171a0c080110201800300050176000200030015a4f6d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328656e645f74696d652c2073746172745f74696d652929292c2031363a3a3a494e543829680070007800800101880100980100481852b6030a077072696d61727910011801220e7472616e73616374696f6e5f69642a1a7472616e73616374696f6e5f66696e6765727072696e745f69642a0d71756572795f73756d6d6172792a0c696d706c696369745f74786e2a0a73657373696f6e5f69642a0a73746172745f74696d652a08656e645f74696d652a09757365725f6e616d652a086170705f6e616d652a0d757365725f7072696f726974792a07726574726965732a116c6173745f72657472795f726561736f6e2a0870726f626c656d732a066361757365732a1273746d745f657865637574696f6e5f6964732a0d6370755f73716c5f6e616e6f732a0f6c6173745f6572726f725f636f64652a067374617475732a0f636f6e74656e74696f6e5f74696d652a0f636f6e74656e74696f6e5f696e666f2a0764657461696c732a0763726561746564300140004a10080010001a00200028003000380040005a0070027003700470057006700770087009700a700b700c700d700e700f70107011701270137014701570167a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e90100000000000000005a94010a1e7472616e73616374696f6e5f66696e6765727072696e745f69645f69647810021800221a7472616e73616374696f6e5f66696e6765727072696e745f69643002380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005af2010a0e74696d655f72616e67655f69647810031800222a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136220a73746172745f74696d652208656e645f74696d6530173006300738014000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a201460801122a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618102208656e645f74696d65220a73746172745f74696d65a80100b20100ba0100c00100c80100d00100e00100e901000000000000000060046a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a20193020ad401637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291230636865636b5f637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618002817300038014002b201e6020a077072696d61727910001a0e7472616e73616374696f6e5f69641a1a7472616e73616374696f6e5f66696e6765727072696e745f69641a0d71756572795f73756d6d6172791a0c696d706c696369745f74786e1a0a73657373696f6e5f69641a0a73746172745f74696d651a08656e645f74696d651a09757365725f6e616d651a086170705f6e616d651a0d757365725f7072696f726974791a07726574726965731a116c6173745f72657472795f726561736f6e1a0870726f626c656d731a066361757365731a1273746d745f657865637574696f6e5f6964731a0d6370755f73716c5f6e616e6f731a0f6c6173745f6572726f725f636f64651a067374617475731a0f636f6e74656e74696f6e5f74696d651a0f636f6e74656e74696f6e5f696e666f1a0764657461696c731a0763726561746564200120022003200420052006200720082009200a200b200c200d200e200f20102011201220132014201520162800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b89ca8a89","value":"030a801e0a1c73746174656d656e745f657865637574696f6e5f696e7369676874731842200128013a00422f0a0a73657373696f6e5f696410011a0c0807100018003000501960002000300068007000780080010088010098010042340a0e7472616e73616374696f6e5f696410021a0d080e100018003000508617600020003000680070007800800100880100980100423f0a1a7472616e73616374696f6e5f66696e6765727072696e745f696410031a0c0808100018003000501160002000300068007000780080010088010098010042310a0c73746174656d656e745f696410041a0c08071000180030005019600020003000680070007800800100880100980100423d0a1873746174656d656e745f66696e6765727072696e745f696410051a0c08081000180030005011600020003000680070007800800100880100980100422c0a0770726f626c656d10061a0c08011040180030005014600020013000680070007800800100880100980100423c0a0663617573657310071a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100422a0a05717565727910081a0c08071000180030005019600020013000680070007800800100880100980100422b0a0673746174757310091a0c0801104018003000501460002001300068007000780080010088010098010042300a0a73746172745f74696d65100a1a0d080910001800300050a009600020013000680070007800800100880100980100422e0a08656e645f74696d65100b1a0d080910001800300050a009600020013000680070007800800100880100980100422e0a0966756c6c5f7363616e100c1a0c08001000180030005010600020013000680070007800800100880100980100422e0a09757365725f6e616d65100d1a0c08071000180030005019600020013000680070007800800100880100980100422d0a086170705f6e616d65100e1a0c0807100018003000501960002001300068007000780080010088010098010042320a0d757365725f7072696f72697479100f1a0c0807100018003000501960002001300068007000780080010088010098010042320a0d64617461626173655f6e616d6510101a0c08071000180030005019600020013000680070007800800100880100980100422e0a09706c616e5f6769737410111a0c08071000180030005019600020013000680070007800800100880100980100422c0a077265747269657310121a0c0801104018003000501460002001300068007000780080010088010098010042360a116c6173745f72657472795f726561736f6e10131a0c0807100018003000501960002001300068007000780080010088010098010042480a12657865637574696f6e5f6e6f64655f69647310141a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100424b0a15696e6465785f7265636f6d6d656e646174696f6e7310151a1d080f100018003000380750f1075a0c08071000180030005019600060002001300068007000780080010088010098010042310a0c696d706c696369745f74786e10161a0c0800100018003000501060002001300068007000780080010088010098010042320a0d6370755f73716c5f6e616e6f7310171a0c08011040180030005014600020013000680070007800800100880100980100422f0a0a6572726f725f636f646510181a0c08071000180030005019600020013000680070007800800100880100980100423b0a0f636f6e74656e74696f6e5f74696d6510191a13080610001800300050a20960006a04080010002001300068007000780080010088010098010042350a0f636f6e74656e74696f6e5f696e666f101a1a0d081210001800300050da1d600020013000680070007800800100880100980100422d0a0764657461696c73101b1a0d081210001800300050da1d60002001300068007000780080010088010098010042420a0763726561746564101c1a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042a0010a2a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136101d1a0c080110201800300050176000200030015a4f6d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328656e645f74696d652c2073746172745f74696d652929292c2031363a3a3a494e543829680070007800800101880100980100481e529a040a077072696d61727910011801220c73746174656d656e745f6964220e7472616e73616374696f6e5f69642a0a73657373696f6e5f69642a1a7472616e73616374696f6e5f66696e6765727072696e745f69642a1873746174656d656e745f66696e6765727072696e745f69642a0770726f626c656d2a066361757365732a0571756572792a067374617475732a0a73746172745f74696d652a08656e645f74696d652a0966756c6c5f7363616e2a09757365725f6e616d652a086170705f6e616d652a0d757365725f7072696f726974792a0d64617461626173655f6e616d652a09706c616e5f676973742a07726574726965732a116c6173745f72657472795f726561736f6e2a12657865637574696f6e5f6e6f64655f6964732a15696e6465785f7265636f6d6d656e646174696f6e732a0c696d706c696369745f74786e2a0d6370755f73716c5f6e616e6f732a0a6572726f725f636f64652a0f636f6e74656e74696f6e5f74696d652a0f636f6e74656e74696f6e5f696e666f2a0764657461696c732a076372656174656430043002400040004a10080010001a00200028003000380040005a007001700370057006700770087009700a700b700c700d700e700f7010701170127013701470157016701770187019701a701b701c7a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e90100000000000000005a7c0a127472616e73616374696f6e5f69645f69647810021800220e7472616e73616374696f6e5f69643002380440004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005ab4010a1e7472616e73616374696f6e5f66696e6765727072696e745f69645f69647810031800221a7472616e73616374696f6e5f66696e6765727072696e745f6964220a73746172745f74696d652208656e645f74696d653003300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005ab0010a1c73746174656d656e745f66696e6765727072696e745f69645f69647810041800221873746174656d656e745f66696e6765727072696e745f6964220a73746172745f74696d652208656e645f74696d653005300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005af4010a0e74696d655f72616e67655f69647810051800222a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136220a73746172745f74696d652208656e645f74696d65301d300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a201460801122a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618102208656e645f74696d65220a73746172745f74696d65a80100b20100ba0100c00100c80100d00100e00100e901000000000000000060066a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a20193020ad401637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291230636865636b5f637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f31361800281d300038014002b201c8030a077072696d61727910001a0a73657373696f6e5f69641a0e7472616e73616374696f6e5f69641a1a7472616e73616374696f6e5f66696e6765727072696e745f69641a0c73746174656d656e745f69641a1873746174656d656e745f66696e6765727072696e745f69641a0770726f626c656d1a066361757365731a0571756572791a067374617475731a0a73746172745f74696d651a08656e645f74696d651a0966756c6c5f7363616e1a09757365725f6e616d651a086170705f6e616d651a0d757365725f7072696f726974791a0d64617461626173655f6e616d651a09706c616e5f676973741a07726574726965731a116c6173745f72657472795f726561736f6e1a12657865637574696f6e5f6e6f64655f6964731a15696e6465785f7265636f6d6d656e646174696f6e731a0c696d706c696369745f74786e1a0d6370755f73716c5f6e616e6f731a0a6572726f725f636f64651a0f636f6e74656e74696f6e5f74696d651a0f636f6e74656e74696f6e5f696e666f1a0764657461696c731a0763726561746564200120022003200420052006200720082009200a200b200c200d200e200f2010201120122013201420152016201720182019201a201b201c2800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} +,{"key":"8b89cb8a89","value":"030aab060a1570726570617265645f7472616e73616374696f6e731843200128013a00422e0a09676c6f62616c5f696410011a0c0807100018003000501960002000300068007000780080010088010098010042340a0e7472616e73616374696f6e5f696410021a0d080e10001800300050861760002000300068007000780080010088010098010042340a0f7472616e73616374696f6e5f6b657910031a0c0808100018003000501160002001300068007000780080010088010098010042430a08707265706172656410041a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a3000680070007800800100880100980100422a0a056f776e657210051a0c08071000180030005019600020003000680070007800800100880100980100422d0a08646174616261736510061a0c08071000180030005019600020003000680070007800800100880100980100422e0a0968657572697374696310071a0c08071000180030005019600020013000680070007800800100880100980100480852bd010a077072696d617279100118012209676c6f62616c5f69642a0e7472616e73616374696f6e5f69642a0f7472616e73616374696f6e5f6b65792a0870726570617265642a056f776e65722a0864617461626173652a09686575726973746963300140004a10080010001a00200028003000380040005a007002700370047005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a210a0b0a0561646d696e102018200a0a0a04726f6f741020182012046e6f64651803800101880103980100b2016d0a077072696d61727910001a09676c6f62616c5f69641a0e7472616e73616374696f6e5f69641a0f7472616e73616374696f6e5f6b65791a0870726570617265641a056f776e65721a0864617461626173651a0968657572697374696320012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} ,{"key":"8c"} ,{"key":"8d"} ,{"key":"8d89888a89","value":"031080808040188080808002220308c0702803500058007801"} @@ -114,6 +115,7 @@ system hash=2ae2763375bdffaed3ccc39f6c4f9cabd4aa28567c542cc8e6e150c3497e3b4b ,{"key":"a68989a5126d6967726174696f6e7300018c89","value":"0150"} ,{"key":"a68989a5126d7663635f7374617469737469637300018c89","value":"018001"} ,{"key":"a68989a5126e616d65737061636500018c89","value":"013c"} +,{"key":"a68989a51270726570617265645f7472616e73616374696f6e7300018c89","value":"018601"} ,{"key":"a68989a51270726976696c6567657300018c89","value":"0168"} ,{"key":"a68989a51270726f7465637465645f74735f6d65746100018c89","value":"013e"} ,{"key":"a68989a51270726f7465637465645f74735f7265636f72647300018c89","value":"0140"} @@ -193,12 +195,13 @@ system hash=2ae2763375bdffaed3ccc39f6c4f9cabd4aa28567c542cc8e6e150c3497e3b4b ,{"key":"c8"} ,{"key":"c9"} ,{"key":"ca"} +,{"key":"cb"} ] -tenant hash=17c52d00b75a99743d728d962c813d59843133b3181664f566183fc1aeece00f +tenant hash=0b3b617c53f7e303eb73fc97fd778b0eeafdada80829368220605abe0d628bf9 ---- [{"key":""} -,{"key":"8b89898a89","value":"0312450a0673797374656d10011a250a0d0a0561646d696e1080101880100a0c0a04726f6f7410801018801012046e6f646518032200280140004a006a0a08d8843d100218002006"} +,{"key":"8b89898a89","value":"0312450a0673797374656d10011a250a0d0a0561646d696e1080101880100a0c0a04726f6f7410801018801012046e6f646518032200280140004a006a0a08d8843d100218002008"} ,{"key":"8b898b8a89","value":"030a8e030a0a64657363726970746f721803200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422f0a0a64657363726970746f7210021a0c08081000180030005011600020013000680070007800800100880100980100480352710a077072696d61727910011801220269642a0a64657363726970746f72300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a210a0b0a0561646d696e102018200a0a0a04726f6f741020182012046e6f64651803800101880103980100b201130a077072696d61727910001a02696420012800b201240a1066616d5f325f64657363726970746f7210021a0a64657363726970746f7220022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} ,{"key":"8b898c8a89","value":"030ac7050a0575736572731804200128013a00422d0a08757365726e616d6510011a0c0807100018003000501960002000300068007000780080010088010098010042330a0e68617368656450617373776f726410021a0c0808100018003000501160002001300068007000780080010088010098010042320a066973526f6c6510031a0c08001000180030005010600020002a0566616c73653000680070007800800100880100980100422c0a07757365725f696410041a0c080c100018003000501a60002000300068007000780080010088010098010048055290010a077072696d617279100118012208757365726e616d652a0e68617368656450617373776f72642a066973526f6c652a07757365725f6964300140004a10080010001a00200028003000380040005a007002700370047a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00102e00100e90100000000000000005a740a1175736572735f757365725f69645f696478100218012207757365725f69643004380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060036a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100b201240a077072696d61727910001a08757365726e616d651a07757365725f6964200120042804b2012c0a1466616d5f325f68617368656450617373776f726410021a0e68617368656450617373776f726420022802b2011c0a0c66616d5f335f6973526f6c6510031a066973526f6c6520032803b80104c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b898d8a89","value":"030afd020a057a6f6e65731805200128013a0042270a02696410011a0c08011040180030005014600020003000680070007800800100880100980100422b0a06636f6e66696710021a0c080810001800300050116000200130006800700078008001008801009801004803526d0a077072696d61727910011801220269642a06636f6e666967300140004a10080010001a00200028003000380040005a0070027a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100b201130a077072696d61727910001a02696420012800b2011c0a0c66616d5f325f636f6e66696710021a06636f6e66696720022802b80103c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} @@ -255,6 +258,7 @@ tenant hash=17c52d00b75a99743d728d962c813d59843133b3181664f566183fc1aeece00f ,{"key":"8b89c88a89","value":"030abf0a0a0f6d7663635f737461746973746963731840200128013a0042450a0a637265617465645f617410011a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042300a0b64617461626173655f696410021a0c08011040180030005014600020003000680070007800800100880100980100422d0a087461626c655f696410031a0c08011040180030005014600020003000680070007800800100880100980100422d0a08696e6465785f696410041a0c0801104018003000501460002000300068007000780080010088010098010042300a0a7374617469737469637310051a0d081210001800300050da1d60002000300068007000780080010088010098010042ab010a3f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313610061a0c080110201800300050176000200030015a456d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328637265617465645f61742929292c2031363a3a3a494e543829680070007800800101880100980100480752e4020a146d7663635f737461746973746963735f706b657910011801223f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f3136220a637265617465645f6174220b64617461626173655f696422087461626c655f69642208696e6465785f69642a0a7374617469737469637330063001300230033004400040004000400040004a10080010001a00200028003000380040005a0070057a0408002000800100880100900104980101a201720801123f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f31361810220a637265617465645f6174220b64617461626173655f69642208696e6465785f696422087461626c655f6964a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a201bd020ae901637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291245636865636b5f637264625f696e7465726e616c5f637265617465645f61745f64617461626173655f69645f696e6465785f69645f7461626c655f69645f73686172645f313618002806300038014002b201500a077072696d61727910001a0a637265617465645f61741a0b64617461626173655f69641a087461626c655f69641a08696e6465785f69641a0a73746174697374696373200120022003200420052805b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b89c98a89","value":"030ab5170a1e7472616e73616374696f6e5f657865637574696f6e5f696e7369676874731841200128013a0042340a0e7472616e73616374696f6e5f696410011a0d080e100018003000508617600020003000680070007800800100880100980100423f0a1a7472616e73616374696f6e5f66696e6765727072696e745f696410021a0c0808100018003000501160002000300068007000780080010088010098010042320a0d71756572795f73756d6d61727910031a0c0807100018003000501960002001300068007000780080010088010098010042310a0c696d706c696369745f74786e10041a0c08001000180030005010600020013000680070007800800100880100980100422f0a0a73657373696f6e5f696410051a0c0807100018003000501960002000300068007000780080010088010098010042300a0a73746172745f74696d6510061a0d080910001800300050a009600020013000680070007800800100880100980100422e0a08656e645f74696d6510071a0d080910001800300050a009600020013000680070007800800100880100980100422e0a09757365725f6e616d6510081a0c08071000180030005019600020013000680070007800800100880100980100422d0a086170705f6e616d6510091a0c0807100018003000501960002001300068007000780080010088010098010042320a0d757365725f7072696f72697479100a1a0c08071000180030005019600020013000680070007800800100880100980100422c0a0772657472696573100b1a0c0801104018003000501460002001300068007000780080010088010098010042360a116c6173745f72657472795f726561736f6e100c1a0c08071000180030005019600020013000680070007800800100880100980100423e0a0870726f626c656d73100d1a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100423c0a06636175736573100e1a1d080f104018003000380150f8075a0c08011040180030005014600060002001300068007000780080010088010098010042480a1273746d745f657865637574696f6e5f696473100f1a1d080f100018003000380750f1075a0c08071000180030005019600060002001300068007000780080010088010098010042320a0d6370755f73716c5f6e616e6f7310101a0c0801104018003000501460002001300068007000780080010088010098010042340a0f6c6173745f6572726f725f636f646510111a0c08071000180030005019600020013000680070007800800100880100980100422b0a0673746174757310121a0c08011040180030005014600020013000680070007800800100880100980100423b0a0f636f6e74656e74696f6e5f74696d6510131a13080610001800300050a20960006a04080010002001300068007000780080010088010098010042350a0f636f6e74656e74696f6e5f696e666f10141a0d081210001800300050da1d600020013000680070007800800100880100980100422d0a0764657461696c7310151a0d081210001800300050da1d60002001300068007000780080010088010098010042420a076372656174656410161a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042a0010a2a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313610171a0c080110201800300050176000200030015a4f6d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328656e645f74696d652c2073746172745f74696d652929292c2031363a3a3a494e543829680070007800800101880100980100481852b6030a077072696d61727910011801220e7472616e73616374696f6e5f69642a1a7472616e73616374696f6e5f66696e6765727072696e745f69642a0d71756572795f73756d6d6172792a0c696d706c696369745f74786e2a0a73657373696f6e5f69642a0a73746172745f74696d652a08656e645f74696d652a09757365725f6e616d652a086170705f6e616d652a0d757365725f7072696f726974792a07726574726965732a116c6173745f72657472795f726561736f6e2a0870726f626c656d732a066361757365732a1273746d745f657865637574696f6e5f6964732a0d6370755f73716c5f6e616e6f732a0f6c6173745f6572726f725f636f64652a067374617475732a0f636f6e74656e74696f6e5f74696d652a0f636f6e74656e74696f6e5f696e666f2a0764657461696c732a0763726561746564300140004a10080010001a00200028003000380040005a0070027003700470057006700770087009700a700b700c700d700e700f70107011701270137014701570167a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e90100000000000000005a94010a1e7472616e73616374696f6e5f66696e6765727072696e745f69645f69647810021800221a7472616e73616374696f6e5f66696e6765727072696e745f69643002380140004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005af2010a0e74696d655f72616e67655f69647810031800222a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136220a73746172745f74696d652208656e645f74696d6530173006300738014000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a201460801122a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618102208656e645f74696d65220a73746172745f74696d65a80100b20100ba0100c00100c80100d00100e00100e901000000000000000060046a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a20193020ad401637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291230636865636b5f637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618002817300038014002b201e6020a077072696d61727910001a0e7472616e73616374696f6e5f69641a1a7472616e73616374696f6e5f66696e6765727072696e745f69641a0d71756572795f73756d6d6172791a0c696d706c696369745f74786e1a0a73657373696f6e5f69641a0a73746172745f74696d651a08656e645f74696d651a09757365725f6e616d651a086170705f6e616d651a0d757365725f7072696f726974791a07726574726965731a116c6173745f72657472795f726561736f6e1a0870726f626c656d731a066361757365731a1273746d745f657865637574696f6e5f6964731a0d6370755f73716c5f6e616e6f731a0f6c6173745f6572726f725f636f64651a067374617475731a0f636f6e74656e74696f6e5f74696d651a0f636f6e74656e74696f6e5f696e666f1a0764657461696c731a0763726561746564200120022003200420052006200720082009200a200b200c200d200e200f20102011201220132014201520162800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} ,{"key":"8b89ca8a89","value":"030a801e0a1c73746174656d656e745f657865637574696f6e5f696e7369676874731842200128013a00422f0a0a73657373696f6e5f696410011a0c0807100018003000501960002000300068007000780080010088010098010042340a0e7472616e73616374696f6e5f696410021a0d080e100018003000508617600020003000680070007800800100880100980100423f0a1a7472616e73616374696f6e5f66696e6765727072696e745f696410031a0c0808100018003000501160002000300068007000780080010088010098010042310a0c73746174656d656e745f696410041a0c08071000180030005019600020003000680070007800800100880100980100423d0a1873746174656d656e745f66696e6765727072696e745f696410051a0c08081000180030005011600020003000680070007800800100880100980100422c0a0770726f626c656d10061a0c08011040180030005014600020013000680070007800800100880100980100423c0a0663617573657310071a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100422a0a05717565727910081a0c08071000180030005019600020013000680070007800800100880100980100422b0a0673746174757310091a0c0801104018003000501460002001300068007000780080010088010098010042300a0a73746172745f74696d65100a1a0d080910001800300050a009600020013000680070007800800100880100980100422e0a08656e645f74696d65100b1a0d080910001800300050a009600020013000680070007800800100880100980100422e0a0966756c6c5f7363616e100c1a0c08001000180030005010600020013000680070007800800100880100980100422e0a09757365725f6e616d65100d1a0c08071000180030005019600020013000680070007800800100880100980100422d0a086170705f6e616d65100e1a0c0807100018003000501960002001300068007000780080010088010098010042320a0d757365725f7072696f72697479100f1a0c0807100018003000501960002001300068007000780080010088010098010042320a0d64617461626173655f6e616d6510101a0c08071000180030005019600020013000680070007800800100880100980100422e0a09706c616e5f6769737410111a0c08071000180030005019600020013000680070007800800100880100980100422c0a077265747269657310121a0c0801104018003000501460002001300068007000780080010088010098010042360a116c6173745f72657472795f726561736f6e10131a0c0807100018003000501960002001300068007000780080010088010098010042480a12657865637574696f6e5f6e6f64655f69647310141a1d080f104018003000380150f8075a0c080110401800300050146000600020013000680070007800800100880100980100424b0a15696e6465785f7265636f6d6d656e646174696f6e7310151a1d080f100018003000380750f1075a0c08071000180030005019600060002001300068007000780080010088010098010042310a0c696d706c696369745f74786e10161a0c0800100018003000501060002001300068007000780080010088010098010042320a0d6370755f73716c5f6e616e6f7310171a0c08011040180030005014600020013000680070007800800100880100980100422f0a0a6572726f725f636f646510181a0c08071000180030005019600020013000680070007800800100880100980100423b0a0f636f6e74656e74696f6e5f74696d6510191a13080610001800300050a20960006a04080010002001300068007000780080010088010098010042350a0f636f6e74656e74696f6e5f696e666f101a1a0d081210001800300050da1d600020013000680070007800800100880100980100422d0a0764657461696c73101b1a0d081210001800300050da1d60002001300068007000780080010088010098010042420a0763726561746564101c1a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a300068007000780080010088010098010042a0010a2a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136101d1a0c080110201800300050176000200030015a4f6d6f6428666e763332286d643528637264625f696e7465726e616c2e646174756d735f746f5f627974657328656e645f74696d652c2073746172745f74696d652929292c2031363a3a3a494e543829680070007800800101880100980100481e529a040a077072696d61727910011801220c73746174656d656e745f6964220e7472616e73616374696f6e5f69642a0a73657373696f6e5f69642a1a7472616e73616374696f6e5f66696e6765727072696e745f69642a1873746174656d656e745f66696e6765727072696e745f69642a0770726f626c656d2a066361757365732a0571756572792a067374617475732a0a73746172745f74696d652a08656e645f74696d652a0966756c6c5f7363616e2a09757365725f6e616d652a086170705f6e616d652a0d757365725f7072696f726974792a0d64617461626173655f6e616d652a09706c616e5f676973742a07726574726965732a116c6173745f72657472795f726561736f6e2a12657865637574696f6e5f6e6f64655f6964732a15696e6465785f7265636f6d6d656e646174696f6e732a0c696d706c696369745f74786e2a0d6370755f73716c5f6e616e6f732a0a6572726f725f636f64652a0f636f6e74656e74696f6e5f74696d652a0f636f6e74656e74696f6e5f696e666f2a0764657461696c732a076372656174656430043002400040004a10080010001a00200028003000380040005a007001700370057006700770087009700a700b700c700d700e700f7010701170127013701470157016701770187019701a701b701c7a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e90100000000000000005a7c0a127472616e73616374696f6e5f69645f69647810021800220e7472616e73616374696f6e5f69643002380440004a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005ab4010a1e7472616e73616374696f6e5f66696e6765727072696e745f69645f69647810031800221a7472616e73616374696f6e5f66696e6765727072696e745f6964220a73746172745f74696d652208656e645f74696d653003300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005ab0010a1c73746174656d656e745f66696e6765727072696e745f69645f69647810041800221873746174656d656e745f66696e6765727072696e745f6964220a73746172745f74696d652208656e645f74696d653005300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a20106080012001800a80100b20100ba0100c00100c80100d00100e00100e90100000000000000005af4010a0e74696d655f72616e67655f69647810051800222a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f3136220a73746172745f74696d652208656e645f74696d65301d300a300b380438024000400140014a10080010001a00200028003000380040005a007a0408002000800100880100900103980100a201460801122a637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313618102208656e645f74696d65220a73746172745f74696d65a80100b20100ba0100c00100c80100d00100e00100e901000000000000000060066a250a0d0a0561646d696e10e00318e0030a0c0a04726f6f7410e00318e00312046e6f64651803800101880103980100a20193020ad401637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f313620494e2028303a3a3a494e54382c20313a3a3a494e54382c20323a3a3a494e54382c20333a3a3a494e54382c20343a3a3a494e54382c20353a3a3a494e54382c20363a3a3a494e54382c20373a3a3a494e54382c20383a3a3a494e54382c20393a3a3a494e54382c2031303a3a3a494e54382c2031313a3a3a494e54382c2031323a3a3a494e54382c2031333a3a3a494e54382c2031343a3a3a494e54382c2031353a3a3a494e5438291230636865636b5f637264625f696e7465726e616c5f656e645f74696d655f73746172745f74696d655f73686172645f31361800281d300038014002b201c8030a077072696d61727910001a0a73657373696f6e5f69641a0e7472616e73616374696f6e5f69641a1a7472616e73616374696f6e5f66696e6765727072696e745f69641a0c73746174656d656e745f69641a1873746174656d656e745f66696e6765727072696e745f69641a0770726f626c656d1a066361757365731a0571756572791a067374617475731a0a73746172745f74696d651a08656e645f74696d651a0966756c6c5f7363616e1a09757365725f6e616d651a086170705f6e616d651a0d757365725f7072696f726974791a0d64617461626173655f6e616d651a09706c616e5f676973741a07726574726965731a116c6173745f72657472795f726561736f6e1a12657865637574696f6e5f6e6f64655f6964731a15696e6465785f7265636f6d6d656e646174696f6e731a0c696d706c696369745f74786e1a0d6370755f73716c5f6e616e6f731a0a6572726f725f636f64651a0f636f6e74656e74696f6e5f74696d651a0f636f6e74656e74696f6e5f696e666f1a0764657461696c731a0763726561746564200120022003200420052006200720082009200a200b200c200d200e200f2010201120122013201420152016201720182019201a201b201c2800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880303a80300b00300d00300d80300e00300"} +,{"key":"8b89cb8a89","value":"030aab060a1570726570617265645f7472616e73616374696f6e731843200128013a00422e0a09676c6f62616c5f696410011a0c0807100018003000501960002000300068007000780080010088010098010042340a0e7472616e73616374696f6e5f696410021a0d080e10001800300050861760002000300068007000780080010088010098010042340a0f7472616e73616374696f6e5f6b657910031a0c0808100018003000501160002001300068007000780080010088010098010042430a08707265706172656410041a0d080910001800300050a009600020002a136e6f7728293a3a3a54494d455354414d50545a3000680070007800800100880100980100422a0a056f776e657210051a0c08071000180030005019600020003000680070007800800100880100980100422d0a08646174616261736510061a0c08071000180030005019600020003000680070007800800100880100980100422e0a0968657572697374696310071a0c08071000180030005019600020013000680070007800800100880100980100480852bd010a077072696d617279100118012209676c6f62616c5f69642a0e7472616e73616374696f6e5f69642a0f7472616e73616374696f6e5f6b65792a0870726570617265642a056f776e65722a0864617461626173652a09686575726973746963300140004a10080010001a00200028003000380040005a007002700370047005700670077a0408002000800100880100900104980101a20106080012001800a80100b20100ba0100c00100c80100d00101e00100e901000000000000000060026a210a0b0a0561646d696e102018200a0a0a04726f6f741020182012046e6f64651803800101880103980100b2016d0a077072696d61727910001a09676c6f62616c5f69641a0e7472616e73616374696f6e5f69641a0f7472616e73616374696f6e5f6b65791a0870726570617265641a056f776e65721a0864617461626173651a0968657572697374696320012002200320042005200620072800b80101c20100e80100f2010408001200f801008002009202009a0200b20200b80200c0021dc80200e00200800300880302a80300b00300d00300d80300e00300"} ,{"key":"8d89888a89","value":"031080808040188080808002220308c0702803500058007801"} ,{"key":"8f898888","value":"01c801"} ,{"key":"90898988","value":"0a2a160c080110001a0020002a004200160673797374656d13021304"} @@ -276,6 +280,7 @@ tenant hash=17c52d00b75a99743d728d962c813d59843133b3181664f566183fc1aeece00f ,{"key":"a68989a5126d6967726174696f6e7300018c89","value":"0150"} ,{"key":"a68989a5126d7663635f7374617469737469637300018c89","value":"018001"} ,{"key":"a68989a5126e616d65737061636500018c89","value":"013c"} +,{"key":"a68989a51270726570617265645f7472616e73616374696f6e7300018c89","value":"018601"} ,{"key":"a68989a51270726976696c6567657300018c89","value":"0168"} ,{"key":"a68989a51270726f7465637465645f74735f6d65746100018c89","value":"013e"} ,{"key":"a68989a51270726f7465637465645f74735f7265636f72647300018c89","value":"0140"} diff --git a/pkg/sql/catalog/catprivilege/system.go b/pkg/sql/catalog/catprivilege/system.go index 46ecfcc0848a..fd4ebc55d420 100644 --- a/pkg/sql/catalog/catprivilege/system.go +++ b/pkg/sql/catalog/catprivilege/system.go @@ -31,6 +31,7 @@ var ( catconstants.TransactionStatisticsTableName, catconstants.StatementActivityTableName, catconstants.TransactionActivityTableName, + catconstants.PreparedTransactionsTableName, } readWriteSystemTables = []catconstants.SystemTableName{ diff --git a/pkg/sql/catalog/internal/catkv/testdata/testdata_app b/pkg/sql/catalog/internal/catkv/testdata/testdata_app index 1d76a8b7d6f2..d5f17f11a24a 100644 --- a/pkg/sql/catalog/internal/catkv/testdata/testdata_app +++ b/pkg/sql/catalog/internal/catkv/testdata/testdata_app @@ -375,6 +375,9 @@ catalog: "066": descriptor: relation namespace: (1, 29, "statement_execution_insights") + "067": + descriptor: relation + namespace: (1, 29, "prepared_transactions") "100": comments: database: this is the default database diff --git a/pkg/sql/catalog/internal/catkv/testdata/testdata_system b/pkg/sql/catalog/internal/catkv/testdata/testdata_system index 1ee37bf844bc..efcadf8d16ed 100644 --- a/pkg/sql/catalog/internal/catkv/testdata/testdata_system +++ b/pkg/sql/catalog/internal/catkv/testdata/testdata_system @@ -393,6 +393,9 @@ catalog: "066": descriptor: relation namespace: (1, 29, "statement_execution_insights") + "067": + descriptor: relation + namespace: (1, 29, "prepared_transactions") "100": comments: database: this is the default database diff --git a/pkg/sql/catalog/systemschema/system.go b/pkg/sql/catalog/systemschema/system.go index a7e074bb558c..b9c7d103b415 100644 --- a/pkg/sql/catalog/systemschema/system.go +++ b/pkg/sql/catalog/systemschema/system.go @@ -1175,6 +1175,21 @@ CREATE TABLE system.mvcc_statistics ( created ) );` + + PreparedTransactionsTableSchema = ` +CREATE TABLE system.prepared_transactions ( + global_id STRING NOT NULL, + transaction_id UUID NOT NULL, + -- Null if the transaction does not have a transaction record. + transaction_key BYTES NULL, + prepared TIMESTAMPTZ NOT NULL DEFAULT now(), + owner STRING NOT NULL, + database STRING NOT NULL, + -- Unused. Included in schema to support a future implementation of XA "heuristic completion". + heuristic STRING NULL, + CONSTRAINT "primary" PRIMARY KEY (global_id), + FAMILY "primary" (global_id, transaction_id, transaction_key, prepared, owner, database, heuristic) +);` ) func pk(name string) descpb.IndexDescriptor { @@ -1227,7 +1242,7 @@ const SystemDatabaseName = catconstants.SystemDatabaseName // release version). // // NB: Don't set this to clusterversion.Latest; use a specific version instead. -var SystemDatabaseSchemaBootstrapVersion = clusterversion.V24_3_AddTimeseriesZoneConfig.Version() +var SystemDatabaseSchemaBootstrapVersion = clusterversion.V24_3_PreparedTransactionsTable.Version() // MakeSystemDatabaseDesc constructs a copy of the system database // descriptor. @@ -1418,6 +1433,7 @@ func MakeSystemTables() []SystemTable { SystemMVCCStatisticsTable, StatementExecInsightsTable, TransactionExecInsightsTable, + PreparedTransactionsTable, } } @@ -4738,6 +4754,31 @@ var ( tbl.NextConstraintID++ }, ) + + PreparedTransactionsTable = makeSystemTable( + PreparedTransactionsTableSchema, + systemTable( + catconstants.PreparedTransactionsTableName, + descpb.InvalidID, // dynamically assigned table ID + []descpb.ColumnDescriptor{ + {Name: "global_id", ID: 1, Type: types.String}, + {Name: "transaction_id", ID: 2, Type: types.Uuid}, + {Name: "transaction_key", ID: 3, Type: types.Bytes, Nullable: true}, + {Name: "prepared", ID: 4, Type: types.TimestampTZ, DefaultExpr: &nowTZString}, + {Name: "owner", ID: 5, Type: types.String}, + {Name: "database", ID: 6, Type: types.String}, + {Name: "heuristic", ID: 7, Type: types.String, Nullable: true}, + }, + []descpb.ColumnFamilyDescriptor{ + { + Name: "primary", + ColumnNames: []string{"global_id", "transaction_id", "transaction_key", "prepared", "owner", "database", "heuristic"}, + ColumnIDs: []descpb.ColumnID{1, 2, 3, 4, 5, 6, 7}, + }, + }, + pk("global_id"), + ), + ) ) // SpanConfigurationsTableName represents system.span_configurations. diff --git a/pkg/sql/catalog/systemschema_test/testdata/bootstrap_system b/pkg/sql/catalog/systemschema_test/testdata/bootstrap_system index abad86c3336b..aa08046b524e 100644 --- a/pkg/sql/catalog/systemschema_test/testdata/bootstrap_system +++ b/pkg/sql/catalog/systemschema_test/testdata/bootstrap_system @@ -637,12 +637,22 @@ CREATE TABLE public.statement_execution_insights ( INDEX statement_fingerprint_id_idx (statement_fingerprint_id ASC, start_time DESC, end_time DESC), INDEX time_range_idx (start_time DESC, end_time DESC) USING HASH WITH (bucket_count=16) ); +CREATE TABLE public.prepared_transactions ( + global_id STRING NOT NULL, + transaction_id UUID NOT NULL, + transaction_key BYTES NULL, + prepared TIMESTAMPTZ NOT NULL DEFAULT now():::TIMESTAMPTZ, + owner STRING NOT NULL, + database STRING NOT NULL, + heuristic STRING NULL, + CONSTRAINT "primary" PRIMARY KEY (global_id ASC) +); schema_telemetry ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"database":{"name":"postgres","id":102,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":103}},"defaultPrivileges":{}}} -{"database":{"name":"system","id":1,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2048","withGrantOption":"2048"},{"userProto":"root","privileges":"2048","withGrantOption":"2048"}],"ownerProto":"node","version":3},"systemDatabaseSchemaVersion":{"majorVal":1000024,"minorVal":2,"internal":6}}} +{"database":{"name":"system","id":1,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2048","withGrantOption":"2048"},{"userProto":"root","privileges":"2048","withGrantOption":"2048"}],"ownerProto":"node","version":3},"systemDatabaseSchemaVersion":{"majorVal":1000024,"minorVal":2,"internal":8}}} {"table":{"name":"comments","id":24,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"type","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"object_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"sub_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"comment","id":4,"type":{"family":"StringFamily","oid":25}}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["type","object_id","sub_id"],"columnIds":[1,2,3]},{"name":"fam_4_comment","id":4,"columnNames":["comment"],"columnIds":[4],"defaultColumnId":4}],"nextFamilyId":5,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["type","object_id","sub_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["comment"],"keyColumnIds":[1,2,3],"storeColumnIds":[4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"public","privileges":"32"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"database_role_settings","id":44,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"database_id","id":1,"type":{"family":"OidFamily","oid":26}},{"name":"role_name","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"settings","id":3,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"role_id","id":4,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["database_id","role_name","settings","role_id"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["database_id","role_name"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["settings","role_id"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"database_role_settings_database_id_role_id_key","id":2,"unique":true,"version":3,"keyColumnNames":["database_id","role_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["settings"],"keyColumnIds":[1,4],"keySuffixColumnIds":[2],"storeColumnIds":[3],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"descriptor","id":3,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"descriptor","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_descriptor","id":2,"columnNames":["descriptor"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["descriptor"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} @@ -657,6 +667,7 @@ schema_telemetry {"table":{"name":"migrations","id":40,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"major","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"minor","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"patch","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"internal","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"completed_at","id":5,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["major","minor","patch","internal","completed_at"],"columnIds":[1,2,3,4,5],"defaultColumnId":5}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["major","minor","patch","internal"],"keyColumnDirections":["ASC","ASC","ASC","ASC"],"storeColumnNames":["completed_at"],"keyColumnIds":[1,2,3,4],"storeColumnIds":[5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"mvcc_statistics","id":64,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"created_at","id":1,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"database_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"table_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"index_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"statistics","id":5,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_created_at_database_id_index_id_table_id_shard_16","id":6,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(md5(crdb_internal.datums_to_bytes(created_at))), _:::INT8)","virtual":true}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["created_at","database_id","table_id","index_id","statistics"],"columnIds":[1,2,3,4,5],"defaultColumnId":5}],"nextFamilyId":1,"primaryIndex":{"name":"mvcc_statistics_pkey","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_created_at_database_id_index_id_table_id_shard_16","created_at","database_id","table_id","index_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["statistics"],"keyColumnIds":[6,1,2,3,4],"storeColumnIds":[5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_created_at_database_id_index_id_table_id_shard_16","shardBuckets":16,"columnNames":["created_at","database_id","index_id","table_id"]},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_created_at_database_id_index_id_table_id_shard_16 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_created_at_database_id_index_id_table_id_shard_16","columnIds":[6],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"namespace","id":30,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"parentID","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"parentSchemaID","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"id","id":4,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["parentID","parentSchemaID","name"],"columnIds":[1,2,3]},{"name":"fam_4_id","id":4,"columnNames":["id"],"columnIds":[4],"defaultColumnId":4}],"nextFamilyId":5,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["parentID","parentSchemaID","name"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"prepared_transactions","id":67,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"global_id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"transaction_id","id":2,"type":{"family":"UuidFamily","oid":2950}},{"name":"transaction_key","id":3,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"prepared","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"database","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"heuristic","id":7,"type":{"family":"StringFamily","oid":25},"nullable":true}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["global_id","transaction_id","transaction_key","prepared","owner","database","heuristic"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["global_id"],"keyColumnDirections":["ASC"],"storeColumnNames":["transaction_id","transaction_key","prepared","owner","database","heuristic"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"privileges","id":52,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"username","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"path","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"privileges","id":3,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"grant_options","id":4,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"user_id","id":5,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["username","path","privileges","grant_options","user_id"],"columnIds":[1,2,3,4,5]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["username","path"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options","user_id"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":3},"indexes":[{"name":"privileges_path_user_id_key","id":2,"unique":true,"version":3,"keyColumnNames":["path","user_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options"],"keyColumnIds":[2,5],"keySuffixColumnIds":[1],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1},{"name":"privileges_path_username_key","id":3,"unique":true,"version":3,"keyColumnNames":["path","username"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options"],"keyColumnIds":[2,1],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":2}],"nextIndexId":4,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":4}} {"table":{"name":"protected_ts_meta","id":31,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"singleton","id":1,"type":{"oid":16},"defaultExpr":"true"},{"name":"version","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"num_records","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"num_spans","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"total_bytes","id":5,"type":{"family":"IntFamily","width":64,"oid":20}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["singleton","version","num_records","num_spans","total_bytes"],"columnIds":[1,2,3,4,5]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["singleton"],"keyColumnDirections":["ASC"],"storeColumnNames":["version","num_records","num_spans","total_bytes"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"singleton","name":"check_singleton","columnIds":[1],"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"protected_ts_records","id":32,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"ts","id":2,"type":{"family":"DecimalFamily","oid":1700}},{"name":"meta_type","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"meta","id":4,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"num_spans","id":5,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"spans","id":6,"type":{"family":"BytesFamily","oid":17}},{"name":"verified","id":7,"type":{"oid":16},"defaultExpr":"false"},{"name":"target","id":8,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","ts","meta_type","meta","num_spans","spans","verified","target"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["ts","meta_type","meta","num_spans","spans","verified","target"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} @@ -706,24 +717,22 @@ schema_telemetry snapshot_id=7cd8a9ae-f35c-4cd2-970a-757174600874 max_records=10 ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"table":{"name":"descriptor_id_seq","id":7,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"1","maxValue":"9223372036854775807","start":"1","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} -{"table":{"name":"locations","id":21,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"localityKey","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"localityValue","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"latitude","id":3,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}},{"name":"longitude","id":4,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}}],"nextColumnId":5,"families":[{"name":"fam_0_localityKey_localityValue_latitude_longitude","columnNames":["localityKey","localityValue","latitude","longitude"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["localityKey","localityValue"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["latitude","longitude"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"role_id_seq","id":48,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"800","withGrantOption":"800"},{"userProto":"root","privileges":"800","withGrantOption":"800"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"100","maxValue":"2147483647","start":"100","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} +{"table":{"name":"eventlog","id":12,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"timestamp","id":1,"type":{"family":"TimestampFamily","oid":1114}},{"name":"eventType","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"targetID","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"reportingID","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"info","id":5,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"uniqueID","id":6,"type":{"family":"BytesFamily","oid":17},"defaultExpr":"uuid_v4()"}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["timestamp","uniqueID"],"columnIds":[1,6]},{"name":"fam_2_eventType","id":2,"columnNames":["eventType"],"columnIds":[2],"defaultColumnId":2},{"name":"fam_3_targetID","id":3,"columnNames":["targetID"],"columnIds":[3],"defaultColumnId":3},{"name":"fam_4_reportingID","id":4,"columnNames":["reportingID"],"columnIds":[4],"defaultColumnId":4},{"name":"fam_5_info","id":5,"columnNames":["info"],"columnIds":[5],"defaultColumnId":5}],"nextFamilyId":6,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["timestamp","uniqueID"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["eventType","targetID","reportingID","info"],"keyColumnIds":[1,6],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"join_tokens","id":41,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"secret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"expiration","id":3,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":4,"families":[{"name":"primary","columnNames":["id","secret","expiration"],"columnIds":[1,2,3]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["secret","expiration"],"keyColumnIds":[1],"storeColumnIds":[2,3],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"span_stats_unique_keys","id":55,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950},"defaultExpr":"gen_random_uuid()"},{"name":"key_bytes","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id","key_bytes"],"columnIds":[1,2],"defaultColumnId":2}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["key_bytes"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"unique_keys_key_bytes_idx","id":2,"unique":true,"version":3,"keyColumnNames":["key_bytes"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"task_payloads","id":59,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"created","id":2,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":4,"type":{"family":"OidFamily","oid":26}},{"name":"min_version","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"description","id":6,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"type","id":7,"type":{"family":"StringFamily","oid":25}},{"name":"value","id":8,"type":{"family":"BytesFamily","oid":17}}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","created","owner","owner_id","min_version","description","type","value"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["created","owner","owner_id","min_version","description","type","value"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"transaction_statistics","id":43,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"aggregated_ts","id":1,"type":{"family":"TimestampTZFamily","oid":1184}},{"name":"fingerprint_id","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"app_name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"node_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"agg_interval","id":5,"type":{"family":"IntervalFamily","oid":1186,"intervalDurationField":{}}},{"name":"metadata","id":6,"type":{"family":"JsonFamily","oid":3802}},{"name":"statistics","id":7,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","id":8,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(crdb_internal.datums_to_bytes(aggregated_ts, app_name, fingerprint_id, node_id)), _:::INT8)"},{"name":"execution_count","id":9,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)::INT8"},{"name":"service_latency","id":10,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"cpu_sql_nanos","id":11,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"contention_time","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"total_estimated_execution_time","id":13,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8 * (((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8"},{"name":"p99_latency","id":14,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id","agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"columnIds":[8,1,2,3,4,5,6,7,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"keyColumnIds":[8,1,2,3,4],"storeColumnIds":[5,6,7,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","shardBuckets":8,"columnNames":["aggregated_ts","app_name","fingerprint_id","node_id"]},"geoConfig":{},"constraintId":1},"indexes":[{"name":"fingerprint_stats_idx","id":2,"version":3,"keyColumnNames":["fingerprint_id"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[8,1,3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"execution_count_idx","id":3,"version":3,"keyColumnNames":["aggregated_ts","app_name","execution_count"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,9],"keySuffixColumnIds":[8,2,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"service_latency_idx","id":4,"version":3,"keyColumnNames":["aggregated_ts","app_name","service_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,10],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[10],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"cpu_sql_nanos_idx","id":5,"version":3,"keyColumnNames":["aggregated_ts","app_name","cpu_sql_nanos"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,11],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[11],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"contention_time_idx","id":6,"version":3,"keyColumnNames":["aggregated_ts","app_name","contention_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,12],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[12],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"total_estimated_execution_time_idx","id":7,"version":3,"keyColumnNames":["aggregated_ts","app_name","total_estimated_execution_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,13],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[13],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"p99_latency_idx","id":8,"version":3,"keyColumnNames":["aggregated_ts","app_name","p99_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,14],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[14],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"}],"nextIndexId":9,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","columnIds":[8],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} +{"table":{"name":"tenant_tasks","id":60,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"issuer","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"task_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"created","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"payload_id","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"owner","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":7,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["tenant_id","issuer","task_id","created","payload_id","owner","owner_id"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","issuer","task_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["created","payload_id","owner","owner_id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"tenant_usage","id":45,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"instance_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"next_instance_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"last_update","id":4,"type":{"family":"TimestampFamily","oid":1114}},{"name":"ru_burst_limit","id":5,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_refill_rate","id":6,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_current","id":7,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_share_sum","id":8,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"total_consumption","id":9,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_lease","id":10,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_seq","id":11,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true},{"name":"instance_shares","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_rates","id":13,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"next_rates","id":14,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["tenant_id","instance_id","next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"columnIds":[1,2,3,4,5,6,7,8,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","instance_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5,6,7,8,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"excludeDataFromBackup":true,"nextConstraintId":2}} {"table":{"name":"web_sessions","id":19,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20},"defaultExpr":"unique_rowid()"},{"name":"hashedSecret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"username","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"createdAt","id":4,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"expiresAt","id":5,"type":{"family":"TimestampFamily","oid":1114}},{"name":"revokedAt","id":6,"type":{"family":"TimestampFamily","oid":1114},"nullable":true},{"name":"lastUsedAt","id":7,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"auditInfo","id":8,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"user_id","id":9,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":10,"families":[{"name":"fam_0_id_hashedSecret_username_createdAt_expiresAt_revokedAt_lastUsedAt_auditInfo","columnNames":["id","hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"columnIds":[1,2,3,4,5,6,7,8,9]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8,9],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"indexes":[{"name":"web_sessions_expiresAt_idx","id":2,"version":3,"keyColumnNames":["expiresAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[5],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_createdAt_idx","id":3,"version":3,"keyColumnNames":["createdAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[4],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_revokedAt_idx","id":4,"version":3,"keyColumnNames":["revokedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[6],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_lastUsedAt_idx","id":5,"version":3,"keyColumnNames":["lastUsedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[7],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}}],"nextIndexId":6,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"zones","id":5,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"config","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_config","id":2,"columnNames":["config"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["config"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"schema":{"name":"public","id":103,"modificationTime":{"wallTime":"0"},"version":"1","parentId":102,"privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"516"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3}}} schema_telemetry snapshot_id=7cd8a9ae-f35c-4cd2-970a-757174600874 max_records=10 ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"table":{"name":"descriptor_id_seq","id":7,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"1","maxValue":"9223372036854775807","start":"1","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} -{"table":{"name":"locations","id":21,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"localityKey","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"localityValue","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"latitude","id":3,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}},{"name":"longitude","id":4,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}}],"nextColumnId":5,"families":[{"name":"fam_0_localityKey_localityValue_latitude_longitude","columnNames":["localityKey","localityValue","latitude","longitude"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["localityKey","localityValue"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["latitude","longitude"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"role_id_seq","id":48,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"800","withGrantOption":"800"},{"userProto":"root","privileges":"800","withGrantOption":"800"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"100","maxValue":"2147483647","start":"100","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} +{"table":{"name":"eventlog","id":12,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"timestamp","id":1,"type":{"family":"TimestampFamily","oid":1114}},{"name":"eventType","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"targetID","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"reportingID","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"info","id":5,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"uniqueID","id":6,"type":{"family":"BytesFamily","oid":17},"defaultExpr":"uuid_v4()"}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["timestamp","uniqueID"],"columnIds":[1,6]},{"name":"fam_2_eventType","id":2,"columnNames":["eventType"],"columnIds":[2],"defaultColumnId":2},{"name":"fam_3_targetID","id":3,"columnNames":["targetID"],"columnIds":[3],"defaultColumnId":3},{"name":"fam_4_reportingID","id":4,"columnNames":["reportingID"],"columnIds":[4],"defaultColumnId":4},{"name":"fam_5_info","id":5,"columnNames":["info"],"columnIds":[5],"defaultColumnId":5}],"nextFamilyId":6,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["timestamp","uniqueID"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["eventType","targetID","reportingID","info"],"keyColumnIds":[1,6],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"join_tokens","id":41,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"secret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"expiration","id":3,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":4,"families":[{"name":"primary","columnNames":["id","secret","expiration"],"columnIds":[1,2,3]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["secret","expiration"],"keyColumnIds":[1],"storeColumnIds":[2,3],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"span_stats_unique_keys","id":55,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950},"defaultExpr":"gen_random_uuid()"},{"name":"key_bytes","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id","key_bytes"],"columnIds":[1,2],"defaultColumnId":2}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["key_bytes"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"unique_keys_key_bytes_idx","id":2,"unique":true,"version":3,"keyColumnNames":["key_bytes"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"task_payloads","id":59,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"created","id":2,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":4,"type":{"family":"OidFamily","oid":26}},{"name":"min_version","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"description","id":6,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"type","id":7,"type":{"family":"StringFamily","oid":25}},{"name":"value","id":8,"type":{"family":"BytesFamily","oid":17}}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","created","owner","owner_id","min_version","description","type","value"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["created","owner","owner_id","min_version","description","type","value"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"transaction_statistics","id":43,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"aggregated_ts","id":1,"type":{"family":"TimestampTZFamily","oid":1184}},{"name":"fingerprint_id","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"app_name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"node_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"agg_interval","id":5,"type":{"family":"IntervalFamily","oid":1186,"intervalDurationField":{}}},{"name":"metadata","id":6,"type":{"family":"JsonFamily","oid":3802}},{"name":"statistics","id":7,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","id":8,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(crdb_internal.datums_to_bytes(aggregated_ts, app_name, fingerprint_id, node_id)), _:::INT8)"},{"name":"execution_count","id":9,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)::INT8"},{"name":"service_latency","id":10,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"cpu_sql_nanos","id":11,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"contention_time","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"total_estimated_execution_time","id":13,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8 * (((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8"},{"name":"p99_latency","id":14,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id","agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"columnIds":[8,1,2,3,4,5,6,7,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"keyColumnIds":[8,1,2,3,4],"storeColumnIds":[5,6,7,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","shardBuckets":8,"columnNames":["aggregated_ts","app_name","fingerprint_id","node_id"]},"geoConfig":{},"constraintId":1},"indexes":[{"name":"fingerprint_stats_idx","id":2,"version":3,"keyColumnNames":["fingerprint_id"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[8,1,3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"execution_count_idx","id":3,"version":3,"keyColumnNames":["aggregated_ts","app_name","execution_count"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,9],"keySuffixColumnIds":[8,2,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"service_latency_idx","id":4,"version":3,"keyColumnNames":["aggregated_ts","app_name","service_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,10],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[10],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"cpu_sql_nanos_idx","id":5,"version":3,"keyColumnNames":["aggregated_ts","app_name","cpu_sql_nanos"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,11],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[11],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"contention_time_idx","id":6,"version":3,"keyColumnNames":["aggregated_ts","app_name","contention_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,12],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[12],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"total_estimated_execution_time_idx","id":7,"version":3,"keyColumnNames":["aggregated_ts","app_name","total_estimated_execution_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,13],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[13],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"p99_latency_idx","id":8,"version":3,"keyColumnNames":["aggregated_ts","app_name","p99_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,14],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[14],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"}],"nextIndexId":9,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","columnIds":[8],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} +{"table":{"name":"tenant_tasks","id":60,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"issuer","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"task_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"created","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"payload_id","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"owner","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":7,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["tenant_id","issuer","task_id","created","payload_id","owner","owner_id"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","issuer","task_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["created","payload_id","owner","owner_id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"tenant_usage","id":45,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"instance_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"next_instance_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"last_update","id":4,"type":{"family":"TimestampFamily","oid":1114}},{"name":"ru_burst_limit","id":5,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_refill_rate","id":6,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_current","id":7,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_share_sum","id":8,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"total_consumption","id":9,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_lease","id":10,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_seq","id":11,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true},{"name":"instance_shares","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_rates","id":13,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"next_rates","id":14,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["tenant_id","instance_id","next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"columnIds":[1,2,3,4,5,6,7,8,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","instance_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5,6,7,8,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"excludeDataFromBackup":true,"nextConstraintId":2}} {"table":{"name":"web_sessions","id":19,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20},"defaultExpr":"unique_rowid()"},{"name":"hashedSecret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"username","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"createdAt","id":4,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"expiresAt","id":5,"type":{"family":"TimestampFamily","oid":1114}},{"name":"revokedAt","id":6,"type":{"family":"TimestampFamily","oid":1114},"nullable":true},{"name":"lastUsedAt","id":7,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"auditInfo","id":8,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"user_id","id":9,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":10,"families":[{"name":"fam_0_id_hashedSecret_username_createdAt_expiresAt_revokedAt_lastUsedAt_auditInfo","columnNames":["id","hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"columnIds":[1,2,3,4,5,6,7,8,9]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8,9],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"indexes":[{"name":"web_sessions_expiresAt_idx","id":2,"version":3,"keyColumnNames":["expiresAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[5],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_createdAt_idx","id":3,"version":3,"keyColumnNames":["createdAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[4],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_revokedAt_idx","id":4,"version":3,"keyColumnNames":["revokedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[6],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_lastUsedAt_idx","id":5,"version":3,"keyColumnNames":["lastUsedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[7],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}}],"nextIndexId":6,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"zones","id":5,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"config","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_config","id":2,"columnNames":["config"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["config"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"schema":{"name":"public","id":103,"modificationTime":{"wallTime":"0"},"version":"1","parentId":102,"privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"516"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3}}} diff --git a/pkg/sql/catalog/systemschema_test/testdata/bootstrap_tenant b/pkg/sql/catalog/systemschema_test/testdata/bootstrap_tenant index abad86c3336b..aa08046b524e 100644 --- a/pkg/sql/catalog/systemschema_test/testdata/bootstrap_tenant +++ b/pkg/sql/catalog/systemschema_test/testdata/bootstrap_tenant @@ -637,12 +637,22 @@ CREATE TABLE public.statement_execution_insights ( INDEX statement_fingerprint_id_idx (statement_fingerprint_id ASC, start_time DESC, end_time DESC), INDEX time_range_idx (start_time DESC, end_time DESC) USING HASH WITH (bucket_count=16) ); +CREATE TABLE public.prepared_transactions ( + global_id STRING NOT NULL, + transaction_id UUID NOT NULL, + transaction_key BYTES NULL, + prepared TIMESTAMPTZ NOT NULL DEFAULT now():::TIMESTAMPTZ, + owner STRING NOT NULL, + database STRING NOT NULL, + heuristic STRING NULL, + CONSTRAINT "primary" PRIMARY KEY (global_id ASC) +); schema_telemetry ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"database":{"name":"postgres","id":102,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":103}},"defaultPrivileges":{}}} -{"database":{"name":"system","id":1,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2048","withGrantOption":"2048"},{"userProto":"root","privileges":"2048","withGrantOption":"2048"}],"ownerProto":"node","version":3},"systemDatabaseSchemaVersion":{"majorVal":1000024,"minorVal":2,"internal":6}}} +{"database":{"name":"system","id":1,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2048","withGrantOption":"2048"},{"userProto":"root","privileges":"2048","withGrantOption":"2048"}],"ownerProto":"node","version":3},"systemDatabaseSchemaVersion":{"majorVal":1000024,"minorVal":2,"internal":8}}} {"table":{"name":"comments","id":24,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"type","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"object_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"sub_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"comment","id":4,"type":{"family":"StringFamily","oid":25}}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["type","object_id","sub_id"],"columnIds":[1,2,3]},{"name":"fam_4_comment","id":4,"columnNames":["comment"],"columnIds":[4],"defaultColumnId":4}],"nextFamilyId":5,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["type","object_id","sub_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["comment"],"keyColumnIds":[1,2,3],"storeColumnIds":[4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"public","privileges":"32"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"database_role_settings","id":44,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"database_id","id":1,"type":{"family":"OidFamily","oid":26}},{"name":"role_name","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"settings","id":3,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"role_id","id":4,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["database_id","role_name","settings","role_id"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["database_id","role_name"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["settings","role_id"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"database_role_settings_database_id_role_id_key","id":2,"unique":true,"version":3,"keyColumnNames":["database_id","role_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["settings"],"keyColumnIds":[1,4],"keySuffixColumnIds":[2],"storeColumnIds":[3],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"descriptor","id":3,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"descriptor","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_descriptor","id":2,"columnNames":["descriptor"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["descriptor"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} @@ -657,6 +667,7 @@ schema_telemetry {"table":{"name":"migrations","id":40,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"major","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"minor","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"patch","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"internal","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"completed_at","id":5,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["major","minor","patch","internal","completed_at"],"columnIds":[1,2,3,4,5],"defaultColumnId":5}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["major","minor","patch","internal"],"keyColumnDirections":["ASC","ASC","ASC","ASC"],"storeColumnNames":["completed_at"],"keyColumnIds":[1,2,3,4],"storeColumnIds":[5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"mvcc_statistics","id":64,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"created_at","id":1,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"database_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"table_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"index_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"statistics","id":5,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_created_at_database_id_index_id_table_id_shard_16","id":6,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(md5(crdb_internal.datums_to_bytes(created_at))), _:::INT8)","virtual":true}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["created_at","database_id","table_id","index_id","statistics"],"columnIds":[1,2,3,4,5],"defaultColumnId":5}],"nextFamilyId":1,"primaryIndex":{"name":"mvcc_statistics_pkey","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_created_at_database_id_index_id_table_id_shard_16","created_at","database_id","table_id","index_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["statistics"],"keyColumnIds":[6,1,2,3,4],"storeColumnIds":[5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_created_at_database_id_index_id_table_id_shard_16","shardBuckets":16,"columnNames":["created_at","database_id","index_id","table_id"]},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_created_at_database_id_index_id_table_id_shard_16 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_created_at_database_id_index_id_table_id_shard_16","columnIds":[6],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"namespace","id":30,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"parentID","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"parentSchemaID","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"id","id":4,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true}],"nextColumnId":5,"families":[{"name":"primary","columnNames":["parentID","parentSchemaID","name"],"columnIds":[1,2,3]},{"name":"fam_4_id","id":4,"columnNames":["id"],"columnIds":[4],"defaultColumnId":4}],"nextFamilyId":5,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["parentID","parentSchemaID","name"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"prepared_transactions","id":67,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"global_id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"transaction_id","id":2,"type":{"family":"UuidFamily","oid":2950}},{"name":"transaction_key","id":3,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"prepared","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"database","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"heuristic","id":7,"type":{"family":"StringFamily","oid":25},"nullable":true}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["global_id","transaction_id","transaction_key","prepared","owner","database","heuristic"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["global_id"],"keyColumnDirections":["ASC"],"storeColumnNames":["transaction_id","transaction_key","prepared","owner","database","heuristic"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"privileges","id":52,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"username","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"path","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"privileges","id":3,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"grant_options","id":4,"type":{"family":"ArrayFamily","arrayElemType":"StringFamily","oid":1009,"arrayContents":{"family":"StringFamily","oid":25}}},{"name":"user_id","id":5,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["username","path","privileges","grant_options","user_id"],"columnIds":[1,2,3,4,5]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["username","path"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options","user_id"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":3},"indexes":[{"name":"privileges_path_user_id_key","id":2,"unique":true,"version":3,"keyColumnNames":["path","user_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options"],"keyColumnIds":[2,5],"keySuffixColumnIds":[1],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1},{"name":"privileges_path_username_key","id":3,"unique":true,"version":3,"keyColumnNames":["path","username"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["privileges","grant_options"],"keyColumnIds":[2,1],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":2}],"nextIndexId":4,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":4}} {"table":{"name":"protected_ts_meta","id":31,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"singleton","id":1,"type":{"oid":16},"defaultExpr":"true"},{"name":"version","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"num_records","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"num_spans","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"total_bytes","id":5,"type":{"family":"IntFamily","width":64,"oid":20}}],"nextColumnId":6,"families":[{"name":"primary","columnNames":["singleton","version","num_records","num_spans","total_bytes"],"columnIds":[1,2,3,4,5]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["singleton"],"keyColumnDirections":["ASC"],"storeColumnNames":["version","num_records","num_spans","total_bytes"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"singleton","name":"check_singleton","columnIds":[1],"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"protected_ts_records","id":32,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"ts","id":2,"type":{"family":"DecimalFamily","oid":1700}},{"name":"meta_type","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"meta","id":4,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"num_spans","id":5,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"spans","id":6,"type":{"family":"BytesFamily","oid":17}},{"name":"verified","id":7,"type":{"oid":16},"defaultExpr":"false"},{"name":"target","id":8,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","ts","meta_type","meta","num_spans","spans","verified","target"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["ts","meta_type","meta","num_spans","spans","verified","target"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} @@ -706,24 +717,22 @@ schema_telemetry snapshot_id=7cd8a9ae-f35c-4cd2-970a-757174600874 max_records=10 ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"table":{"name":"descriptor_id_seq","id":7,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"1","maxValue":"9223372036854775807","start":"1","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} -{"table":{"name":"locations","id":21,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"localityKey","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"localityValue","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"latitude","id":3,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}},{"name":"longitude","id":4,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}}],"nextColumnId":5,"families":[{"name":"fam_0_localityKey_localityValue_latitude_longitude","columnNames":["localityKey","localityValue","latitude","longitude"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["localityKey","localityValue"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["latitude","longitude"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"role_id_seq","id":48,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"800","withGrantOption":"800"},{"userProto":"root","privileges":"800","withGrantOption":"800"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"100","maxValue":"2147483647","start":"100","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} +{"table":{"name":"eventlog","id":12,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"timestamp","id":1,"type":{"family":"TimestampFamily","oid":1114}},{"name":"eventType","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"targetID","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"reportingID","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"info","id":5,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"uniqueID","id":6,"type":{"family":"BytesFamily","oid":17},"defaultExpr":"uuid_v4()"}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["timestamp","uniqueID"],"columnIds":[1,6]},{"name":"fam_2_eventType","id":2,"columnNames":["eventType"],"columnIds":[2],"defaultColumnId":2},{"name":"fam_3_targetID","id":3,"columnNames":["targetID"],"columnIds":[3],"defaultColumnId":3},{"name":"fam_4_reportingID","id":4,"columnNames":["reportingID"],"columnIds":[4],"defaultColumnId":4},{"name":"fam_5_info","id":5,"columnNames":["info"],"columnIds":[5],"defaultColumnId":5}],"nextFamilyId":6,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["timestamp","uniqueID"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["eventType","targetID","reportingID","info"],"keyColumnIds":[1,6],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"join_tokens","id":41,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"secret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"expiration","id":3,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":4,"families":[{"name":"primary","columnNames":["id","secret","expiration"],"columnIds":[1,2,3]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["secret","expiration"],"keyColumnIds":[1],"storeColumnIds":[2,3],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"span_stats_unique_keys","id":55,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950},"defaultExpr":"gen_random_uuid()"},{"name":"key_bytes","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id","key_bytes"],"columnIds":[1,2],"defaultColumnId":2}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["key_bytes"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"unique_keys_key_bytes_idx","id":2,"unique":true,"version":3,"keyColumnNames":["key_bytes"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"task_payloads","id":59,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"created","id":2,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":4,"type":{"family":"OidFamily","oid":26}},{"name":"min_version","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"description","id":6,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"type","id":7,"type":{"family":"StringFamily","oid":25}},{"name":"value","id":8,"type":{"family":"BytesFamily","oid":17}}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","created","owner","owner_id","min_version","description","type","value"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["created","owner","owner_id","min_version","description","type","value"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"transaction_statistics","id":43,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"aggregated_ts","id":1,"type":{"family":"TimestampTZFamily","oid":1184}},{"name":"fingerprint_id","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"app_name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"node_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"agg_interval","id":5,"type":{"family":"IntervalFamily","oid":1186,"intervalDurationField":{}}},{"name":"metadata","id":6,"type":{"family":"JsonFamily","oid":3802}},{"name":"statistics","id":7,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","id":8,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(crdb_internal.datums_to_bytes(aggregated_ts, app_name, fingerprint_id, node_id)), _:::INT8)"},{"name":"execution_count","id":9,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)::INT8"},{"name":"service_latency","id":10,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"cpu_sql_nanos","id":11,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"contention_time","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"total_estimated_execution_time","id":13,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8 * (((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8"},{"name":"p99_latency","id":14,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id","agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"columnIds":[8,1,2,3,4,5,6,7,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"keyColumnIds":[8,1,2,3,4],"storeColumnIds":[5,6,7,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","shardBuckets":8,"columnNames":["aggregated_ts","app_name","fingerprint_id","node_id"]},"geoConfig":{},"constraintId":1},"indexes":[{"name":"fingerprint_stats_idx","id":2,"version":3,"keyColumnNames":["fingerprint_id"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[8,1,3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"execution_count_idx","id":3,"version":3,"keyColumnNames":["aggregated_ts","app_name","execution_count"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,9],"keySuffixColumnIds":[8,2,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"service_latency_idx","id":4,"version":3,"keyColumnNames":["aggregated_ts","app_name","service_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,10],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[10],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"cpu_sql_nanos_idx","id":5,"version":3,"keyColumnNames":["aggregated_ts","app_name","cpu_sql_nanos"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,11],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[11],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"contention_time_idx","id":6,"version":3,"keyColumnNames":["aggregated_ts","app_name","contention_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,12],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[12],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"total_estimated_execution_time_idx","id":7,"version":3,"keyColumnNames":["aggregated_ts","app_name","total_estimated_execution_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,13],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[13],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"p99_latency_idx","id":8,"version":3,"keyColumnNames":["aggregated_ts","app_name","p99_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,14],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[14],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"}],"nextIndexId":9,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","columnIds":[8],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} +{"table":{"name":"tenant_tasks","id":60,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"issuer","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"task_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"created","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"payload_id","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"owner","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":7,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["tenant_id","issuer","task_id","created","payload_id","owner","owner_id"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","issuer","task_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["created","payload_id","owner","owner_id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"tenant_usage","id":45,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"instance_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"next_instance_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"last_update","id":4,"type":{"family":"TimestampFamily","oid":1114}},{"name":"ru_burst_limit","id":5,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_refill_rate","id":6,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_current","id":7,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_share_sum","id":8,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"total_consumption","id":9,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_lease","id":10,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_seq","id":11,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true},{"name":"instance_shares","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_rates","id":13,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"next_rates","id":14,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["tenant_id","instance_id","next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"columnIds":[1,2,3,4,5,6,7,8,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","instance_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5,6,7,8,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"excludeDataFromBackup":true,"nextConstraintId":2}} {"table":{"name":"web_sessions","id":19,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20},"defaultExpr":"unique_rowid()"},{"name":"hashedSecret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"username","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"createdAt","id":4,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"expiresAt","id":5,"type":{"family":"TimestampFamily","oid":1114}},{"name":"revokedAt","id":6,"type":{"family":"TimestampFamily","oid":1114},"nullable":true},{"name":"lastUsedAt","id":7,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"auditInfo","id":8,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"user_id","id":9,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":10,"families":[{"name":"fam_0_id_hashedSecret_username_createdAt_expiresAt_revokedAt_lastUsedAt_auditInfo","columnNames":["id","hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"columnIds":[1,2,3,4,5,6,7,8,9]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8,9],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"indexes":[{"name":"web_sessions_expiresAt_idx","id":2,"version":3,"keyColumnNames":["expiresAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[5],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_createdAt_idx","id":3,"version":3,"keyColumnNames":["createdAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[4],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_revokedAt_idx","id":4,"version":3,"keyColumnNames":["revokedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[6],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_lastUsedAt_idx","id":5,"version":3,"keyColumnNames":["lastUsedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[7],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}}],"nextIndexId":6,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"zones","id":5,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"config","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_config","id":2,"columnNames":["config"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["config"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"schema":{"name":"public","id":103,"modificationTime":{"wallTime":"0"},"version":"1","parentId":102,"privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"516"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3}}} schema_telemetry snapshot_id=7cd8a9ae-f35c-4cd2-970a-757174600874 max_records=10 ---- {"database":{"name":"defaultdb","id":100,"modificationTime":{"wallTime":"0"},"version":"1","privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"2048"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3},"schemas":{"public":{"id":101}},"defaultPrivileges":{}}} {"table":{"name":"descriptor_id_seq","id":7,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"1","maxValue":"9223372036854775807","start":"1","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} -{"table":{"name":"locations","id":21,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"localityKey","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"localityValue","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"latitude","id":3,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}},{"name":"longitude","id":4,"type":{"family":"DecimalFamily","width":15,"precision":18,"oid":1700}}],"nextColumnId":5,"families":[{"name":"fam_0_localityKey_localityValue_latitude_longitude","columnNames":["localityKey","localityValue","latitude","longitude"],"columnIds":[1,2,3,4]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["localityKey","localityValue"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["latitude","longitude"],"keyColumnIds":[1,2],"storeColumnIds":[3,4],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"role_id_seq","id":48,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"value","id":1,"type":{"family":"IntFamily","width":64,"oid":20}}],"families":[{"name":"primary","columnNames":["value"],"columnIds":[1],"defaultColumnId":1}],"primaryIndex":{"name":"primary","id":1,"version":4,"keyColumnNames":["value"],"keyColumnDirections":["ASC"],"keyColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{}},"privileges":{"users":[{"userProto":"admin","privileges":"800","withGrantOption":"800"},{"userProto":"root","privileges":"800","withGrantOption":"800"}],"ownerProto":"node","version":3},"formatVersion":3,"sequenceOpts":{"increment":"1","minValue":"100","maxValue":"2147483647","start":"100","sequenceOwner":{},"cacheSize":"1"},"replacementOf":{"time":{}},"createAsOfTime":{}}} +{"table":{"name":"eventlog","id":12,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"timestamp","id":1,"type":{"family":"TimestampFamily","oid":1114}},{"name":"eventType","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"targetID","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"reportingID","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"info","id":5,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"uniqueID","id":6,"type":{"family":"BytesFamily","oid":17},"defaultExpr":"uuid_v4()"}],"nextColumnId":7,"families":[{"name":"primary","columnNames":["timestamp","uniqueID"],"columnIds":[1,6]},{"name":"fam_2_eventType","id":2,"columnNames":["eventType"],"columnIds":[2],"defaultColumnId":2},{"name":"fam_3_targetID","id":3,"columnNames":["targetID"],"columnIds":[3],"defaultColumnId":3},{"name":"fam_4_reportingID","id":4,"columnNames":["reportingID"],"columnIds":[4],"defaultColumnId":4},{"name":"fam_5_info","id":5,"columnNames":["info"],"columnIds":[5],"defaultColumnId":5}],"nextFamilyId":6,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["timestamp","uniqueID"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["eventType","targetID","reportingID","info"],"keyColumnIds":[1,6],"storeColumnIds":[2,3,4,5],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"join_tokens","id":41,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950}},{"name":"secret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"expiration","id":3,"type":{"family":"TimestampTZFamily","oid":1184}}],"nextColumnId":4,"families":[{"name":"primary","columnNames":["id","secret","expiration"],"columnIds":[1,2,3]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["secret","expiration"],"keyColumnIds":[1],"storeColumnIds":[2,3],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} {"table":{"name":"span_stats_unique_keys","id":55,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"UuidFamily","oid":2950},"defaultExpr":"gen_random_uuid()"},{"name":"key_bytes","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id","key_bytes"],"columnIds":[1,2],"defaultColumnId":2}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["key_bytes"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":2},"indexes":[{"name":"unique_keys_key_bytes_idx","id":2,"unique":true,"version":3,"keyColumnNames":["key_bytes"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"constraintId":1}],"nextIndexId":3,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} {"table":{"name":"task_payloads","id":59,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"StringFamily","oid":25}},{"name":"created","id":2,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"owner","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":4,"type":{"family":"OidFamily","oid":26}},{"name":"min_version","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"description","id":6,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"type","id":7,"type":{"family":"StringFamily","oid":25}},{"name":"value","id":8,"type":{"family":"BytesFamily","oid":17}}],"nextColumnId":9,"families":[{"name":"primary","columnNames":["id","created","owner","owner_id","min_version","description","type","value"],"columnIds":[1,2,3,4,5,6,7,8]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["created","owner","owner_id","min_version","description","type","value"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"transaction_statistics","id":43,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"aggregated_ts","id":1,"type":{"family":"TimestampTZFamily","oid":1184}},{"name":"fingerprint_id","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"app_name","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"node_id","id":4,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"agg_interval","id":5,"type":{"family":"IntervalFamily","oid":1186,"intervalDurationField":{}}},{"name":"metadata","id":6,"type":{"family":"JsonFamily","oid":3802}},{"name":"statistics","id":7,"type":{"family":"JsonFamily","oid":3802}},{"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","id":8,"type":{"family":"IntFamily","width":32,"oid":23},"hidden":true,"computeExpr":"mod(fnv32(crdb_internal.datums_to_bytes(aggregated_ts, app_name, fingerprint_id, node_id)), _:::INT8)"},{"name":"execution_count","id":9,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)::INT8"},{"name":"service_latency","id":10,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"cpu_sql_nanos","id":11,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"contention_time","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"},{"name":"total_estimated_execution_time","id":13,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"((statistics-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8 * (((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e\u003e'_':::STRING)::FLOAT8"},{"name":"p99_latency","id":14,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true,"computeExpr":"(((statistics-\u003e'_':::STRING)-\u003e'_':::STRING)-\u003e'_':::STRING)::FLOAT8"}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id","agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"columnIds":[8,1,2,3,4,5,6,7,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","aggregated_ts","fingerprint_id","app_name","node_id"],"keyColumnDirections":["ASC","ASC","ASC","ASC","ASC"],"storeColumnNames":["agg_interval","metadata","statistics","execution_count","service_latency","cpu_sql_nanos","contention_time","total_estimated_execution_time","p99_latency"],"keyColumnIds":[8,1,2,3,4],"storeColumnIds":[5,6,7,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{"isSharded":true,"name":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","shardBuckets":8,"columnNames":["aggregated_ts","app_name","fingerprint_id","node_id"]},"geoConfig":{},"constraintId":1},"indexes":[{"name":"fingerprint_stats_idx","id":2,"version":3,"keyColumnNames":["fingerprint_id"],"keyColumnDirections":["ASC"],"keyColumnIds":[2],"keySuffixColumnIds":[8,1,3,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"execution_count_idx","id":3,"version":3,"keyColumnNames":["aggregated_ts","app_name","execution_count"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,9],"keySuffixColumnIds":[8,2,4],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"service_latency_idx","id":4,"version":3,"keyColumnNames":["aggregated_ts","app_name","service_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,10],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[10],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"cpu_sql_nanos_idx","id":5,"version":3,"keyColumnNames":["aggregated_ts","app_name","cpu_sql_nanos"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,11],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[11],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"contention_time_idx","id":6,"version":3,"keyColumnNames":["aggregated_ts","app_name","contention_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,12],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[12],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"total_estimated_execution_time_idx","id":7,"version":3,"keyColumnNames":["aggregated_ts","app_name","total_estimated_execution_time"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,13],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[13],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"},{"name":"p99_latency_idx","id":8,"version":3,"keyColumnNames":["aggregated_ts","app_name","p99_latency"],"keyColumnDirections":["ASC","ASC","DESC"],"keyColumnIds":[1,3,14],"keySuffixColumnIds":[8,2,4],"compositeColumnIds":[14],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{},"predicate":"app_name NOT LIKE '_':::STRING"}],"nextIndexId":9,"privileges":{"users":[{"userProto":"admin","privileges":"32","withGrantOption":"32"},{"userProto":"root","privileges":"32","withGrantOption":"32"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"checks":[{"expr":"crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8 IN (_:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8, _:::INT8)","name":"check_crdb_internal_aggregated_ts_app_name_fingerprint_id_node_id_shard_8","columnIds":[8],"fromHashShardedColumn":true,"constraintId":2}],"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":3}} +{"table":{"name":"tenant_tasks","id":60,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"issuer","id":2,"type":{"family":"StringFamily","oid":25}},{"name":"task_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"created","id":4,"type":{"family":"TimestampTZFamily","oid":1184},"defaultExpr":"now():::TIMESTAMPTZ"},{"name":"payload_id","id":5,"type":{"family":"StringFamily","oid":25}},{"name":"owner","id":6,"type":{"family":"StringFamily","oid":25}},{"name":"owner_id","id":7,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":8,"families":[{"name":"primary","columnNames":["tenant_id","issuer","task_id","created","payload_id","owner","owner_id"],"columnIds":[1,2,3,4,5,6,7]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","issuer","task_id"],"keyColumnDirections":["ASC","ASC","ASC"],"storeColumnNames":["created","payload_id","owner","owner_id"],"keyColumnIds":[1,2,3],"storeColumnIds":[4,5,6,7],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} +{"table":{"name":"tenant_usage","id":45,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"tenant_id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"instance_id","id":2,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"next_instance_id","id":3,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"last_update","id":4,"type":{"family":"TimestampFamily","oid":1114}},{"name":"ru_burst_limit","id":5,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_refill_rate","id":6,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"ru_current","id":7,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_share_sum","id":8,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"total_consumption","id":9,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_lease","id":10,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"instance_seq","id":11,"type":{"family":"IntFamily","width":64,"oid":20},"nullable":true},{"name":"instance_shares","id":12,"type":{"family":"FloatFamily","width":64,"oid":701},"nullable":true},{"name":"current_rates","id":13,"type":{"family":"BytesFamily","oid":17},"nullable":true},{"name":"next_rates","id":14,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":15,"families":[{"name":"primary","columnNames":["tenant_id","instance_id","next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"columnIds":[1,2,3,4,5,6,7,8,9,10,11,12,13,14]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["tenant_id","instance_id"],"keyColumnDirections":["ASC","ASC"],"storeColumnNames":["next_instance_id","last_update","ru_burst_limit","ru_refill_rate","ru_current","current_share_sum","total_consumption","instance_lease","instance_seq","instance_shares","current_rates","next_rates"],"keyColumnIds":[1,2],"storeColumnIds":[3,4,5,6,7,8,9,10,11,12,13,14],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"excludeDataFromBackup":true,"nextConstraintId":2}} {"table":{"name":"web_sessions","id":19,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20},"defaultExpr":"unique_rowid()"},{"name":"hashedSecret","id":2,"type":{"family":"BytesFamily","oid":17}},{"name":"username","id":3,"type":{"family":"StringFamily","oid":25}},{"name":"createdAt","id":4,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"expiresAt","id":5,"type":{"family":"TimestampFamily","oid":1114}},{"name":"revokedAt","id":6,"type":{"family":"TimestampFamily","oid":1114},"nullable":true},{"name":"lastUsedAt","id":7,"type":{"family":"TimestampFamily","oid":1114},"defaultExpr":"now():::TIMESTAMP"},{"name":"auditInfo","id":8,"type":{"family":"StringFamily","oid":25},"nullable":true},{"name":"user_id","id":9,"type":{"family":"OidFamily","oid":26}}],"nextColumnId":10,"families":[{"name":"fam_0_id_hashedSecret_username_createdAt_expiresAt_revokedAt_lastUsedAt_auditInfo","columnNames":["id","hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"columnIds":[1,2,3,4,5,6,7,8,9]}],"nextFamilyId":1,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["hashedSecret","username","createdAt","expiresAt","revokedAt","lastUsedAt","auditInfo","user_id"],"keyColumnIds":[1],"storeColumnIds":[2,3,4,5,6,7,8,9],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"indexes":[{"name":"web_sessions_expiresAt_idx","id":2,"version":3,"keyColumnNames":["expiresAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[5],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_createdAt_idx","id":3,"version":3,"keyColumnNames":["createdAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[4],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_revokedAt_idx","id":4,"version":3,"keyColumnNames":["revokedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[6],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}},{"name":"web_sessions_lastUsedAt_idx","id":5,"version":3,"keyColumnNames":["lastUsedAt"],"keyColumnDirections":["ASC"],"keyColumnIds":[7],"keySuffixColumnIds":[1],"foreignKey":{},"interleave":{},"partitioning":{},"sharded":{},"geoConfig":{}}],"nextIndexId":6,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"table":{"name":"zones","id":5,"version":"1","modificationTime":{},"parentId":1,"unexposedParentSchemaId":29,"columns":[{"name":"id","id":1,"type":{"family":"IntFamily","width":64,"oid":20}},{"name":"config","id":2,"type":{"family":"BytesFamily","oid":17},"nullable":true}],"nextColumnId":3,"families":[{"name":"primary","columnNames":["id"],"columnIds":[1]},{"name":"fam_2_config","id":2,"columnNames":["config"],"columnIds":[2],"defaultColumnId":2}],"nextFamilyId":3,"primaryIndex":{"name":"primary","id":1,"unique":true,"version":4,"keyColumnNames":["id"],"keyColumnDirections":["ASC"],"storeColumnNames":["config"],"keyColumnIds":[1],"storeColumnIds":[2],"foreignKey":{},"interleave":{},"partitioning":{},"encodingType":1,"sharded":{},"geoConfig":{},"constraintId":1},"nextIndexId":2,"privileges":{"users":[{"userProto":"admin","privileges":"480","withGrantOption":"480"},{"userProto":"root","privileges":"480","withGrantOption":"480"}],"ownerProto":"node","version":3},"nextMutationId":1,"formatVersion":3,"replacementOf":{"time":{}},"createAsOfTime":{},"nextConstraintId":2}} -{"schema":{"name":"public","id":103,"modificationTime":{"wallTime":"0"},"version":"1","parentId":102,"privileges":{"users":[{"userProto":"admin","privileges":"2","withGrantOption":"2"},{"userProto":"public","privileges":"516"},{"userProto":"root","privileges":"2","withGrantOption":"2"}],"ownerProto":"root","version":3}}} diff --git a/pkg/sql/explain_bundle.go b/pkg/sql/explain_bundle.go index a868c382b74d..7d520de9e6cb 100644 --- a/pkg/sql/explain_bundle.go +++ b/pkg/sql/explain_bundle.go @@ -1163,21 +1163,22 @@ func (c *stmtEnvCollector) PrintTableStats( // explicitly excluded from env.sql of the bundle (they were deemed unlikely to // be useful in investigations). var skipReadOnlySessionVar = map[string]struct{}{ - "crdb_version": {}, // version is included separately - "integer_datetimes": {}, - "lc_collate": {}, - "lc_ctype": {}, - "max_connections": {}, - "max_identifier_length": {}, - "max_index_keys": {}, - "server_encoding": {}, - "server_version": {}, - "server_version_num": {}, - "session_authorization": {}, - "session_user": {}, - "system_identity": {}, - "tracing": {}, - "virtual_cluster_name": {}, + "crdb_version": {}, // version is included separately + "integer_datetimes": {}, + "lc_collate": {}, + "lc_ctype": {}, + "max_connections": {}, + "max_identifier_length": {}, + "max_index_keys": {}, + "max_prepared_transactions": {}, + "server_encoding": {}, + "server_version": {}, + "server_version_num": {}, + "session_authorization": {}, + "session_user": {}, + "system_identity": {}, + "tracing": {}, + "virtual_cluster_name": {}, } // sessionVarNeedsQuotes contains all writable session variables that have diff --git a/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog b/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog index 44605fe6278e..1472232a2902 100644 --- a/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog +++ b/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog @@ -105,7 +105,7 @@ skipif config local-mixed-24.2 query IT SELECT id, strip_volatile(descriptor) FROM crdb_internal.kv_catalog_descriptor ORDER BY id ---- -1 {"database": {"id": 1, "name": "system", "privileges": {"ownerProto": "node", "users": [{"privileges": "2048", "userProto": "admin", "withGrantOption": "2048"}, {"privileges": "2048", "userProto": "root", "withGrantOption": "2048"}], "version": 3}, "systemDatabaseSchemaVersion": {"internal": 6, "majorVal": 1000024, "minorVal": 2}, "version": "1"}} +1 {"database": {"id": 1, "name": "system", "privileges": {"ownerProto": "node", "users": [{"privileges": "2048", "userProto": "admin", "withGrantOption": "2048"}, {"privileges": "2048", "userProto": "root", "withGrantOption": "2048"}], "version": 3}, "systemDatabaseSchemaVersion": {"internal": 8, "majorVal": 1000024, "minorVal": 2}, "version": "1"}} 3 {"table": {"columns": [{"id": 1, "name": "id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 2, "name": "descriptor", "nullable": true, "type": {"family": "BytesFamily", "oid": 17}}], "formatVersion": 3, "id": 3, "name": "descriptor", "nextColumnId": 3, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [1], "keyColumnNames": ["id"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [2], "storeColumnNames": ["descriptor"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "admin", "withGrantOption": "32"}, {"privileges": "32", "userProto": "root", "withGrantOption": "32"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} 4 {"table": {"columns": [{"id": 1, "name": "username", "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "hashedPassword", "nullable": true, "type": {"family": "BytesFamily", "oid": 17}}, {"defaultExpr": "false", "id": 3, "name": "isRole", "type": {"oid": 16}}, {"id": 4, "name": "user_id", "type": {"family": "OidFamily", "oid": 26}}], "formatVersion": 3, "id": 4, "indexes": [{"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 2, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [4], "keyColumnNames": ["user_id"], "keySuffixColumnIds": [1], "name": "users_user_id_idx", "partitioning": {}, "sharded": {}, "unique": true, "version": 3}], "name": "users", "nextColumnId": 5, "nextConstraintId": 3, "nextIndexId": 3, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 2, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [1], "keyColumnNames": ["username"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [2, 3, 4], "storeColumnNames": ["hashedPassword", "isRole", "user_id"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "480", "userProto": "admin", "withGrantOption": "480"}, {"privileges": "480", "userProto": "root", "withGrantOption": "480"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "2"}} 5 {"table": {"columns": [{"id": 1, "name": "id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 2, "name": "config", "nullable": true, "type": {"family": "BytesFamily", "oid": 17}}], "formatVersion": 3, "id": 5, "name": "zones", "nextColumnId": 3, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [1], "keyColumnNames": ["id"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [2], "storeColumnNames": ["config"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "480", "userProto": "admin", "withGrantOption": "480"}, {"privileges": "480", "userProto": "root", "withGrantOption": "480"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} @@ -163,6 +163,7 @@ SELECT id, strip_volatile(descriptor) FROM crdb_internal.kv_catalog_descriptor O 64 {"table": {"checks": [{"columnIds": [6], "constraintId": 2, "expr": "crdb_internal_created_at_database_id_index_id_table_id_shard_16 IN (0:::INT8, 1:::INT8, 2:::INT8, 3:::INT8, 4:::INT8, 5:::INT8, 6:::INT8, 7:::INT8, 8:::INT8, 9:::INT8, 10:::INT8, 11:::INT8, 12:::INT8, 13:::INT8, 14:::INT8, 15:::INT8)", "fromHashShardedColumn": true, "name": "check_crdb_internal_created_at_database_id_index_id_table_id_shard_16"}], "columns": [{"defaultExpr": "now():::TIMESTAMPTZ", "id": 1, "name": "created_at", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 2, "name": "database_id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 3, "name": "table_id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 4, "name": "index_id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 5, "name": "statistics", "type": {"family": "JsonFamily", "oid": 3802}}, {"computeExpr": "mod(fnv32(md5(crdb_internal.datums_to_bytes(created_at))), 16:::INT8)", "hidden": true, "id": 6, "name": "crdb_internal_created_at_database_id_index_id_table_id_shard_16", "type": {"family": "IntFamily", "oid": 23, "width": 32}, "virtual": true}], "formatVersion": 3, "id": 64, "name": "mvcc_statistics", "nextColumnId": 7, "nextConstraintId": 3, "nextIndexId": 2, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC", "ASC", "ASC", "ASC", "ASC"], "keyColumnIds": [6, 1, 2, 3, 4], "keyColumnNames": ["crdb_internal_created_at_database_id_index_id_table_id_shard_16", "created_at", "database_id", "table_id", "index_id"], "name": "mvcc_statistics_pkey", "partitioning": {}, "sharded": {"columnNames": ["created_at", "database_id", "index_id", "table_id"], "isSharded": true, "name": "crdb_internal_created_at_database_id_index_id_table_id_shard_16", "shardBuckets": 16}, "storeColumnIds": [5], "storeColumnNames": ["statistics"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "480", "userProto": "admin", "withGrantOption": "480"}, {"privileges": "480", "userProto": "root", "withGrantOption": "480"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} 65 {"table": {"checks": [{"columnIds": [23], "constraintId": 2, "expr": "crdb_internal_end_time_start_time_shard_16 IN (0:::INT8, 1:::INT8, 2:::INT8, 3:::INT8, 4:::INT8, 5:::INT8, 6:::INT8, 7:::INT8, 8:::INT8, 9:::INT8, 10:::INT8, 11:::INT8, 12:::INT8, 13:::INT8, 14:::INT8, 15:::INT8)", "fromHashShardedColumn": true, "name": "check_crdb_internal_end_time_start_time_shard_16"}], "columns": [{"id": 1, "name": "transaction_id", "type": {"family": "UuidFamily", "oid": 2950}}, {"id": 2, "name": "transaction_fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 3, "name": "query_summary", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "implicit_txn", "nullable": true, "type": {"oid": 16}}, {"id": 5, "name": "session_id", "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "start_time", "nullable": true, "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 7, "name": "end_time", "nullable": true, "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 8, "name": "user_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 9, "name": "app_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 10, "name": "user_priority", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 11, "name": "retries", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 12, "name": "last_retry_reason", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 13, "name": "problems", "nullable": true, "type": {"arrayContents": {"family": "IntFamily", "oid": 20, "width": 64}, "arrayElemType": "IntFamily", "family": "ArrayFamily", "oid": 1016, "width": 64}}, {"id": 14, "name": "causes", "nullable": true, "type": {"arrayContents": {"family": "IntFamily", "oid": 20, "width": 64}, "arrayElemType": "IntFamily", "family": "ArrayFamily", "oid": 1016, "width": 64}}, {"id": 15, "name": "stmt_execution_ids", "nullable": true, "type": {"arrayContents": {"family": "StringFamily", "oid": 25}, "arrayElemType": "StringFamily", "family": "ArrayFamily", "oid": 1009}}, {"id": 16, "name": "cpu_sql_nanos", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 17, "name": "last_error_code", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 18, "name": "status", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 19, "name": "contention_time", "nullable": true, "type": {"family": "IntervalFamily", "intervalDurationField": {}, "oid": 1186}}, {"id": 20, "name": "contention_info", "nullable": true, "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 21, "name": "details", "nullable": true, "type": {"family": "JsonFamily", "oid": 3802}}, {"defaultExpr": "now():::TIMESTAMPTZ", "id": 22, "name": "created", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"computeExpr": "mod(fnv32(md5(crdb_internal.datums_to_bytes(end_time, start_time))), 16:::INT8)", "hidden": true, "id": 23, "name": "crdb_internal_end_time_start_time_shard_16", "type": {"family": "IntFamily", "oid": 23, "width": 32}, "virtual": true}], "formatVersion": 3, "id": 65, "indexes": [{"foreignKey": {}, "geoConfig": {}, "id": 2, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [2], "keyColumnNames": ["transaction_fingerprint_id"], "keySuffixColumnIds": [1], "name": "transaction_fingerprint_id_idx", "partitioning": {}, "sharded": {}, "version": 3}, {"foreignKey": {}, "geoConfig": {}, "id": 3, "interleave": {}, "keyColumnDirections": ["ASC", "DESC", "DESC"], "keyColumnIds": [23, 6, 7], "keyColumnNames": ["crdb_internal_end_time_start_time_shard_16", "start_time", "end_time"], "keySuffixColumnIds": [1], "name": "time_range_idx", "partitioning": {}, "sharded": {"columnNames": ["end_time", "start_time"], "isSharded": true, "name": "crdb_internal_end_time_start_time_shard_16", "shardBuckets": 16}, "version": 3}], "name": "transaction_execution_insights", "nextColumnId": 24, "nextConstraintId": 3, "nextIndexId": 4, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [1], "keyColumnNames": ["transaction_id"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], "storeColumnNames": ["transaction_fingerprint_id", "query_summary", "implicit_txn", "session_id", "start_time", "end_time", "user_name", "app_name", "user_priority", "retries", "last_retry_reason", "problems", "causes", "stmt_execution_ids", "cpu_sql_nanos", "last_error_code", "status", "contention_time", "contention_info", "details", "created"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "480", "userProto": "admin", "withGrantOption": "480"}, {"privileges": "480", "userProto": "root", "withGrantOption": "480"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} 66 {"table": {"checks": [{"columnIds": [29], "constraintId": 2, "expr": "crdb_internal_end_time_start_time_shard_16 IN (0:::INT8, 1:::INT8, 2:::INT8, 3:::INT8, 4:::INT8, 5:::INT8, 6:::INT8, 7:::INT8, 8:::INT8, 9:::INT8, 10:::INT8, 11:::INT8, 12:::INT8, 13:::INT8, 14:::INT8, 15:::INT8)", "fromHashShardedColumn": true, "name": "check_crdb_internal_end_time_start_time_shard_16"}], "columns": [{"id": 1, "name": "session_id", "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "transaction_id", "type": {"family": "UuidFamily", "oid": 2950}}, {"id": 3, "name": "transaction_fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 4, "name": "statement_id", "type": {"family": "StringFamily", "oid": 25}}, {"id": 5, "name": "statement_fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 6, "name": "problem", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 7, "name": "causes", "nullable": true, "type": {"arrayContents": {"family": "IntFamily", "oid": 20, "width": 64}, "arrayElemType": "IntFamily", "family": "ArrayFamily", "oid": 1016, "width": 64}}, {"id": 8, "name": "query", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 9, "name": "status", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 10, "name": "start_time", "nullable": true, "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 11, "name": "end_time", "nullable": true, "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 12, "name": "full_scan", "nullable": true, "type": {"oid": 16}}, {"id": 13, "name": "user_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 14, "name": "app_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 15, "name": "user_priority", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 16, "name": "database_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 17, "name": "plan_gist", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 18, "name": "retries", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 19, "name": "last_retry_reason", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 20, "name": "execution_node_ids", "nullable": true, "type": {"arrayContents": {"family": "IntFamily", "oid": 20, "width": 64}, "arrayElemType": "IntFamily", "family": "ArrayFamily", "oid": 1016, "width": 64}}, {"id": 21, "name": "index_recommendations", "nullable": true, "type": {"arrayContents": {"family": "StringFamily", "oid": 25}, "arrayElemType": "StringFamily", "family": "ArrayFamily", "oid": 1009}}, {"id": 22, "name": "implicit_txn", "nullable": true, "type": {"oid": 16}}, {"id": 23, "name": "cpu_sql_nanos", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 24, "name": "error_code", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 25, "name": "contention_time", "nullable": true, "type": {"family": "IntervalFamily", "intervalDurationField": {}, "oid": 1186}}, {"id": 26, "name": "contention_info", "nullable": true, "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 27, "name": "details", "nullable": true, "type": {"family": "JsonFamily", "oid": 3802}}, {"defaultExpr": "now():::TIMESTAMPTZ", "id": 28, "name": "created", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"computeExpr": "mod(fnv32(md5(crdb_internal.datums_to_bytes(end_time, start_time))), 16:::INT8)", "hidden": true, "id": 29, "name": "crdb_internal_end_time_start_time_shard_16", "type": {"family": "IntFamily", "oid": 23, "width": 32}, "virtual": true}], "formatVersion": 3, "id": 66, "indexes": [{"foreignKey": {}, "geoConfig": {}, "id": 2, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [2], "keyColumnNames": ["transaction_id"], "keySuffixColumnIds": [4], "name": "transaction_id_idx", "partitioning": {}, "sharded": {}, "version": 3}, {"foreignKey": {}, "geoConfig": {}, "id": 3, "interleave": {}, "keyColumnDirections": ["ASC", "DESC", "DESC"], "keyColumnIds": [3, 10, 11], "keyColumnNames": ["transaction_fingerprint_id", "start_time", "end_time"], "keySuffixColumnIds": [4, 2], "name": "transaction_fingerprint_id_idx", "partitioning": {}, "sharded": {}, "version": 3}, {"foreignKey": {}, "geoConfig": {}, "id": 4, "interleave": {}, "keyColumnDirections": ["ASC", "DESC", "DESC"], "keyColumnIds": [5, 10, 11], "keyColumnNames": ["statement_fingerprint_id", "start_time", "end_time"], "keySuffixColumnIds": [4, 2], "name": "statement_fingerprint_id_idx", "partitioning": {}, "sharded": {}, "version": 3}, {"foreignKey": {}, "geoConfig": {}, "id": 5, "interleave": {}, "keyColumnDirections": ["ASC", "DESC", "DESC"], "keyColumnIds": [29, 10, 11], "keyColumnNames": ["crdb_internal_end_time_start_time_shard_16", "start_time", "end_time"], "keySuffixColumnIds": [4, 2], "name": "time_range_idx", "partitioning": {}, "sharded": {"columnNames": ["end_time", "start_time"], "isSharded": true, "name": "crdb_internal_end_time_start_time_shard_16", "shardBuckets": 16}, "version": 3}], "name": "statement_execution_insights", "nextColumnId": 30, "nextConstraintId": 3, "nextIndexId": 6, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC", "ASC"], "keyColumnIds": [4, 2], "keyColumnNames": ["statement_id", "transaction_id"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "storeColumnNames": ["session_id", "transaction_fingerprint_id", "statement_fingerprint_id", "problem", "causes", "query", "status", "start_time", "end_time", "full_scan", "user_name", "app_name", "user_priority", "database_name", "plan_gist", "retries", "last_retry_reason", "execution_node_ids", "index_recommendations", "implicit_txn", "cpu_sql_nanos", "error_code", "contention_time", "contention_info", "details", "created"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "480", "userProto": "admin", "withGrantOption": "480"}, {"privileges": "480", "userProto": "root", "withGrantOption": "480"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} +67 {"table": {"columns": [{"id": 1, "name": "global_id", "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "transaction_id", "type": {"family": "UuidFamily", "oid": 2950}}, {"id": 3, "name": "transaction_key", "nullable": true, "type": {"family": "BytesFamily", "oid": 17}}, {"defaultExpr": "now():::TIMESTAMPTZ", "id": 4, "name": "prepared", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 5, "name": "owner", "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "database", "type": {"family": "StringFamily", "oid": 25}}, {"id": 7, "name": "heuristic", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 67, "name": "prepared_transactions", "nextColumnId": 8, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "parentId": 1, "primaryIndex": {"constraintId": 1, "encodingType": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "keyColumnDirections": ["ASC"], "keyColumnIds": [1], "keyColumnNames": ["global_id"], "name": "primary", "partitioning": {}, "sharded": {}, "storeColumnIds": [2, 3, 4, 5, 6, 7], "storeColumnNames": ["transaction_id", "transaction_key", "prepared", "owner", "database", "heuristic"], "unique": true, "version": 4}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "admin", "withGrantOption": "32"}, {"privileges": "32", "userProto": "root", "withGrantOption": "32"}], "version": 3}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 29, "version": "1"}} 100 {"database": {"defaultPrivileges": {}, "id": 100, "name": "defaultdb", "privileges": {"ownerProto": "root", "users": [{"privileges": "2", "userProto": "admin", "withGrantOption": "2"}, {"privileges": "2048", "userProto": "public"}, {"privileges": "2", "userProto": "root", "withGrantOption": "2"}], "version": 3}, "schemas": {"public": {"id": 101}}, "version": "1"}} 101 {"schema": {"id": 101, "name": "public", "parentId": 100, "privileges": {"ownerProto": "root", "users": [{"privileges": "2", "userProto": "admin", "withGrantOption": "2"}, {"privileges": "516", "userProto": "public"}, {"privileges": "2", "userProto": "root", "withGrantOption": "2"}], "version": 3}, "version": "1"}} 102 {"database": {"defaultPrivileges": {}, "id": 102, "name": "postgres", "privileges": {"ownerProto": "root", "users": [{"privileges": "2", "userProto": "admin", "withGrantOption": "2"}, {"privileges": "2048", "userProto": "public"}, {"privileges": "2", "userProto": "root", "withGrantOption": "2"}], "version": 3}, "schemas": {"public": {"id": 103}}, "version": "1"}} diff --git a/pkg/sql/logictest/testdata/logic_test/dist_vectorize b/pkg/sql/logictest/testdata/logic_test/dist_vectorize index 9de20d4e09e3..b48dfa038518 100644 --- a/pkg/sql/logictest/testdata/logic_test/dist_vectorize +++ b/pkg/sql/logictest/testdata/logic_test/dist_vectorize @@ -30,7 +30,7 @@ query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv WITH DETAILS] ORDER by 1 ---- - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_agg b/pkg/sql/logictest/testdata/logic_test/distsql_agg index feda662c5e5b..993a615b9b94 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_agg +++ b/pkg/sql/logictest/testdata/logic_test/distsql_agg @@ -26,7 +26,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal b/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal index e683f9ceb9d0..8daf642f2133 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal +++ b/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal @@ -26,7 +26,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on index f6cf451b19c3..5754631c8e83 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on +++ b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on @@ -66,7 +66,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE x ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/4 {2} 2 …/1/4 …/1/6 {3} 3 …/1/6 …/1/7 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_enum b/pkg/sql/logictest/testdata/logic_test/distsql_enum index aed82b29ed8b..e900fb54b8a8 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_enum +++ b/pkg/sql/logictest/testdata/logic_test/distsql_enum @@ -48,7 +48,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE t1 WITH DETAILS] ORDER BY lease_holder, start_key ---- start_key end_key replicas lease_holder - …/1/0 {1} 1 + …/1/0 {1} 1 …/1/0 …/1/10 {1} 1 …/1/10 …/1/20 {2} 2 …/1/20 {3} 3 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_numtables b/pkg/sql/logictest/testdata/logic_test/distsql_numtables index 9c1c1b39ad26..2d35f20656e3 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_numtables +++ b/pkg/sql/logictest/testdata/logic_test/distsql_numtables @@ -30,14 +30,14 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToSquare WITH DETAILS] ---- start_key end_key replicas lease_holder - {1} 1 + {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToStr WITH DETAILS] ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2000 {1} 1 + …/1/2000 {1} 1 …/1/2000 …/1/4000 {2} 2 …/1/4000 …/1/6000 {3} 3 …/1/6000 …/1/8000 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_stats b/pkg/sql/logictest/testdata/logic_test/distsql_stats index 9321a522e4d1..7c7f8e4f646f 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_stats +++ b/pkg/sql/logictest/testdata/logic_test/distsql_stats @@ -34,7 +34,7 @@ query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data WITH DETAILS] ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_subquery b/pkg/sql/logictest/testdata/logic_test/distsql_subquery index 6b586d43d6b2..e31c6b5a7f46 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_subquery +++ b/pkg/sql/logictest/testdata/logic_test/distsql_subquery @@ -23,7 +23,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE a ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 {2} 2 query T diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_union b/pkg/sql/logictest/testdata/logic_test/distsql_union index 8b9e9e62e54b..512399d3f08c 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_union +++ b/pkg/sql/logictest/testdata/logic_test/distsql_union @@ -32,7 +32,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE x ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 …/1/4 …/1/5 {4} 4 diff --git a/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node b/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node index 0042eeeececd..e291629a7edb 100644 --- a/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node +++ b/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node @@ -23,7 +23,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE k ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 diff --git a/pkg/sql/logictest/testdata/logic_test/gen_test_objects b/pkg/sql/logictest/testdata/logic_test/gen_test_objects index 4d8231bdaf3d..ef08f2f76828 100644 --- a/pkg/sql/logictest/testdata/logic_test/gen_test_objects +++ b/pkg/sql/logictest/testdata/logic_test/gen_test_objects @@ -179,17 +179,18 @@ query T SELECT table_name FROM [SHOW TABLES] ORDER BY table_name ---- -protected_ts_meta -ran gelog -replicat i̾on_stats -s&qlliveness -sche"duled_j"obs -statement_diagnostics_requests -statement_statistic%vs +database_role_settings +eventLog +j ob\\x97s +locations +mvcc&_statistics +protected_ts_records +repor +ts_met😐a +span_stats_buckets +sqlliveness +statement_diagnosti cs sta😣tement_statistics -table_statistiCs -tenant_id_seq -transaction_statistics # Again, the column names are randomized. query TTT @@ -198,26 +199,26 @@ WHERE table_catalog = 'newdb2' AND table_schema = 'public' ORDER BY table_name, column_name LIMIT 20 ---- -protected_ts_meta "num_re cords" bigint -protected_ts_meta num_spans bigint -protected_ts_meta rowid bigint -protected_ts_meta "singleton*" boolean -protected_ts_meta "t'o tal_b,yt😫es" bigint -protected_ts_meta "vers ion" bigint -"ran gelog" "%rangeID" bigint -"ran gelog" "eventType" text -"ran gelog" i̅nfo text -"ran gelog" "otherRangeID" bigint -"ran gelog" rowid bigint -"ran gelog" "storeID" bigint -"ran gelog" "timestamp" timestamp without time zone -"ran gelog" "unique%qID" bigint -"replicat i̾on_stats" over_replic̣ated_ranges bigint -"replicat i̾on_stats" report_id bigint -"replicat i̾on_stats" rowid bigint -"replicat i̾on_stats" "s%pubzone_id" bigint -"replicat i̾on_stats" total_ranges bigint -"replicat i̾on_stats" unavailable_ranges bigint +database_role_settings database_id oid +database_role_settings role_id oid +database_role_settings role_name text +database_role_settings rowid bigint +database_role_settings "sett'ings" ARRAY +"eventLog" "eventTy\\u948Bp}e" text +"eventLog" info text +"eventLog" "reportingID" bigint +"eventLog" rowid bigint +"eventLog" "tImestamp" timestamp without time zone +"eventLog" "targetID" bigint +"eventLog" "uniqueID" bytea +"j ob\\x97s" " created" timestamp without time zone +"j ob\\x97s" "clai\fm_instance_id" bigint +"j ob\\x97s" "claim_Se|ssion_id" bytea +"j ob\\x97s" created_by_id bigint +"j ob\\x97s" created_by_type text +"j ob\\x97s" id bigint +"j ob\\x97s" j😠ob_type text +"j ob\\x97s" "l""as t_run" timestamp without time zone subtest templates/different_templates_in_each_db @@ -235,15 +236,15 @@ SELECT quote_ident(database_name), quote_ident(schema_name), quote_ident(name) FROM "".crdb_internal.tables WHERE database_name ILIKE '%d%b%t%' ORDER BY database_name, schema_name, name ---- -"d%qbt_1" public external_connections -"d%qbt_1" public "r%56ol e_mem bers" -"d%qbt_1" public task_payloads -"d%qbt_2" public locations -"d%qbt_2" public "scheduled_joBs" -"d%qbt_2" public span_stat😪s_sam͇ples -dbt_3 public "span_st%pats_unique_keys" -dbt_3 public "tenant_sETtings" -dbt_3 public t😔enants +"d%qbt_1" public statement_activity +"d%qbt_1" public ten😘ant_id_seq +"d%qbt_1" public tra😗nsaction_execution_insights +"d%qbt_2" public _tenant_settings +"d%qbt_2" public protected_ts_meta +"d%qbt_2" public "replication_co nstraint_stats" +dbt_3 public descriptor_id_seq +dbt_3 public regio͉n_liveness +dbt_3 public statement_execution_insights statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/grant_table b/pkg/sql/logictest/testdata/logic_test/grant_table index 913e3ced9343..36ce34d5780b 100644 --- a/pkg/sql/logictest/testdata/logic_test/grant_table +++ b/pkg/sql/logictest/testdata/logic_test/grant_table @@ -1012,6 +1012,7 @@ system public statement_execution_insights table admin system public statement_execution_insights table admin INSERT true system public statement_execution_insights table admin SELECT true system public statement_execution_insights table admin UPDATE true +system public prepared_transactions table admin SELECT true a public NULL schema admin ALL true defaultdb public NULL schema admin ALL true postgres public NULL schema admin ALL true @@ -1223,6 +1224,7 @@ system public statement_execution_insights table root system public statement_execution_insights table root INSERT true system public statement_execution_insights table root SELECT true system public statement_execution_insights table root UPDATE true +system public prepared_transactions table root SELECT true a pg_extension NULL schema public USAGE false a public NULL schema public CREATE false a public NULL schema public USAGE false @@ -2079,6 +2081,8 @@ system public mvcc_statistics table root system public mvcc_statistics table root UPDATE true system public namespace table admin SELECT true system public namespace table root SELECT true +system public prepared_transactions table admin SELECT true +system public prepared_transactions table root SELECT true system public privileges table admin DELETE true system public privileges table admin INSERT true system public privileges table admin SELECT true diff --git a/pkg/sql/logictest/testdata/logic_test/information_schema b/pkg/sql/logictest/testdata/logic_test/information_schema index a60dfe8d4ca4..a58f962c8117 100644 --- a/pkg/sql/logictest/testdata/logic_test/information_schema +++ b/pkg/sql/logictest/testdata/logic_test/information_schema @@ -1148,6 +1148,7 @@ table_columns # Check that the metadata is reported properly. skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTT colnames SELECT table_catalog, table_schema, table_name, table_type, is_insertable_into FROM system.information_schema.tables ORDER BY table_name, table_schema @@ -1417,6 +1418,7 @@ system pg_catalog pg_user_mapping system pg_catalog pg_user_mappings SYSTEM VIEW NO system pg_catalog pg_views SYSTEM VIEW NO system information_schema plugins SYSTEM VIEW NO +system public prepared_transactions BASE TABLE YES system public privileges BASE TABLE YES system information_schema processlist SYSTEM VIEW NO system information_schema profiling SYSTEM VIEW NO @@ -1583,6 +1585,7 @@ SET DATABASE = test ## information_schema.constraint_column_usage skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTTTTTT colnames SELECT * FROM system.information_schema.table_constraints @@ -1659,6 +1662,12 @@ system public 29_30_1_not_null system public 29_30_2_not_null system public namespace CHECK NO NO system public 29_30_3_not_null system public namespace CHECK NO NO system public primary system public namespace PRIMARY KEY NO NO +system public 29_67_1_not_null system public prepared_transactions CHECK NO NO +system public 29_67_2_not_null system public prepared_transactions CHECK NO NO +system public 29_67_4_not_null system public prepared_transactions CHECK NO NO +system public 29_67_5_not_null system public prepared_transactions CHECK NO NO +system public 29_67_6_not_null system public prepared_transactions CHECK NO NO +system public primary system public prepared_transactions PRIMARY KEY NO NO system public 29_52_1_not_null system public privileges CHECK NO NO system public 29_52_2_not_null system public privileges CHECK NO NO system public 29_52_3_not_null system public privileges CHECK NO NO @@ -1930,6 +1939,7 @@ NULL NULL UTF8 UCS skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTT colnames SELECT * FROM system.information_schema.check_constraints @@ -2179,6 +2189,11 @@ system public 29_66_2_not_null system public 29_66_3_not_null transaction_fingerprint_id IS NOT NULL system public 29_66_4_not_null statement_id IS NOT NULL system public 29_66_5_not_null statement_fingerprint_id IS NOT NULL +system public 29_67_1_not_null global_id IS NOT NULL +system public 29_67_2_not_null transaction_id IS NOT NULL +system public 29_67_4_not_null prepared IS NOT NULL +system public 29_67_5_not_null owner IS NOT NULL +system public 29_67_6_not_null database IS NOT NULL system public 29_6_1_not_null name IS NOT NULL system public 29_6_2_not_null value IS NOT NULL system public 29_6_3_not_null lastUpdated IS NOT NULL @@ -2196,6 +2211,7 @@ system public check_singleton system public single_row ((singleton)) skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTTTT colnames SELECT * FROM system.information_schema.constraint_column_usage @@ -2238,6 +2254,7 @@ system public mvcc_statistics table_id system public namespace name system public primary system public namespace parentID system public primary system public namespace parentSchemaID system public primary +system public prepared_transactions global_id system public primary system public privileges path system public primary system public privileges path system public privileges_path_user_id_key system public privileges path system public privileges_path_username_key @@ -2335,6 +2352,7 @@ system public web_sessions id system public zones id system public primary skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTTTT colnames SELECT * FROM system.information_schema.constraint_column_usage @@ -2377,6 +2395,7 @@ system public mvcc_statistics table_id system public namespace name system public primary system public namespace parentID system public primary system public namespace parentSchemaID system public primary +system public prepared_transactions global_id system public primary system public privileges path system public primary system public privileges path system public privileges_path_user_id_key system public privileges path system public privileges_path_username_key @@ -2474,6 +2493,7 @@ system public web_sessions id system public zones id system public primary skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTT colnames SELECT * FROM system.information_schema.check_constraints @@ -2723,6 +2743,11 @@ system public 29_66_2_not_null system public 29_66_3_not_null transaction_fingerprint_id IS NOT NULL system public 29_66_4_not_null statement_id IS NOT NULL system public 29_66_5_not_null statement_fingerprint_id IS NOT NULL +system public 29_67_1_not_null global_id IS NOT NULL +system public 29_67_2_not_null transaction_id IS NOT NULL +system public 29_67_4_not_null prepared IS NOT NULL +system public 29_67_5_not_null owner IS NOT NULL +system public 29_67_6_not_null database IS NOT NULL system public 29_6_1_not_null name IS NOT NULL system public 29_6_2_not_null value IS NOT NULL system public 29_6_3_not_null lastUpdated IS NOT NULL @@ -2830,6 +2855,7 @@ data_type column_default smallint 0 skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTI colnames SELECT table_catalog, table_schema, table_name, column_name, ordinal_position FROM system.information_schema.columns @@ -2917,6 +2943,13 @@ system public namespace id system public namespace name 3 system public namespace parentID 1 system public namespace parentSchemaID 2 +system public prepared_transactions database 6 +system public prepared_transactions global_id 1 +system public prepared_transactions heuristic 7 +system public prepared_transactions owner 5 +system public prepared_transactions prepared 4 +system public prepared_transactions transaction_id 2 +system public prepared_transactions transaction_key 3 system public privileges grant_options 4 system public privileges path 2 system public privileges privileges 3 @@ -3828,6 +3861,7 @@ root other_db public ALL YES ## information_schema.table_privileges and information_schema.role_table_grants skipif config local-mixed-24.1 +skipif config local-mixed-24.2 # root can see everything query TTTTTTTT colnames,rowsort SELECT * FROM system.information_schema.table_privileges ORDER BY table_schema, table_name, table_schema, grantee, privilege_type @@ -4250,6 +4284,8 @@ NULL root system public mvcc_statistics NULL root system public mvcc_statistics UPDATE YES NO NULL admin system public namespace SELECT YES YES NULL root system public namespace SELECT YES YES +NULL admin system public prepared_transactions SELECT YES YES +NULL root system public prepared_transactions SELECT YES YES NULL admin system public privileges DELETE YES NO NULL admin system public privileges INSERT YES NO NULL admin system public privileges SELECT YES YES @@ -4538,6 +4574,7 @@ NULL root system public zones NULL root system public zones UPDATE YES NO skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTTTTT colnames,rowsort SELECT * FROM system.information_schema.role_table_grants ---- @@ -5245,6 +5282,8 @@ NULL root system public statement_execution_insight NULL root system public statement_execution_insights INSERT YES NO NULL root system public statement_execution_insights SELECT YES YES NULL root system public statement_execution_insights UPDATE YES NO +NULL admin system public prepared_transactions SELECT YES YES +NULL root system public prepared_transactions SELECT YES YES statement ok USE other_db; @@ -6167,6 +6206,7 @@ log_timezone UTC max_connections -1 max_identifier_length 128 max_index_keys 32 +max_prepared_transactions 2147483647 max_retries_for_read_committed 10 node_id 1 null_ordered_last off diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist b/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist index 164623f3fcfe..524cd9fb5fbf 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist @@ -63,7 +63,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX g ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1152921574000000000 {1} 1 + …/1152921574000000000 {1} 1 …/1152921574000000000 {2} 2 # Distributed. @@ -92,7 +92,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX g ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1152921574000000000 {2} 2 + …/1152921574000000000 {2} 2 …/1152921574000000000 {2} 2 query I diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist index c919bbfb9d28..cb72cfb44dd2 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist @@ -39,7 +39,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 {3} 3 diff --git a/pkg/sql/logictest/testdata/logic_test/merge_join_dist b/pkg/sql/logictest/testdata/logic_test/merge_join_dist index c619f13da80f..f4da6e9ae6b0 100644 --- a/pkg/sql/logictest/testdata/logic_test/merge_join_dist +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_dist @@ -30,7 +30,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE l WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 {3} 3 diff --git a/pkg/sql/logictest/testdata/logic_test/pg_catalog b/pkg/sql/logictest/testdata/logic_test/pg_catalog index d79e9a607f31..b687d81f0246 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_catalog +++ b/pkg/sql/logictest/testdata/logic_test/pg_catalog @@ -1161,6 +1161,7 @@ indexrelid indrelid indnatts indisunique indnullsnotdistinct indisprimary 1229708768 60 3 true false true false true false true false false true false 1 2 3 0 3403232968 0 0 0 0 2 2 2 NULL NULL 3 1276104432 12 2 true false true false true false true false false true false 1 6 0 0 0 0 2 2 NULL NULL 2 1322500096 28 1 true false true false true false true false false true false 1 0 0 2 NULL NULL 1 +1396653711 67 1 true false true false true false true false false true false 1 3403232968 0 2 NULL NULL 1 1489445036 35 9 false false false false false false true false false true false 2 1 3 6 7 8 9 10 11 0 0 0 0 2 2 NULL NULL 2 1489445039 35 1 true false true false true false true false false true false 1 0 0 2 NULL NULL 1 1535840703 51 1 true false true false true false true false false true false 1 0 0 2 NULL NULL 1 @@ -1324,6 +1325,7 @@ indexrelid operator_argument_type_oid operator_argument_position 1276104432 0 1 1276104432 0 2 1322500096 0 1 +1396653711 0 1 1489445036 0 1 1489445036 0 2 1489445039 0 1 @@ -2902,6 +2904,7 @@ log_timezone UTC N max_connections -1 NULL NULL NULL string max_identifier_length 128 NULL NULL NULL string max_index_keys 32 NULL NULL NULL string +max_prepared_transactions 2147483647 NULL NULL NULL string max_retries_for_read_committed 10 NULL NULL NULL string node_id 1 NULL NULL NULL string null_ordered_last off NULL NULL NULL string @@ -3093,6 +3096,7 @@ log_timezone UTC N max_connections -1 NULL user NULL -1 -1 max_identifier_length 128 NULL user NULL 128 128 max_index_keys 32 NULL user NULL 32 32 +max_prepared_transactions 2147483647 NULL user NULL 2147483647 2147483647 max_retries_for_read_committed 10 NULL user NULL 10 10 node_id 1 NULL user NULL 1 1 null_ordered_last off NULL user NULL off off @@ -3281,6 +3285,7 @@ log_timezone NULL NULL NULL max_connections NULL NULL NULL NULL NULL max_identifier_length NULL NULL NULL NULL NULL max_index_keys NULL NULL NULL NULL NULL +max_prepared_transactions NULL NULL NULL NULL NULL max_retries_for_read_committed NULL NULL NULL NULL NULL multiple_active_portals_enabled NULL NULL NULL NULL NULL node_id NULL NULL NULL NULL NULL diff --git a/pkg/sql/logictest/testdata/logic_test/ranges b/pkg/sql/logictest/testdata/logic_test/ranges index 660e9d477560..0e2cf7bd91d3 100644 --- a/pkg/sql/logictest/testdata/logic_test/ranges +++ b/pkg/sql/logictest/testdata/logic_test/ranges @@ -14,7 +14,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t ORDER BY 1 ---- start_key end_key replicas lease_holder - {1} 1 + {1} 1 statement ok ALTER TABLE t SPLIT AT VALUES (1), (10) @@ -24,7 +24,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/10 {1} 1 …/1/10 {1} 1 @@ -39,7 +39,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/10 {4} 4 …/1/10 {1} 1 @@ -51,7 +51,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/5/1 {4} 4 …/1/10 {1} 1 …/1/5/1 …/1/5/2 {4} 4 @@ -72,7 +72,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/5/1 {3,4} 3 …/1/10 {1} 1 …/1/5/1 …/1/5/2 {1,2,3} 1 @@ -230,7 +230,8 @@ c6 /Table/62 c7 /Table/ c7 /Table/63 c8 /Table/64 {1} 1 c8 /Table/64 c9 /Table/65 {1} 1 c9 /Table/65 ca /Table/66 {1} 1 -ca /Table/66 f28989 /Table/106/1/1 {1} 1 +ca /Table/66 cb /Table/67 {1} 1 +cb /Table/67 f28989 /Table/106/1/1 {1} 1 f28989 /Table/106/1/1 f2898d89 /Table/106/1/5/1 {3,4} 3 f2898d89 /Table/106/1/5/1 f2898d8a /Table/106/1/5/2 {1,2,3} 1 f2898d8a /Table/106/1/5/2 f2898d8b /Table/106/1/5/3 {2,3,5} 5 @@ -319,7 +320,8 @@ c6 /Table/62 c7 /Table/ c7 /Table/63 c8 /Table/64 {1} 1 c8 /Table/64 c9 /Table/65 {1} 1 c9 /Table/65 ca /Table/66 {1} 1 -ca /Table/66 f28989 /Table/106/1/1 {1} 1 +ca /Table/66 cb /Table/67 {1} 1 +cb /Table/67 f28989 /Table/106/1/1 {1} 1 f28989 /Table/106/1/1 f2898d89 /Table/106/1/5/1 {3,4} 3 f2898d89 /Table/106/1/5/1 f2898d8a /Table/106/1/5/2 {1,2,3} 1 f2898d8a /Table/106/1/5/2 f2898d8b /Table/106/1/5/3 {2,3,5} 5 diff --git a/pkg/sql/logictest/testdata/logic_test/show_ranges b/pkg/sql/logictest/testdata/logic_test/show_ranges index 046ad8911d2a..308ed0e0e21b 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_ranges +++ b/pkg/sql/logictest/testdata/logic_test/show_ranges @@ -197,11 +197,11 @@ SELECT start_key, end_key, range_id, split_enforced_until FROM [SHOW RANGES] ORDER BY range_id ---- start_key end_key range_id split_enforced_until -/Table/66 /Table/106/1/10 68 NULL -/Table/106/1/10 /Table/106/2/20 69 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/106/2/20 /Table/106/2/30 70 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/106/2/30 /Table/107/1/42 71 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/107/1/42 /Max 72 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/67 /Table/106/1/10 69 NULL +/Table/106/1/10 /Table/106/2/20 70 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/106/2/20 /Table/106/2/30 71 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/106/2/30 /Table/107/1/42 72 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/107/1/42 /Max 73 2262-04-11 23:47:16.854776 +0000 +0000 # Ditto, verbose form. query TTIIT colnames @@ -209,11 +209,11 @@ SELECT start_key, end_key, range_id, lease_holder, split_enforced_until FROM [SH ORDER BY range_id ---- start_key end_key range_id lease_holder split_enforced_until -/Table/66 /Table/106/1/10 68 1 NULL -/Table/106/1/10 /Table/106/2/20 69 1 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/106/2/20 /Table/106/2/30 70 1 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/106/2/30 /Table/107/1/42 71 1 2262-04-11 23:47:16.854776 +0000 +0000 -/Table/107/1/42 /Max 72 1 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/67 /Table/106/1/10 69 1 NULL +/Table/106/1/10 /Table/106/2/20 70 1 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/106/2/20 /Table/106/2/30 71 1 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/106/2/30 /Table/107/1/42 72 1 2262-04-11 23:47:16.854776 +0000 +0000 +/Table/107/1/42 /Max 73 1 2262-04-11 23:47:16.854776 +0000 +0000 # Show that the new tables shows up in the full range list. query TTITTTITITT colnames @@ -227,13 +227,13 @@ start_key end_key range_id database_name schema_name table_na /Table/25 /Table/26 28 system public replication_constraint_stats 25 primary 1 /Table/25/1 /Table/25/2 /Table/26 /Table/27 29 system public replication_critical_localities 26 primary 1 /Table/26/1 /Table/26/2 /Table/27 /Table/28 30 system public replication_stats 27 primary 1 /Table/27/1 /Table/27/2 -/Table/66 /Table/106/1/10 68 test public t 106 t_pkey 1 /Table/106/1 /Table/106/1/10 -/Table/106/1/10 /Table/106/2/20 69 test public t 106 t_pkey 1 /Table/106/1/10 /Table/106/2 -/Table/106/1/10 /Table/106/2/20 69 test public t 106 idx 2 /Table/106/2 /Table/106/2/20 -/Table/106/2/20 /Table/106/2/30 70 test public t 106 idx 2 /Table/106/2/20 /Table/106/2/30 -/Table/106/2/30 /Table/107/1/42 71 test public t 106 idx 2 /Table/106/2/30 /Table/106/3 -/Table/106/2/30 /Table/107/1/42 71 test public u 107 u_pkey 1 /Table/107/1 /Table/107/1/42 -/Table/107/1/42 /Max 72 test public u 107 u_pkey 1 /Table/107/1/42 /Table/107/2 +/Table/67 /Table/106/1/10 69 test public t 106 t_pkey 1 /Table/106/1 /Table/106/1/10 +/Table/106/1/10 /Table/106/2/20 70 test public t 106 t_pkey 1 /Table/106/1/10 /Table/106/2 +/Table/106/1/10 /Table/106/2/20 70 test public t 106 idx 2 /Table/106/2 /Table/106/2/20 +/Table/106/2/20 /Table/106/2/30 71 test public t 106 idx 2 /Table/106/2/20 /Table/106/2/30 +/Table/106/2/30 /Table/107/1/42 72 test public t 106 idx 2 /Table/106/2/30 /Table/106/3 +/Table/106/2/30 /Table/107/1/42 72 test public u 107 u_pkey 1 /Table/107/1 /Table/107/1/42 +/Table/107/1/42 /Max 73 test public u 107 u_pkey 1 /Table/107/1/42 /Table/107/2 subtest show_ranges_from_database/with_tables @@ -265,12 +265,12 @@ FROM [SHOW RANGES WITH TABLES] ORDER BY range_id ---- start_key end_key range_id schema_name table_name table_id table_start_key table_end_key -/Table/66 /Table/106/1/10 68 public t 106 /Table/106 /Table/106/1/10 -/Table/106/1/10 /Table/106/2/20 69 public t 106 /Table/106/1/10 /Table/106/2/20 -/Table/106/2/20 /Table/106/2/30 70 public t 106 /Table/106/2/20 /Table/106/2/30 -/Table/106/2/30 /Table/107/1/42 71 public t 106 /Table/106/2/30 /Table/107 -/Table/106/2/30 /Table/107/1/42 71 public u 107 /Table/107 /Table/107/1/42 -/Table/107/1/42 /Max 72 public u 107 /Table/107/1/42 /Table/108 +/Table/67 /Table/106/1/10 69 public t 106 /Table/106 /Table/106/1/10 +/Table/106/1/10 /Table/106/2/20 70 public t 106 /Table/106/1/10 /Table/106/2/20 +/Table/106/2/20 /Table/106/2/30 71 public t 106 /Table/106/2/20 /Table/106/2/30 +/Table/106/2/30 /Table/107/1/42 72 public t 106 /Table/106/2/30 /Table/107 +/Table/106/2/30 /Table/107/1/42 72 public u 107 /Table/107 /Table/107/1/42 +/Table/107/1/42 /Max 73 public u 107 /Table/107/1/42 /Table/108 subtest show_ranges_from_database/with_indexes @@ -303,13 +303,13 @@ FROM [SHOW RANGES WITH INDEXES] ORDER BY range_id, table_id, index_id ---- start_key end_key range_id schema_name table_name table_id index_name index_id index_start_key index_end_key -/Table/66 /Table/106/1/10 68 public t 106 t_pkey 1 /Table/106/1 /Table/106/1/10 -/Table/106/1/10 /Table/106/2/20 69 public t 106 t_pkey 1 /Table/106/1/10 /Table/106/2 -/Table/106/1/10 /Table/106/2/20 69 public t 106 idx 2 /Table/106/2 /Table/106/2/20 -/Table/106/2/20 /Table/106/2/30 70 public t 106 idx 2 /Table/106/2/20 /Table/106/2/30 -/Table/106/2/30 /Table/107/1/42 71 public t 106 idx 2 /Table/106/2/30 /Table/106/3 -/Table/106/2/30 /Table/107/1/42 71 public u 107 u_pkey 1 /Table/107/1 /Table/107/1/42 -/Table/107/1/42 /Max 72 public u 107 u_pkey 1 /Table/107/1/42 /Table/107/2 +/Table/67 /Table/106/1/10 69 public t 106 t_pkey 1 /Table/106/1 /Table/106/1/10 +/Table/106/1/10 /Table/106/2/20 70 public t 106 t_pkey 1 /Table/106/1/10 /Table/106/2 +/Table/106/1/10 /Table/106/2/20 70 public t 106 idx 2 /Table/106/2 /Table/106/2/20 +/Table/106/2/20 /Table/106/2/30 71 public t 106 idx 2 /Table/106/2/20 /Table/106/2/30 +/Table/106/2/30 /Table/107/1/42 72 public t 106 idx 2 /Table/106/2/30 /Table/106/3 +/Table/106/2/30 /Table/107/1/42 72 public u 107 u_pkey 1 /Table/107/1 /Table/107/1/42 +/Table/107/1/42 /Max 73 public u 107 u_pkey 1 /Table/107/1/42 /Table/107/2 subtest show_ranges_from_table @@ -341,10 +341,10 @@ SELECT start_key, end_key, range_id, split_enforced_until FROM [SHOW RANGES FROM ORDER BY range_id ---- start_key end_key range_id split_enforced_until - …/1/10 68 NULL -…/1/10 …/2/20 69 2262-04-11 23:47:16.854776 +0000 +0000 -…/2/20 …/2/30 70 2262-04-11 23:47:16.854776 +0000 +0000 -…/2/30 71 2262-04-11 23:47:16.854776 +0000 +0000 + …/1/10 69 NULL +…/1/10 …/2/20 70 2262-04-11 23:47:16.854776 +0000 +0000 +…/2/20 …/2/30 71 2262-04-11 23:47:16.854776 +0000 +0000 +…/2/30 72 2262-04-11 23:47:16.854776 +0000 +0000 # Ditto, verbose form. query TTIIT colnames @@ -352,10 +352,10 @@ SELECT start_key, end_key, range_id, lease_holder, split_enforced_until FROM [SH ORDER BY range_id ---- start_key end_key range_id lease_holder split_enforced_until - …/1/10 68 1 NULL -…/1/10 …/2/20 69 1 2262-04-11 23:47:16.854776 +0000 +0000 -…/2/20 …/2/30 70 1 2262-04-11 23:47:16.854776 +0000 +0000 -…/2/30 71 1 2262-04-11 23:47:16.854776 +0000 +0000 + …/1/10 69 1 NULL +…/1/10 …/2/20 70 1 2262-04-11 23:47:16.854776 +0000 +0000 +…/2/20 …/2/30 71 1 2262-04-11 23:47:16.854776 +0000 +0000 +…/2/30 72 1 2262-04-11 23:47:16.854776 +0000 +0000 # Let's inspect the other table for comparison. query TTIT colnames @@ -363,8 +363,8 @@ SELECT start_key, end_key, range_id, split_enforced_until FROM [SHOW RANGES FROM ORDER BY range_id ---- start_key end_key range_id split_enforced_until - …/1/42 71 2262-04-11 23:47:16.854776 +0000 +0000 -…/1/42 72 2262-04-11 23:47:16.854776 +0000 +0000 + …/1/42 72 2262-04-11 23:47:16.854776 +0000 +0000 +…/1/42 73 2262-04-11 23:47:16.854776 +0000 +0000 @@ -397,11 +397,11 @@ SELECT start_key, end_key, range_id, index_name, index_id, index_start_key, inde ORDER BY range_id, index_id ---- start_key end_key range_id index_name index_id index_start_key index_end_key - …/1/10 68 t_pkey 1 …/1 …/1/10 -…/1/10 …/2/20 69 t_pkey 1 …/1/10 …/2 -…/1/10 …/2/20 69 idx 2 …/2 …/2/20 -…/2/20 …/2/30 70 idx 2 …/2/20 …/2/30 -…/2/30 71 idx 2 …/2/30 …/3 + …/1/10 69 t_pkey 1 …/1 …/1/10 +…/1/10 …/2/20 70 t_pkey 1 …/1/10 …/2 +…/1/10 …/2/20 70 idx 2 …/2 …/2/20 +…/2/20 …/2/30 71 idx 2 …/2/20 …/2/30 +…/2/30 72 idx 2 …/2/30 …/3 @@ -433,18 +433,18 @@ query TTIT colnames SELECT start_key, end_key, range_id, split_enforced_until FROM [SHOW RANGES FROM INDEX t@idx] ORDER BY start_key ---- start_key end_key range_id split_enforced_until - …/20 69 2262-04-11 23:47:16.854776 +0000 +0000 -…/20 …/30 70 2262-04-11 23:47:16.854776 +0000 +0000 -…/30 71 2262-04-11 23:47:16.854776 +0000 +0000 + …/20 70 2262-04-11 23:47:16.854776 +0000 +0000 +…/20 …/30 71 2262-04-11 23:47:16.854776 +0000 +0000 +…/30 72 2262-04-11 23:47:16.854776 +0000 +0000 # Ditto, verbose form. query TTIIT colnames SELECT start_key, end_key, range_id, lease_holder, split_enforced_until FROM [SHOW RANGES FROM INDEX t@idx WITH DETAILS] ORDER BY start_key ---- start_key end_key range_id lease_holder split_enforced_until - …/20 69 1 2262-04-11 23:47:16.854776 +0000 +0000 -…/20 …/30 70 1 2262-04-11 23:47:16.854776 +0000 +0000 -…/30 71 1 2262-04-11 23:47:16.854776 +0000 +0000 + …/20 70 1 2262-04-11 23:47:16.854776 +0000 +0000 +…/20 …/30 71 1 2262-04-11 23:47:16.854776 +0000 +0000 +…/30 72 1 2262-04-11 23:47:16.854776 +0000 +0000 subtest cast_error diff --git a/pkg/sql/logictest/testdata/logic_test/show_source b/pkg/sql/logictest/testdata/logic_test/show_source index 358e3d0c2792..10cf9bc6f861 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_source +++ b/pkg/sql/logictest/testdata/logic_test/show_source @@ -119,6 +119,7 @@ log_timezone UTC max_connections -1 max_identifier_length 128 max_index_keys 32 +max_prepared_transactions 2147483647 max_retries_for_read_committed 10 node_id 1 null_ordered_last off @@ -324,6 +325,7 @@ public locations table node NULL public migrations table node NULL public mvcc_statistics table node NULL public namespace table node NULL +public prepared_transactions table node NULL public privileges table node NULL public protected_ts_meta table node NULL public protected_ts_records table node NULL @@ -386,6 +388,7 @@ public locations table node NULL · public migrations table node NULL · public mvcc_statistics table node NULL · public namespace table node NULL · +public prepared_transactions table node NULL · public privileges table node NULL · public protected_ts_meta table node NULL · public protected_ts_records table node NULL · @@ -561,7 +564,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM CURRENT_CATALOG WITH DETAILS] ---- start_key end_key replicas lease_holder -/Table/66 /Max {1} 1 +/Table/67 /Max {1} 1 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE system.descriptor WITH DETAILS] diff --git a/pkg/sql/logictest/testdata/logic_test/split_at b/pkg/sql/logictest/testdata/logic_test/split_at index 5f0d3b68dccf..8d685e7032c4 100644 --- a/pkg/sql/logictest/testdata/logic_test/split_at +++ b/pkg/sql/logictest/testdata/logic_test/split_at @@ -5,12 +5,14 @@ statement ok CREATE TABLE t (a INT PRIMARY KEY) +skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t WITH DETAILS] ORDER BY 1 ---- start_key end_key replicas lease_holder - {1} 1 + {1} 1 query TTT colnames,nosort ALTER TABLE t SPLIT AT VALUES (1), (10) @@ -19,12 +21,14 @@ key pretty split_enforced_until [242 137 137] /1 2262-04-11 23:47:16.854776 +0000 +0000 [242 137 146] /10 2262-04-11 23:47:16.854776 +0000 +0000 +skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t WITH DETAILS] ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/10 {1} 1 …/1/10 {1} 1 diff --git a/pkg/sql/logictest/testdata/logic_test/sqlliveness b/pkg/sql/logictest/testdata/logic_test/sqlliveness index 5c9b91237a69..fc24f8dc4ec6 100644 --- a/pkg/sql/logictest/testdata/logic_test/sqlliveness +++ b/pkg/sql/logictest/testdata/logic_test/sqlliveness @@ -31,5 +31,3 @@ SELECT count(*) > 0 FROM system.sqlliveness WHERE crdb_internal.sql_liveness_is_ true subtest end - - diff --git a/pkg/sql/logictest/testdata/logic_test/system b/pkg/sql/logictest/testdata/logic_test/system index 139896b8faa7..5e13f8a0068b 100644 --- a/pkg/sql/logictest/testdata/logic_test/system +++ b/pkg/sql/logictest/testdata/logic_test/system @@ -10,6 +10,7 @@ test root NULL NULL {} NULL # descriptor_id_sq, tenant, tenant_usage, and span_configurations. skipif config 3node-tenant-default-configs skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTT SELECT schema_name, table_name, type, owner, locality FROM [SHOW TABLES FROM system] ORDER BY 2 ---- @@ -27,6 +28,7 @@ public locations table node NULL public migrations table node NULL public mvcc_statistics table node NULL public namespace table node NULL +public prepared_transactions table node NULL public privileges table node NULL public protected_ts_meta table node NULL public protected_ts_records table node NULL @@ -88,6 +90,7 @@ public locations table node NULL public migrations table node NULL public mvcc_statistics table node NULL public namespace table node NULL +public prepared_transactions table node NULL public privileges table node NULL public protected_ts_meta table node NULL public protected_ts_records table node NULL @@ -135,6 +138,8 @@ public zones table node NULL # The test expectations are different on tenants because of # descriptor_id_sq, tenant, tenant_usage, and span_configurations. skipif config 3node-tenant-default-configs +skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query I rowsort SELECT id FROM system.descriptor ORDER BY 1 ---- @@ -195,6 +200,7 @@ SELECT id FROM system.descriptor ORDER BY 1 64 65 66 +67 100 101 102 @@ -263,6 +269,7 @@ SELECT id FROM system.descriptor ORDER BY 1 64 65 66 +67 100 101 102 @@ -399,6 +406,8 @@ system root CONNECT true # The test expectations are different on tenants because of # descriptor_id_sq, tenant, tenant_usage, and span_configurations. skipif config 3node-tenant-default-configs +skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query TTTTTB rowsort SHOW GRANTS ON system.* ---- @@ -497,6 +506,8 @@ system public mvcc_statistics root SELECT true system public mvcc_statistics root UPDATE true system public namespace admin SELECT true system public namespace root SELECT true +system public prepared_transactions admin SELECT true +system public prepared_transactions root SELECT true system public privileges admin DELETE true system public privileges admin INSERT true system public privileges admin SELECT true @@ -883,6 +894,8 @@ system public mvcc_statistics root SELECT true system public mvcc_statistics root UPDATE true system public namespace admin SELECT true system public namespace root SELECT true +system public prepared_transactions admin SELECT true +system public prepared_transactions root SELECT true system public privileges admin DELETE true system public privileges admin INSERT true system public privileges admin SELECT true diff --git a/pkg/sql/logictest/testdata/logic_test/system_namespace b/pkg/sql/logictest/testdata/logic_test/system_namespace index f063a86a68b8..2711053ce2d4 100644 --- a/pkg/sql/logictest/testdata/logic_test/system_namespace +++ b/pkg/sql/logictest/testdata/logic_test/system_namespace @@ -1,9 +1,13 @@ skipif config 3node-tenant-default-configs +skipif config local-mixed-24.1 +skipif config local-mixed-24.2 query IITI rowsort SELECT * FROM system.namespace ---- -1 29 locations 21 0 0 defaultdb 100 +0 0 postgres 102 +0 0 system 1 +0 0 test 104 1 0 public 29 1 29 comments 24 1 29 database_role_settings 44 @@ -15,10 +19,11 @@ SELECT * FROM system.namespace 1 29 jobs 15 1 29 join_tokens 41 1 29 lease 11 -100 0 public 101 +1 29 locations 21 1 29 migrations 40 1 29 mvcc_statistics 64 1 29 namespace 30 +1 29 prepared_transactions 67 1 29 privileges 52 1 29 protected_ts_meta 31 1 29 protected_ts_records 32 @@ -27,26 +32,6 @@ SELECT * FROM system.namespace 1 29 replication_constraint_stats 25 1 29 replication_critical_localities 26 1 29 replication_stats 27 -102 0 public 103 -104 0 public 105 -0 0 postgres 102 -0 0 system 1 -0 0 test 104 -1 29 statement_statistics 42 -1 29 table_statistics 20 -1 29 task_payloads 59 -1 29 tenant_id_seq 63 -1 29 tenant_settings 50 -1 29 tenant_tasks 60 -1 29 tenant_usage 45 -1 29 tenants 8 -1 29 transaction_activity 62 -1 29 transaction_execution_insights 65 -1 29 transaction_statistics 43 -1 29 ui 14 -1 29 users 4 -1 29 web_sessions 19 -1 29 zones 5 1 29 reports_meta 28 1 29 role_id_seq 48 1 29 role_members 23 @@ -66,6 +51,24 @@ SELECT * FROM system.namespace 1 29 statement_diagnostics 36 1 29 statement_diagnostics_requests 35 1 29 statement_execution_insights 66 +1 29 statement_statistics 42 +1 29 table_statistics 20 +1 29 task_payloads 59 +1 29 tenant_id_seq 63 +1 29 tenant_settings 50 +1 29 tenant_tasks 60 +1 29 tenant_usage 45 +1 29 tenants 8 +1 29 transaction_activity 62 +1 29 transaction_execution_insights 65 +1 29 transaction_statistics 43 +1 29 ui 14 +1 29 users 4 +1 29 web_sessions 19 +1 29 zones 5 +100 0 public 101 +102 0 public 103 +104 0 public 105 # When run with a tenant, system.namespace has an extra entry for # descriptor_id_seq and no entries for tenants, tenant_usage, and @@ -93,6 +96,7 @@ SELECT * FROM system.namespace 1 29 migrations 40 1 29 mvcc_statistics 64 1 29 namespace 30 +1 29 prepared_transactions 67 1 29 privileges 52 1 29 protected_ts_meta 31 1 29 protected_ts_records 32 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/autocommit b/pkg/sql/opt/exec/execbuilder/testdata/autocommit index dcbbe7bfbc39..04a6b6b484d7 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/autocommit +++ b/pkg/sql/opt/exec/execbuilder/testdata/autocommit @@ -44,7 +44,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 # Multi-row insert should auto-commit. query B @@ -68,7 +68,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -93,7 +93,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 statement ok ROLLBACK @@ -120,7 +120,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -144,7 +144,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # Insert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -170,8 +170,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -209,7 +209,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Put, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Put, 1 EndTxn to (n1,s1):1 # Multi-row upsert should auto-commit. query B @@ -233,7 +233,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -258,7 +258,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 statement ok ROLLBACK @@ -285,7 +285,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -310,8 +310,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 Put to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Upsert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -337,8 +337,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 Put to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -376,8 +376,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -402,8 +402,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 statement ok ROLLBACK @@ -430,8 +430,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -456,9 +456,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Put to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Update with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -484,9 +484,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Put to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Put to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -524,7 +524,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Del, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Del, 1 EndTxn to (n1,s1):1 # Multi-row delete should auto-commit. query B @@ -548,7 +548,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -573,7 +573,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 DelRng to (n1,s1):1 +dist sender send r69: sending batch 1 DelRng to (n1,s1):1 statement ok ROLLBACK @@ -600,8 +600,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Del, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Del, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -626,9 +626,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Del to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Del to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Insert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -654,9 +654,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 2 Del to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 2 Del to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 statement ok INSERT INTO ab VALUES (12, 0); @@ -706,9 +706,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 2 Get to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 2 Get to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -732,10 +732,10 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 1 Put to (n1,s1):1 -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 1 Put to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -760,10 +760,10 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Get to (n1,s1):1 -dist sender send r68: sending batch 1 Del to (n1,s1):1 -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Get to (n1,s1):1 +dist sender send r69: sending batch 1 Del to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Test with a single cascade, which should use autocommit. statement ok @@ -794,9 +794,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 1 Del to (n1,s1):1 -dist sender send r68: sending batch 1 Scan to (n1,s1):1 -dist sender send r68: sending batch 1 Del, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Del to (n1,s1):1 +dist sender send r69: sending batch 1 Scan to (n1,s1):1 +dist sender send r69: sending batch 1 Del, 1 EndTxn to (n1,s1):1 # ----------------------- # Multiple mutation tests @@ -827,9 +827,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -855,9 +855,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%ResolveIntent%' AND operation NOT LIKE '%async%' ---- -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 2 CPut to (n1,s1):1 -dist sender send r68: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 2 CPut to (n1,s1):1 +dist sender send r69: sending batch 1 EndTxn to (n1,s1):1 # Check that the statement can still be auto-committed when the txn rows written # erring guardrail is enabled. @@ -891,7 +891,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND message NOT LIKE '%ResolveIntent%' ---- -dist sender send r68: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 query error pq: txn has written 2 rows, which is above the limit INSERT INTO guardrails VALUES (2), (3) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/delete b/pkg/sql/opt/exec/execbuilder/testdata/delete index 2d3fba5bbf9e..25bbe515d101 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/delete +++ b/pkg/sql/opt/exec/execbuilder/testdata/delete @@ -231,9 +231,9 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%DelRange%' OR message LIKE '%DelRng%' ---- delete range DelRange /Table/110/1 - /Table/110/2 -dist sender send r68: sending batch 1 DelRng to (n1,s1):1 +dist sender send r69: sending batch 1 DelRng to (n1,s1):1 delete range DelRange /Table/110/1/601/0 - /Table/110/2 -dist sender send r68: sending batch 1 DelRng to (n1,s1):1 +dist sender send r69: 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. @@ -252,7 +252,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%Del%' OR message LIKE '%sending batch%' ---- delete range Del /Table/110/1/5/0 -dist sender send r68: sending batch 1 Del, 1 EndTxn to (n1,s1):1 +dist sender send r69: sending batch 1 Del, 1 EndTxn to (n1,s1):1 # Ensure that we send DelRanges when doing a point delete operation on a table # that has multiple column families. @@ -271,7 +271,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%Del%' OR message LIKE '%sending batch%' ---- delete range DelRange /Table/111/1/5 - /Table/111/1/6 -dist sender send r68: sending batch 1 DelRng to (n1,s1):1 +dist sender send r69: sending batch 1 DelRng to (n1,s1):1 statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize index d3893cc3effd..fb8732f83d19 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize +++ b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize @@ -30,7 +30,7 @@ query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv WITH DETAILS] ORDER BY 1 ---- - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg index 23f7d3d4a246..65ba84037fbe 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg @@ -18,7 +18,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on index fac4dc66d4f2..761ee012c315 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on @@ -48,7 +48,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE x ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/4 {2} 2 …/1/4 …/1/6 {3} 3 …/1/6 …/1/7 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_group_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_group_join index 6c81c3171cfb..664df4846d33 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_group_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_group_join @@ -18,7 +18,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin index 913340cb4955..cbcd591e2ece 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin @@ -17,7 +17,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM INDEX t ORDER BY 1 ---- start_key end_key replicas lease_holder - …/10 {1} 1 + …/10 {1} 1 …/10 …/20 {2} 2 …/20 …/30 {3} 3 …/30 …/40 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index index a64bb040dd89..0daf18b12726 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index @@ -65,7 +65,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX json_tab@primary WITH DETAILS] ORDER BY lease_holder, start_key ---- start_key end_key replicas lease_holder - …/10 {1} 1 + …/10 {1} 1 …/10 …/20 {2} 2 …/20 …/ {3} 3 @@ -74,7 +74,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE json_tab WITH DETAILS] ORDER BY lease_holder, start_key ---- start_key end_key replicas lease_holder - …/1/10 {1} 1 + …/1/10 {1} 1 …/2 …/3 {1} 1 …/3 {1} 1 …/1/10 …/1/20 {2} 2 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join index c09721f23175..7c02ea0f8cfa 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join @@ -18,7 +18,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join index fb2ebeeb6e6e..ada08f81e134 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join @@ -107,7 +107,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE p ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/8 {1} 1 + …/1/8 {1} 1 …/1/16 …/1/24 {1} 1 …/1/24 …/1/32 {1} 1 …/1/32 {1} 1 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index 52f20dd7ef63..085d15c7ff0b 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -73,7 +73,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables index 83bbfef52433..9f09703fbda1 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables @@ -28,14 +28,14 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE N ORDER BY 1 ---- start_key end_key replicas lease_holder - {1} 1 + {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToStr WITH DETAILS] ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2000 {1} 1 + …/1/2000 {1} 1 …/1/2000 …/1/4000 {2} 2 …/1/4000 …/1/6000 {3} 3 …/1/6000 …/1/8000 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality index 2762ec0ad4bd..5e5ed55e79e4 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality @@ -25,7 +25,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE x ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/4 {2} 2 …/1/4 …/1/6 {3} 3 …/1/6 …/1/7 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans index a03ec927e5da..afcaffb185a0 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans @@ -97,7 +97,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE p ORDER BY lease_holder, start_key ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/2/0 {3} 3 …/2/0 …/2/2 {4} 4 …/2/2 {5} 5 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union index acbd1589fafa..80fed52ee199 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union @@ -23,7 +23,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE x ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 …/1/4 …/1/5 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_window b/pkg/sql/opt/exec/execbuilder/testdata/distsql_window index a991727d6574..7e65bce17b60 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_window +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_window @@ -18,7 +18,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node b/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node index 3c52d14312dc..e5ae6e2f2637 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node +++ b/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node @@ -23,7 +23,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE k ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans index 650f1238eb12..2f886bf7cf8f 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans @@ -37,7 +37,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE k ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 …/1/4 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist index dded0be54424..97f78435c04b 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist @@ -104,7 +104,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX g ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1152921574000000000 {1} 1 + …/1152921574000000000 {1} 1 …/1152921574000000000 {2} 2 # Distributed. TODO(treilly): This claims to be distributed, but it isn't. What gives? @@ -174,7 +174,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX g ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1152921574000000000 {2} 2 + …/1152921574000000000 {2} 2 …/1152921574000000000 {2} 2 # Filtering is placed at node 2. We need a retry here to account for possibly @@ -246,7 +246,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX g ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1152921574000000000 {2} 2 + …/1152921574000000000 {2} 2 …/1152921574000000000 {2} 2 query ITTTI colnames,rowsort @@ -254,7 +254,7 @@ SELECT range_id, start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FR ORDER BY lease_holder, start_key ---- range_id start_key end_key replicas lease_holder -68 {2} 2 +69 {2} 2 # We should see a distributed execution (though need to retry to purge possibly # stale dist sender caches). diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist index 92381ed15ec0..79545b3e6e63 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist @@ -39,7 +39,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec index 64bcc7d74168..7fef637b3906 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec @@ -39,7 +39,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist index 0de731061b84..b96ccaf85e98 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist @@ -65,7 +65,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX json_tab@primary WITH DETAILS] ORDER BY lease_holder, start_key ---- start_key end_key replicas lease_holder - …/10 {1} 1 + …/10 {1} 1 …/10 …/20 {2} 2 …/20 …/ {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist index 98edac0ec898..c6369a5521fc 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist @@ -81,7 +81,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW EXPERIMENTAL_RANGES FROM TABLE j2 WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/44 {1} 1 + …/1/44 {1} 1 …/1/44 …/1/88 {2} 2 …/1/88 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join index d92223694d45..cfff5af29020 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join @@ -429,7 +429,7 @@ SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec b/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec index 1d94728225cd..75d7b5389f93 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec +++ b/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec @@ -30,7 +30,7 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE l WITH DETAILS] ORDER BY lease_holder ---- start_key end_key replicas lease_holder - …/1/2 {1} 1 + …/1/2 {1} 1 …/1/2 …/1/3 {2} 2 …/1/3 {3} 3 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel b/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel index 5ee36104e3ae..839fe25573ff 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel +++ b/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel @@ -18,7 +18,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d ORDER BY 1 ---- start_key end_key replicas lease_holder - …/1/1 {1} 1 + …/1/1 {1} 1 …/1/1 …/1/2 {2} 2 …/1/2 …/1/3 {3} 3 …/1/3 …/1/4 {4} 4 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/show_trace b/pkg/sql/opt/exec/execbuilder/testdata/show_trace index b02249dc98e7..ac82f35a42ab 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/show_trace +++ b/pkg/sql/opt/exec/execbuilder/testdata/show_trace @@ -228,7 +228,7 @@ SET tracing = off query T SELECT message FROM [SHOW TRACE FOR SESSION] WHERE message LIKE e'%1 CPut, 1 EndTxn%' AND message NOT LIKE e'%proposing command%' ---- -r70: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 +r71: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 node received request: 1 CPut, 1 EndTxn # Check that we can run set tracing regardless of the current tracing state. @@ -312,9 +312,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r70: sending batch 1 CPut to (n1,s1):1 -dist sender send r70: sending batch 1 EndTxn to (n1,s1):1 -dist sender send r70: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r71: sending batch 1 CPut to (n1,s1):1 +dist sender send r71: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r71: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # Make another session trace. statement ok @@ -343,9 +343,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r70: sending batch 4 CPut, 1 EndTxn to (n1,s1):1 -dist sender send r70: sending batch 5 CPut to (n1,s1):1 -dist sender send r70: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r71: sending batch 4 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r71: sending batch 5 CPut to (n1,s1):1 +dist sender send r71: sending batch 1 EndTxn to (n1,s1):1 # make a table with some big strings in it. statement ok @@ -366,11 +366,11 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r70: sending batch 6 CPut to (n1,s1):1 -dist sender send r70: sending batch 6 CPut to (n1,s1):1 -dist sender send r70: sending batch 6 CPut to (n1,s1):1 -dist sender send r70: sending batch 6 CPut to (n1,s1):1 -dist sender send r70: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r71: sending batch 6 CPut to (n1,s1):1 +dist sender send r71: sending batch 6 CPut to (n1,s1):1 +dist sender send r71: sending batch 6 CPut to (n1,s1):1 +dist sender send r71: sending batch 6 CPut to (n1,s1):1 +dist sender send r71: sending batch 1 EndTxn to (n1,s1):1 statement ok CREATE TABLE streamer (pk INT PRIMARY KEY, attribute INT, blob TEXT, INDEX(attribute), FAMILY (pk, attribute, blob)); @@ -399,4 +399,4 @@ WHERE message LIKE '%r$rangeid: sending batch 42 Get%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r70: sending batch 42 Get to (n1,s1):1 +dist sender send r71: sending batch 42 Get to (n1,s1):1 diff --git a/pkg/sql/opt/testutils/testcat/vtable.go b/pkg/sql/opt/testutils/testcat/vtable.go index 8cb7f7a0cbea..62c65612e2da 100644 --- a/pkg/sql/opt/testutils/testcat/vtable.go +++ b/pkg/sql/opt/testutils/testcat/vtable.go @@ -138,6 +138,7 @@ var systemTables = []string{ systemschema.SystemMVCCStatisticsSchema, systemschema.TxnExecutionStatsTableSchema, systemschema.StatementExecutionStatsTableSchema, + systemschema.PreparedTransactionsTableSchema, } func init() { diff --git a/pkg/sql/parser/help_test.go b/pkg/sql/parser/help_test.go index 15f3c4e79ddc..92b0f658ed09 100644 --- a/pkg/sql/parser/help_test.go +++ b/pkg/sql/parser/help_test.go @@ -163,6 +163,8 @@ func TestContextualHelp(t *testing.T) { {`CANCEL SESSIONS IF EXISTS ??`, `CANCEL SESSIONS`}, {`CANCEL ALL ??`, `CANCEL ALL JOBS`}, + {`COMMIT PREPARED 'foo' ??`, `COMMIT PREPARED`}, + {`CREATE UNIQUE ??`, `CREATE`}, {`CREATE UNIQUE INDEX ??`, `CREATE INDEX`}, {`CREATE INDEX IF NOT ??`, `CREATE INDEX`}, @@ -279,6 +281,8 @@ func TestContextualHelp(t *testing.T) { {`PREPARE foo AS DELETE FROM xx ??`, `DELETE`}, {`PREPARE foo AS UPDATE xx SET x = y ??`, `UPDATE`}, + {`PREPARE TRANSACTION 'foo' ??`, `PREPARE TRANSACTION`}, + {`EXECUTE foo ??`, `EXECUTE`}, {`EXECUTE foo (??`, `EXECUTE`}, @@ -345,6 +349,8 @@ func TestContextualHelp(t *testing.T) { {`REVOKE ALL ON foo FROM ??`, `REVOKE`}, {`REVOKE ALL ON foo FROM bar ??`, `REVOKE`}, + {`ROLLBACK PREPARED 'foo' ??`, `ROLLBACK PREPARED`}, + {`SELECT * FROM ??`, ``}, {`SELECT * FROM (??`, ``}, // not ! joins are allowed. {`SELECT * FROM [SHOW ??`, `SHOW`}, diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index d1f79c2a21ba..456af653153d 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -1011,7 +1011,7 @@ func (u *sqlSymUnion) triggerForEach() tree.TriggerForEach { %token PARALLEL PARENT PARTIAL PARTITION PARTITIONS PASSWORD PAUSE PAUSED PER PHYSICAL PLACEMENT PLACING %token PLAN PLANS POINT POINTM POINTZ POINTZM POLYGON POLYGONM POLYGONZ POLYGONZM -%token POSITION PRECEDING PRECISION PREPARE PRESERVE PRIMARY PRIOR PRIORITY PRIVILEGES +%token POSITION PRECEDING PRECISION PREPARE PREPARED PRESERVE PRIMARY PRIOR PRIORITY PRIVILEGES %token PROCEDURAL PROCEDURE PROCEDURES PUBLIC PUBLICATION %token QUERIES QUERY QUOTE @@ -1298,6 +1298,9 @@ func (u *sqlSymUnion) triggerForEach() tree.TriggerForEach { %type abort_stmt %type rollback_stmt %type savepoint_stmt +%type prepare_transaction_stmt +%type commit_prepared_stmt +%type rollback_prepared_stmt %type preparable_set_stmt nonpreparable_set_stmt %type set_local_stmt @@ -12516,12 +12519,15 @@ savepoint_stmt: } | SAVEPOINT error // SHOW HELP: SAVEPOINT -// BEGIN / START / COMMIT / END / ROLLBACK / ... +// BEGIN / START / COMMIT / END / ROLLBACK / PREPARE TRANSACTION / COMMIT PREPARED / ROLLBACK PREPARED / ... transaction_stmt: - begin_stmt // EXTEND WITH HELP: BEGIN -| commit_stmt // EXTEND WITH HELP: COMMIT -| rollback_stmt // EXTEND WITH HELP: ROLLBACK -| abort_stmt /* SKIP DOC */ + begin_stmt // EXTEND WITH HELP: BEGIN +| commit_stmt // EXTEND WITH HELP: COMMIT +| rollback_stmt // EXTEND WITH HELP: ROLLBACK +| abort_stmt /* SKIP DOC */ +| prepare_transaction_stmt // EXTEND WITH HELP: PREPARE TRANSACTION +| commit_prepared_stmt // EXTEND WITH HELP: COMMIT PREPARED +| rollback_prepared_stmt // EXTEND WITH HELP: ROLLBACK PREPARED // %Help: BEGIN - start a transaction // %Category: Txn @@ -12708,6 +12714,36 @@ transaction_deferrable_mode: $$.val = tree.NotDeferrable } +// %Help: PREPARE TRANSACTION - prepare the current transaction for two-phase commit +// %Category: Txn +// %Text: PREPARE TRANSACTION +// %SeeAlso: COMMIT PREPARED, ROLLBACK PREPARED +prepare_transaction_stmt: + PREPARE TRANSACTION SCONST + { + $$.val = &tree.PrepareTransaction{Transaction: tree.NewStrVal($3)} + } + +// %Help: COMMIT PREPARED - commit the named transaction as part of two-phase commit +// %Category: Txn +// %Text: COMMIT PREPARED +// %SeeAlso: PREPARE TRANSACTION, ROLLBACK PREPARED +commit_prepared_stmt: + COMMIT PREPARED SCONST + { + $$.val = &tree.CommitPrepared{Transaction: tree.NewStrVal($3)} + } + +// %Help: ROLLBACK PREPARED - rollback the named transaction as part of two-phase commit +// %Category: Txn +// %Text: ROLLBACK PREPARED +// %SeeAlso: PREPARE TRANSACTION, COMMIT PREPARED +rollback_prepared_stmt: + ROLLBACK PREPARED SCONST + { + $$.val = &tree.RollbackPrepared{Transaction: tree.NewStrVal($3)} + } + // %Help: CREATE DATABASE - create a new database // %Category: DDL // %Text: CREATE DATABASE [IF NOT EXISTS] @@ -17778,6 +17814,7 @@ unreserved_keyword: | POLYGONZM | PRECEDING | PREPARE +| PREPARED | PRESERVE | PRIOR | PRIORITY @@ -18345,6 +18382,7 @@ bare_label_keywords: | POSITION | PRECEDING | PREPARE +| PREPARED | PRESERVE | PRIMARY | PRIOR diff --git a/pkg/sql/parser/testdata/two_phase_commit b/pkg/sql/parser/testdata/two_phase_commit new file mode 100644 index 000000000000..9479bc4b8f7e --- /dev/null +++ b/pkg/sql/parser/testdata/two_phase_commit @@ -0,0 +1,23 @@ +parse +PREPARE TRANSACTION 'id' +---- +PREPARE TRANSACTION 'id' +PREPARE TRANSACTION ('id') -- fully parenthesized +PREPARE TRANSACTION '_' -- literals removed +PREPARE TRANSACTION 'id' -- identifiers removed + +parse +COMMIT PREPARED 'id' +---- +COMMIT PREPARED 'id' +COMMIT PREPARED ('id') -- fully parenthesized +COMMIT PREPARED '_' -- literals removed +COMMIT PREPARED 'id' -- identifiers removed + +parse +ROLLBACK PREPARED 'id' +---- +ROLLBACK PREPARED 'id' +ROLLBACK PREPARED ('id') -- fully parenthesized +ROLLBACK PREPARED '_' -- literals removed +ROLLBACK PREPARED 'id' -- identifiers removed diff --git a/pkg/sql/sem/catconstants/constants.go b/pkg/sql/sem/catconstants/constants.go index 8b2636f2289c..a55958a88d6d 100644 --- a/pkg/sql/sem/catconstants/constants.go +++ b/pkg/sql/sem/catconstants/constants.go @@ -106,6 +106,7 @@ const ( MVCCStatistics SystemTableName = "mvcc_statistics" StmtExecInsightsTableName SystemTableName = "statement_execution_insights" TxnExecInsightsTableName SystemTableName = "transaction_execution_insights" + PreparedTransactionsTableName SystemTableName = "prepared_transactions" ) // Oid for virtual database and table. diff --git a/pkg/sql/sem/tree/stmt.go b/pkg/sql/sem/tree/stmt.go index fd18a9513b22..39523002f117 100644 --- a/pkg/sql/sem/tree/stmt.go +++ b/pkg/sql/sem/tree/stmt.go @@ -824,6 +824,15 @@ func (*CommentOnType) StatementType() StatementType { return TypeDDL } // StatementTag returns a short string identifying the type of statement. func (*CommentOnType) StatementTag() string { return CommentOnTypeTag } +// StatementReturnType implements the Statement interface. +func (*CommitPrepared) StatementReturnType() StatementReturnType { return Ack } + +// StatementType implements the Statement interface. +func (*CommitPrepared) StatementType() StatementType { return TypeTCL } + +// StatementTag returns a short string identifying the type of statement. +func (*CommitPrepared) StatementTag() string { return "COMMIT PREPARED" } + // StatementReturnType implements the Statement interface. func (*CommitTransaction) StatementReturnType() StatementReturnType { return Ack } @@ -1295,6 +1304,15 @@ func (*Prepare) StatementType() StatementType { return TypeTCL } // StatementTag returns a short string identifying the type of statement. func (*Prepare) StatementTag() string { return "PREPARE" } +// StatementReturnType implements the Statement interface. +func (*PrepareTransaction) StatementReturnType() StatementReturnType { return Ack } + +// StatementType implements the Statement interface. +func (*PrepareTransaction) StatementType() StatementType { return TypeTCL } + +// StatementTag returns a short string identifying the type of statement. +func (*PrepareTransaction) StatementTag() string { return "PREPARE TRANSACTION" } + // StatementReturnType implements the Statement interface. func (*ReassignOwnedBy) StatementReturnType() StatementReturnType { return DDL } @@ -1443,6 +1461,15 @@ func (*RevokeRole) StatementType() StatementType { return TypeDCL } // StatementTag returns a short string identifying the type of statement. func (*RevokeRole) StatementTag() string { return "REVOKE" } +// StatementReturnType implements the Statement interface. +func (*RollbackPrepared) StatementReturnType() StatementReturnType { return Ack } + +// StatementType implements the Statement interface. +func (*RollbackPrepared) StatementType() StatementType { return TypeTCL } + +// StatementTag returns a short string identifying the type of statement. +func (*RollbackPrepared) StatementTag() string { return "ROLLBACK PREPARED" } + // StatementReturnType implements the Statement interface. func (*RollbackToSavepoint) StatementReturnType() StatementReturnType { return Ack } @@ -2384,6 +2411,7 @@ func (n *CommentOnSchema) String() string { return AsString( func (n *CommentOnIndex) String() string { return AsString(n) } func (n *CommentOnTable) String() string { return AsString(n) } func (n *CommentOnType) String() string { return AsString(n) } +func (n *CommitPrepared) String() string { return AsString(n) } func (n *CommitTransaction) String() string { return AsString(n) } func (n *CopyFrom) String() string { return AsString(n) } func (n *CopyTo) String() string { return AsString(n) } @@ -2432,6 +2460,7 @@ func (n *Import) String() string { return AsString( func (n *LiteralValuesClause) String() string { return AsString(n) } func (n *ParenSelect) String() string { return AsString(n) } func (n *Prepare) String() string { return AsString(n) } +func (n *PrepareTransaction) String() string { return AsString(n) } func (n *ReassignOwnedBy) String() string { return AsString(n) } func (n *ReleaseSavepoint) String() string { return AsString(n) } func (n *Relocate) String() string { return AsString(n) } @@ -2446,6 +2475,7 @@ func (n *Restore) String() string { return AsString( func (n *RoutineReturn) String() string { return AsString(n) } func (n *Revoke) String() string { return AsString(n) } func (n *RevokeRole) String() string { return AsString(n) } +func (n *RollbackPrepared) String() string { return AsString(n) } func (n *RollbackToSavepoint) String() string { return AsString(n) } func (n *RollbackTransaction) String() string { return AsString(n) } func (n *Savepoint) String() string { return AsString(n) } diff --git a/pkg/sql/sem/tree/txn.go b/pkg/sql/sem/tree/txn.go index 6e42ece16cea..f24469e5229d 100644 --- a/pkg/sql/sem/tree/txn.go +++ b/pkg/sql/sem/tree/txn.go @@ -323,3 +323,39 @@ func (node *RollbackToSavepoint) Format(ctx *FmtCtx) { ctx.WriteString("ROLLBACK TRANSACTION TO SAVEPOINT ") ctx.FormatNode(&node.Savepoint) } + +// PrepareTransaction represents a PREPARE TRANSACTION +// statement, used for the first phase of a two-phase commit. +type PrepareTransaction struct { + Transaction *StrVal +} + +// Format implements the NodeFormatter interface. +func (node *PrepareTransaction) Format(ctx *FmtCtx) { + ctx.WriteString("PREPARE TRANSACTION ") + ctx.FormatNode(node.Transaction) +} + +// CommitPrepared represents a COMMIT PREPARED statement, used +// for the second phase of a two-phase commit. +type CommitPrepared struct { + Transaction *StrVal +} + +// Format implements the NodeFormatter interface. +func (node *CommitPrepared) Format(ctx *FmtCtx) { + ctx.WriteString("COMMIT PREPARED ") + ctx.FormatNode(node.Transaction) +} + +// RollbackPrepared represents a ROLLBACK PREPARED statement, +// used for the second phase of a two-phase rollback. +type RollbackPrepared struct { + Transaction *StrVal +} + +// Format implements the NodeFormatter interface. +func (node *RollbackPrepared) Format(ctx *FmtCtx) { + ctx.WriteString("ROLLBACK PREPARED ") + ctx.FormatNode(node.Transaction) +} diff --git a/pkg/sql/tests/testdata/initial_keys b/pkg/sql/tests/testdata/initial_keys index a7d1396c85eb..5a09ba9aace7 100644 --- a/pkg/sql/tests/testdata/initial_keys +++ b/pkg/sql/tests/testdata/initial_keys @@ -1,6 +1,6 @@ initial-keys tenant=system ---- -131 keys: +133 keys: /Table/3/1/1/2/1 /Table/3/1/3/2/1 /Table/3/1/4/2/1 @@ -58,6 +58,7 @@ initial-keys tenant=system /Table/3/1/64/2/1 /Table/3/1/65/2/1 /Table/3/1/66/2/1 + /Table/3/1/67/2/1 /Table/5/1/0/2/1 /Table/5/1/1/2/1 /Table/5/1/11/2/1 @@ -88,6 +89,7 @@ initial-keys tenant=system /NamespaceTable/30/1/1/29/"migrations"/4/1 /NamespaceTable/30/1/1/29/"mvcc_statistics"/4/1 /NamespaceTable/30/1/1/29/"namespace"/4/1 + /NamespaceTable/30/1/1/29/"prepared_transactions"/4/1 /NamespaceTable/30/1/1/29/"privileges"/4/1 /NamespaceTable/30/1/1/29/"protected_ts_meta"/4/1 /NamespaceTable/30/1/1/29/"protected_ts_records"/4/1 @@ -132,7 +134,7 @@ initial-keys tenant=system /NamespaceTable/30/1/1/29/"zones"/4/1 /Table/48/1/0/0 /Table/63/1/0/0 -62 splits: +63 splits: /Table/3 /Table/4 /Table/5 @@ -195,10 +197,11 @@ initial-keys tenant=system /Table/64 /Table/65 /Table/66 + /Table/67 initial-keys tenant=5 ---- -122 keys: +124 keys: /Tenant/5/Table/3/1/1/2/1 /Tenant/5/Table/3/1/3/2/1 /Tenant/5/Table/3/1/4/2/1 @@ -256,6 +259,7 @@ initial-keys tenant=5 /Tenant/5/Table/3/1/64/2/1 /Tenant/5/Table/3/1/65/2/1 /Tenant/5/Table/3/1/66/2/1 + /Tenant/5/Table/3/1/67/2/1 /Tenant/5/Table/5/1/0/2/1 /Tenant/5/Table/7/1/0/0 /Tenant/5/Table/8/1/1/0 @@ -277,6 +281,7 @@ initial-keys tenant=5 /Tenant/5/NamespaceTable/30/1/1/29/"migrations"/4/1 /Tenant/5/NamespaceTable/30/1/1/29/"mvcc_statistics"/4/1 /Tenant/5/NamespaceTable/30/1/1/29/"namespace"/4/1 + /Tenant/5/NamespaceTable/30/1/1/29/"prepared_transactions"/4/1 /Tenant/5/NamespaceTable/30/1/1/29/"privileges"/4/1 /Tenant/5/NamespaceTable/30/1/1/29/"protected_ts_meta"/4/1 /Tenant/5/NamespaceTable/30/1/1/29/"protected_ts_records"/4/1 @@ -327,7 +332,7 @@ initial-keys tenant=5 initial-keys tenant=999 ---- -122 keys: +124 keys: /Tenant/999/Table/3/1/1/2/1 /Tenant/999/Table/3/1/3/2/1 /Tenant/999/Table/3/1/4/2/1 @@ -385,6 +390,7 @@ initial-keys tenant=999 /Tenant/999/Table/3/1/64/2/1 /Tenant/999/Table/3/1/65/2/1 /Tenant/999/Table/3/1/66/2/1 + /Tenant/999/Table/3/1/67/2/1 /Tenant/999/Table/5/1/0/2/1 /Tenant/999/Table/7/1/0/0 /Tenant/999/Table/8/1/1/0 @@ -406,6 +412,7 @@ initial-keys tenant=999 /Tenant/999/NamespaceTable/30/1/1/29/"migrations"/4/1 /Tenant/999/NamespaceTable/30/1/1/29/"mvcc_statistics"/4/1 /Tenant/999/NamespaceTable/30/1/1/29/"namespace"/4/1 + /Tenant/999/NamespaceTable/30/1/1/29/"prepared_transactions"/4/1 /Tenant/999/NamespaceTable/30/1/1/29/"privileges"/4/1 /Tenant/999/NamespaceTable/30/1/1/29/"protected_ts_meta"/4/1 /Tenant/999/NamespaceTable/30/1/1/29/"protected_ts_records"/4/1 diff --git a/pkg/sql/vars.go b/pkg/sql/vars.go index fbebc741e769..cd7de49fe4cd 100644 --- a/pkg/sql/vars.go +++ b/pkg/sql/vars.go @@ -1196,6 +1196,10 @@ var varGen = map[string]sessionVar{ // See https://www.postgresql.org/docs/10/static/runtime-config-preset.html#GUC-MAX-INDEX-KEYS `max_index_keys`: makeReadOnlyVar("32"), + // Supported for PG compatibility only. MaxInt32 indicates no limit. + // See https://www.postgresql.org/docs/10/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS + `max_prepared_transactions`: makeReadOnlyVar(strconv.Itoa(math.MaxInt32)), + // CockroachDB extension. `node_id`: { Get: func(evalCtx *extendedEvalContext, _ *kv.Txn) (string, error) { diff --git a/pkg/upgrade/upgrades/BUILD.bazel b/pkg/upgrade/upgrades/BUILD.bazel index 26077901638b..8bfca3df4aad 100644 --- a/pkg/upgrade/upgrades/BUILD.bazel +++ b/pkg/upgrade/upgrades/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "v24_2_tenant_rates.go", "v24_2_tenant_system_tables.go", "v24_3_add_timeseries_zone_config.go", + "v24_3_prepared_transactions_table.go", ], importpath = "github.com/cockroachdb/cockroach/pkg/upgrade/upgrades", visibility = ["//visibility:public"], @@ -80,6 +81,7 @@ go_test( "v24_2_delete_version_tenant_settings_test.go", "v24_2_tenant_rates_test.go", "v24_2_tenant_system_tables_test.go", + "v24_3_prepared_transactions_table_test.go", "version_starvation_test.go", ], data = glob(["testdata/**"]), diff --git a/pkg/upgrade/upgrades/upgrades.go b/pkg/upgrade/upgrades/upgrades.go index c68a9597abf6..5e5802849d0b 100644 --- a/pkg/upgrade/upgrades/upgrades.go +++ b/pkg/upgrade/upgrades/upgrades.go @@ -107,6 +107,14 @@ var upgrades = []upgradebase.Upgrade{ upgrade.RestoreActionNotRequired("this zone config isn't necessary for restore"), ), + upgrade.NewTenantUpgrade( + "create prepared_transactions table", + clusterversion.V24_3_PreparedTransactionsTable.Version(), + upgrade.NoPrecondition, + createPreparedTransactionsTable, + upgrade.RestoreActionNotRequired("cluster restore does not restore this table"), + ), + // Note: when starting a new release version, the first upgrade (for // Vxy_zStart) must be a newFirstUpgrade. Keep this comment at the bottom. } diff --git a/pkg/upgrade/upgrades/v24_2_tenant_system_tables_test.go b/pkg/upgrade/upgrades/v24_2_tenant_system_tables_test.go index b0797752f42a..b40e8e795ffb 100644 --- a/pkg/upgrade/upgrades/v24_2_tenant_system_tables_test.go +++ b/pkg/upgrade/upgrades/v24_2_tenant_system_tables_test.go @@ -96,7 +96,7 @@ func TestCreateTenantSystemTables(t *testing.T) { require.NoError(t, err, fmt.Sprintf("%s does not exist", tableName)) } - upgrades.Upgrade(t, tenantDB, clusterversion.V24_2_TenantSystemTables, nil, false) + upgrades.Upgrade(t, tenantDB, clusterversion.Latest, nil, false) checkTable("system.tenants") checkTable("system.tenant_settings") checkTable("system.tenant_usage") diff --git a/pkg/upgrade/upgrades/v24_3_prepared_transactions_table.go b/pkg/upgrade/upgrades/v24_3_prepared_transactions_table.go new file mode 100644 index 000000000000..9c66c1e6f8a6 --- /dev/null +++ b/pkg/upgrade/upgrades/v24_3_prepared_transactions_table.go @@ -0,0 +1,28 @@ +// Copyright 2024 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package upgrades + +import ( + "context" + + "github.com/cockroachdb/cockroach/pkg/clusterversion" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/systemschema" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" + "github.com/cockroachdb/cockroach/pkg/upgrade" +) + +// createPreparedTransactionsTable creates the prepared_transactions system +// table. +func createPreparedTransactionsTable( + ctx context.Context, cv clusterversion.ClusterVersion, d upgrade.TenantDeps, +) error { + return createSystemTable(ctx, d.DB, d.Settings, d.Codec, systemschema.PreparedTransactionsTable, tree.LocalityLevelTable) +} diff --git a/pkg/upgrade/upgrades/v24_3_prepared_transactions_table_test.go b/pkg/upgrade/upgrades/v24_3_prepared_transactions_table_test.go new file mode 100644 index 000000000000..7a49834904c7 --- /dev/null +++ b/pkg/upgrade/upgrades/v24_3_prepared_transactions_table_test.go @@ -0,0 +1,54 @@ +// Copyright 2024 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package upgrades_test + +import ( + "context" + "testing" + + "github.com/cockroachdb/cockroach/pkg/base" + "github.com/cockroachdb/cockroach/pkg/clusterversion" + "github.com/cockroachdb/cockroach/pkg/server" + "github.com/cockroachdb/cockroach/pkg/sql" + "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" + "github.com/cockroachdb/cockroach/pkg/upgrade/upgrades" + "github.com/cockroachdb/cockroach/pkg/util/leaktest" + "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/stretchr/testify/require" +) + +func TestPreparedTransactionsTable(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + + clusterArgs := base.TestClusterArgs{ + ServerArgs: base.TestServerArgs{ + Knobs: base.TestingKnobs{ + Server: &server.TestingKnobs{ + DisableAutomaticVersionUpgrade: make(chan struct{}), + ClusterVersionOverride: clusterversion.MinSupported.Version(), + }, + }, + }, + } + + ctx := context.Background() + tc := testcluster.StartTestCluster(t, 1, clusterArgs) + defer tc.Stopper().Stop(ctx) + s, sqlDB := tc.Server(0), tc.ServerConn(0) + + require.True(t, s.ExecutorConfig().(sql.ExecutorConfig).Codec.ForSystemTenant()) + _, err := sqlDB.Exec("SELECT * FROM system.prepared_transactions") + require.Error(t, err, "system.tenant_usage rates columns should not exist") + upgrades.Upgrade(t, sqlDB, clusterversion.V24_3_PreparedTransactionsTable, nil, false) + _, err = sqlDB.Exec("SELECT * FROM system.prepared_transactions") + require.NoError(t, err, "system.tenant_usage rates columns should exist") +} diff --git a/pkg/util/rangedesc/testdata/scoped_iteration b/pkg/util/rangedesc/testdata/scoped_iteration index d5fa182e5b88..078981466538 100644 --- a/pkg/util/rangedesc/testdata/scoped_iteration +++ b/pkg/util/rangedesc/testdata/scoped_iteration @@ -67,35 +67,36 @@ scan - r65:/Table/6{3-4} - r66:/Table/6{4-5} - r67:/Table/6{5-6} -- r68:/{Table/66-Max} -scan through /M{in-ax} (page-size=1) found 68/68 descriptors +- r68:/Table/6{6-7} +- r69:/{Table/67-Max} +scan through /M{in-ax} (page-size=1) found 69/69 descriptors scan scope=1 ---- - r2:/System/NodeLiveness{-Max} -scan through /System/NodeLiveness{-Max} (page-size=1) found 1/68 descriptors +scan through /System/NodeLiveness{-Max} (page-size=1) found 1/69 descriptors scan scope=2 ---- - r4:/System{/tsd-tse} -scan through /System{/tsd-tse} (page-size=1) found 1/68 descriptors +scan through /System{/tsd-tse} (page-size=1) found 1/69 descriptors scan scope=3 ---- - r1:/{Meta1-System/NodeLiveness} -scan through /M{in-eta2} (page-size=1) found 1/68 descriptors +scan through /M{in-eta2} (page-size=1) found 1/69 descriptors scan scope=4 ---- - r1:/{Meta1-System/NodeLiveness} -scan through /{Meta1-System} (page-size=1) found 1/68 descriptors +scan through /{Meta1-System} (page-size=1) found 1/69 descriptors scan scope=5 ---- - r7:/Table/{3-4} - r8:/Table/{4-5} - r9:/Table/{5-6} -scan through /Table/{3-6} (page-size=1) found 3/68 descriptors +scan through /Table/{3-6} (page-size=1) found 3/69 descriptors scan scope=6 ---- @@ -109,7 +110,7 @@ scan scope=6 - r48:/Table/4{5-6} - r49:/Table/4{6-7} - r50:/Table/4{7-8} -scan through /Table/{38-48} (page-size=1) found 10/68 descriptors +scan through /Table/{38-48} (page-size=1) found 10/69 descriptors scan scope=7 ---- @@ -175,5 +176,6 @@ scan scope=7 - r65:/Table/6{3-4} - r66:/Table/6{4-5} - r67:/Table/6{5-6} -- r68:/{Table/66-Max} -scan through /Table/{0-Max} (page-size=1) found 63/68 descriptors +- r68:/Table/6{6-7} +- r69:/{Table/67-Max} +scan through /Table/{0-Max} (page-size=1) found 64/69 descriptors diff --git a/pkg/util/rangedesc/testdata/scoped_iteration_with_page_size b/pkg/util/rangedesc/testdata/scoped_iteration_with_page_size index 12b1f7bc8e61..8e8e25d6d7a6 100644 --- a/pkg/util/rangedesc/testdata/scoped_iteration_with_page_size +++ b/pkg/util/rangedesc/testdata/scoped_iteration_with_page_size @@ -67,18 +67,19 @@ scan page-size=3 - r65:/Table/6{3-4} - r66:/Table/6{4-5} - r67:/Table/6{5-6} -- r68:/{Table/66-Max} -scan through /M{in-ax} (page-size=3) found 68/68 descriptors +- r68:/Table/6{6-7} +- r69:/{Table/67-Max} +scan through /M{in-ax} (page-size=3) found 69/69 descriptors scan scope=1 page-size=5 ---- - r2:/System/NodeLiveness{-Max} -scan through /System/NodeLiveness{-Max} (page-size=5) found 1/68 descriptors +scan through /System/NodeLiveness{-Max} (page-size=5) found 1/69 descriptors scan scope=1 page-size=500 ---- - r2:/System/NodeLiveness{-Max} -scan through /System/NodeLiveness{-Max} (page-size=500) found 1/68 descriptors +scan through /System/NodeLiveness{-Max} (page-size=500) found 1/69 descriptors scan scope=6 page-size=4 ---- @@ -92,4 +93,4 @@ scan scope=6 page-size=4 - r48:/Table/4{5-6} - r49:/Table/4{6-7} - r50:/Table/4{7-8} -scan through /Table/{38-48} (page-size=4) found 10/68 descriptors +scan through /Table/{38-48} (page-size=4) found 10/69 descriptors diff --git a/pkg/util/rangedesc/testdata/scoped_iteration_with_splits b/pkg/util/rangedesc/testdata/scoped_iteration_with_splits index 642306e5d31f..f0f6cc0a9f57 100644 --- a/pkg/util/rangedesc/testdata/scoped_iteration_with_splits +++ b/pkg/util/rangedesc/testdata/scoped_iteration_with_splits @@ -7,8 +7,8 @@ splitting at /Meta2/"middle" scan ---- - r1:/Meta{1-2} -- r69:/Meta2{-/middle} -- r70:/{Meta2/middle-System/NodeLiveness} +- r70:/Meta2{-/middle} +- r71:/{Meta2/middle-System/NodeLiveness} - r2:/System/NodeLiveness{-Max} - r3:/System/{NodeLivenessMax-tsd} - r4:/System{/tsd-tse} @@ -75,19 +75,20 @@ scan - r65:/Table/6{3-4} - r66:/Table/6{4-5} - r67:/Table/6{5-6} -- r68:/{Table/66-Max} -scan through /M{in-ax} (page-size=1) found 70/70 descriptors +- r68:/Table/6{6-7} +- r69:/{Table/67-Max} +scan through /M{in-ax} (page-size=1) found 71/71 descriptors # Scanning through just meta1 is unnaffected by these splits. scan scope=3 ---- - r1:/Meta{1-2} -scan through /M{in-eta2} (page-size=1) found 1/70 descriptors +scan through /M{in-eta2} (page-size=1) found 1/71 descriptors # Scanning through both meta{1,2} does surface these descriptors. scan scope=4 page-size=2 ---- - r1:/Meta{1-2} -- r69:/Meta2{-/middle} -- r70:/{Meta2/middle-System/NodeLiveness} -scan through /{Meta1-System} (page-size=2) found 3/70 descriptors +- r70:/Meta2{-/middle} +- r71:/{Meta2/middle-System/NodeLiveness} +scan through /{Meta1-System} (page-size=2) found 3/71 descriptors