Skip to content

Commit 2b821ef

Browse files
craig[bot]bghaljeffswensonspilchen
committed
151067: sql: add sql grammar for inspect command r=bghal a=bghal The `INSPECT` commands are being added to support data consistency validation. These new statements require new SQL grammar. The grammar is added in this change and the implementations will be added in future PRs. Epic: CRDB-30356 Part of: #148272 Release note (sql change): Introduces the `INSPECT TABLE` and `INSPECT DATABASE` statements that are unimplemented. The new `enable_inspect_command` cluster setting feature flag configures access to the new features as they're implemented. 152929: sstbatcher: pass unix nanos when computing stats r=jeffswenson a=jeffswenson Previously, when regenerating stats from a split, we passed unix seconds to the stats calculation routine instead of unix nanoseconds. This is incorrect, but doesn't seem to have any observable impact on behavior since the time is used to estimate the age of garbage. The SST batcher cannot calculate garbage age bytes since it is missing the previous value and therefore does not know the size of the value. Epic: none Release note: none 152974: roachtest: disable use_soft_limit_for_distribute_scan in bulk ingest test r=spilchen a=spilchen Temporarily disable use_soft_limit_for_distribute_scan in the schema change bulk ingest test to validate that this setting is the root cause of the performance regression observed in issue #152859. It is suspected that the regression occurred due to commit dd57482, which change the default value of use_soft_limit_for_distribute_scan. This just changes the setting back to its original default to verify. Informs #152859 Release note: None Co-authored-by: Brendan Gerrity <[email protected]> Co-authored-by: Jeff Swenson <[email protected]> Co-authored-by: Matt Spilchen <[email protected]>
4 parents ac24cb9 + 8ffc5bf + 54c487a + c67361d commit 2b821ef

29 files changed

+550
-13
lines changed

docs/generated/sql/bnf/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ FILES = [
174174
"index_def",
175175
"insert_rest",
176176
"insert_stmt",
177+
"inspect_stmt",
178+
"inspect_database_stmt",
179+
"inspect_table_stmt",
177180
"iso_level",
178181
"joined_table",
179182
"legacy_begin_stmt",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inspect_database_stmt ::=
2+
'INSPECT' 'DATABASE' db_name opt_as_of_clause opt_inspect_options_clause
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
inspect_stmt ::=
2+
inspect_table_stmt
3+
| inspect_database_stmt
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inspect_table_stmt ::=
2+
'INSPECT' 'TABLE' table_name opt_as_of_clause opt_inspect_options_clause

docs/generated/sql/bnf/preparable_stmt.bnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ preparable_stmt ::=
99
| explain_stmt
1010
| import_stmt
1111
| insert_stmt
12+
| inspect_stmt
1213
| pause_stmt
1314
| reset_stmt
1415
| restore_stmt

docs/generated/sql/bnf/stmt_block.bnf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ preparable_stmt ::=
4949
| explain_stmt
5050
| import_stmt
5151
| insert_stmt
52+
| inspect_stmt
5253
| pause_stmt
5354
| reset_stmt
5455
| restore_stmt
@@ -246,6 +247,10 @@ insert_stmt ::=
246247
opt_with_clause 'INSERT' 'INTO' insert_target insert_rest returning_clause
247248
| opt_with_clause 'INSERT' 'INTO' insert_target insert_rest on_conflict returning_clause
248249

250+
inspect_stmt ::=
251+
inspect_table_stmt
252+
| inspect_database_stmt
253+
249254
pause_stmt ::=
250255
pause_jobs_stmt
251256
| pause_schedules_stmt
@@ -753,6 +758,12 @@ on_conflict ::=
753758
| 'ON' 'CONFLICT' 'ON' 'CONSTRAINT' constraint_name 'DO' 'NOTHING'
754759
| 'ON' 'CONFLICT' 'ON' 'CONSTRAINT' constraint_name 'DO' 'UPDATE' 'SET' set_clause_list opt_where_clause
755760

761+
inspect_table_stmt ::=
762+
'INSPECT' 'TABLE' table_name opt_as_of_clause opt_inspect_options_clause
763+
764+
inspect_database_stmt ::=
765+
'INSPECT' 'DATABASE' db_name opt_as_of_clause opt_inspect_options_clause
766+
756767
pause_jobs_stmt ::=
757768
'PAUSE' 'JOB' a_expr
758769
| 'PAUSE' 'JOB' a_expr 'WITH' 'REASON' '=' string_or_placeholder
@@ -1260,6 +1271,7 @@ unreserved_keyword ::=
12601271
| 'INJECT'
12611272
| 'INPUT'
12621273
| 'INSERT'
1274+
| 'INSPECT'
12631275
| 'INSTEAD'
12641276
| 'INTO_DB'
12651277
| 'INVERTED'
@@ -2044,6 +2056,13 @@ insert_column_item ::=
20442056
kv_option_list ::=
20452057
( kv_option ) ( ( ',' kv_option ) )*
20462058

2059+
opt_inspect_options_clause ::=
2060+
'WITH' 'OPTIONS' inspect_option_list
2061+
|
2062+
2063+
db_name ::=
2064+
db_object_name
2065+
20472066
session_var ::=
20482067
'identifier'
20492068
| 'identifier' session_var_parts
@@ -2945,6 +2964,9 @@ kv_option ::=
29452964
| 'SCONST' '=' string_or_placeholder
29462965
| 'SCONST'
29472966

2967+
inspect_option_list ::=
2968+
( inspect_option ) ( ( ',' inspect_option ) )*
2969+
29482970
session_var_parts ::=
29492971
( '.' 'identifier' ) ( ( '.' 'identifier' ) )*
29502972

@@ -3587,6 +3609,10 @@ only_signed_fconst ::=
35873609
db_object_name_list ::=
35883610
( db_object_name ) ( ( ',' db_object_name ) )*
35893611

3612+
inspect_option ::=
3613+
'INDEX' 'ALL'
3614+
| 'INDEX' '(' table_index_name_list ')'
3615+
35903616
virtual_cluster_name ::=
35913617
'VIRTUAL_CLUSTER_NAME'
35923618

@@ -4174,6 +4200,7 @@ bare_label_keywords ::=
41744200
| 'INPUT'
41754201
| 'INSENSITIVE'
41764202
| 'INSERT'
4203+
| 'INSPECT'
41774204
| 'INSTEAD'
41784205
| 'INT'
41794206
| 'INTEGER'

pkg/cmd/roachtest/tests/schemachange.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,13 @@ func makeSchemaChangeBulkIngestTest(
433433
db := c.Conn(ctx, t.L(), 1)
434434
defer db.Close()
435435

436+
// TODO(152859): Temporarily disable soft limit for distribute scan to
437+
// test performance regression fix (see #152295).
438+
t.L().Printf("Setting use_soft_limit_for_distribute_scan = false")
439+
if _, err := db.Exec("SET use_soft_limit_for_distribute_scan = false"); err != nil {
440+
t.Fatal(err)
441+
}
442+
436443
t.L().Printf("Computing table statistics manually")
437444
if _, err := db.Exec("CREATE STATISTICS stats from bulkingest.bulkingest"); err != nil {
438445
t.Fatal(err)

pkg/gen/bnf.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ BNF_SRCS = [
174174
"//docs/generated/sql/bnf:index_def.bnf",
175175
"//docs/generated/sql/bnf:insert_rest.bnf",
176176
"//docs/generated/sql/bnf:insert_stmt.bnf",
177+
"//docs/generated/sql/bnf:inspect_database_stmt.bnf",
178+
"//docs/generated/sql/bnf:inspect_stmt.bnf",
179+
"//docs/generated/sql/bnf:inspect_table_stmt.bnf",
177180
"//docs/generated/sql/bnf:iso_level.bnf",
178181
"//docs/generated/sql/bnf:joined_table.bnf",
179182
"//docs/generated/sql/bnf:legacy_begin_stmt.bnf",

pkg/gen/diagrams.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ DIAGRAMS_SRCS = [
174174
"//docs/generated/sql/bnf:index_def.html",
175175
"//docs/generated/sql/bnf:insert.html",
176176
"//docs/generated/sql/bnf:insert_rest.html",
177+
"//docs/generated/sql/bnf:inspect.html",
178+
"//docs/generated/sql/bnf:inspect_database.html",
179+
"//docs/generated/sql/bnf:inspect_table.html",
177180
"//docs/generated/sql/bnf:iso_level.html",
178181
"//docs/generated/sql/bnf:joined_table.html",
179182
"//docs/generated/sql/bnf:legacy_begin.html",

pkg/gen/docs.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ DOCS_SRCS = [
184184
"//docs/generated/sql/bnf:index_def.bnf",
185185
"//docs/generated/sql/bnf:insert_rest.bnf",
186186
"//docs/generated/sql/bnf:insert_stmt.bnf",
187+
"//docs/generated/sql/bnf:inspect_database_stmt.bnf",
188+
"//docs/generated/sql/bnf:inspect_stmt.bnf",
189+
"//docs/generated/sql/bnf:inspect_table_stmt.bnf",
187190
"//docs/generated/sql/bnf:iso_level.bnf",
188191
"//docs/generated/sql/bnf:joined_table.bnf",
189192
"//docs/generated/sql/bnf:legacy_begin_stmt.bnf",

0 commit comments

Comments
 (0)