Skip to content

Commit 0724d85

Browse files
committed
logictest: reduce test churn when adding new system table
This commit reduces the test churn when adding a new system table via: - eliding rangeID prefix from 'sending batch ...' trace message - replacing the tableIDs in messages like '<before:/Table/77>' and '<after:/Table/107/1>' with 'XX'. Additionally it adjusts a handful of tests to avoid requesting the range ID where it didn't seem required for the purpose of the test. It also removes duplicated query from `information_schema` test which should've been removed when `local-mixed-23.2` config was removed. Release note: None
1 parent 432dd73 commit 0724d85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+265
-570
lines changed

pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ SELECT * FROM crdb_internal.node_txn_execution_insights WHERE query = ''
248248
----
249249
txn_id txn_fingerprint_id query implicit_txn session_id start_time end_time user_name app_name rows_read rows_written priority retries last_retry_reason contention problems causes stmt_execution_ids cpu_sql_nanos last_error_code last_error_redactable status
250250

251-
query ITTI
252-
SELECT range_id, start_pretty, end_pretty, lease_holder FROM crdb_internal.ranges
251+
query TTI
252+
SELECT start_pretty, end_pretty, lease_holder FROM crdb_internal.ranges
253253
----
254-
80 /Tenant/10 /Tenant/11 1
254+
/Tenant/10 /Tenant/11 1
255255

256-
query ITT
257-
SELECT range_id, start_pretty, end_pretty FROM crdb_internal.ranges_no_leases
256+
query TT
257+
SELECT start_pretty, end_pretty FROM crdb_internal.ranges_no_leases
258258
----
259-
80 /Tenant/10 /Tenant/11
259+
/Tenant/10 /Tenant/11
260260

261261
query IT
262262
SELECT zone_id, target FROM crdb_internal.zones ORDER BY 1

pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,9 @@ messages_global
468468

469469
# Non-DML SHOW RANGES statement on RBR table should succeed.
470470
skipif config multiregion-9node-3region-3azs-vec-off
471-
query I retry
471+
retry
472+
statement ok
472473
SELECT DISTINCT range_id FROM [SHOW RANGES FROM TABLE messages_rbr]
473-
----
474-
85
475474

476475
# Update does not fail when accessing all rows in messages_rbr because lookup
477476
# join does not error out the lookup table in phase 1.

pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_insert_fast_path

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ query T rowsort
200200
SELECT message FROM [SHOW KV TRACE FOR SESSION]
201201
WHERE message LIKE '%batch%' AND message LIKE '%Scan%'
202202
----
203-
r79: sending batch 4 Scan to (n1,s1):1
203+
sending batch 4 Scan to (n1,s1):1
204204

205205
# Regression test for #115377.
206206
statement ok

pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ ap-southeast-2 23
266266
query TT
267267
SELECT start_key, end_key FROM [SHOW RANGE FROM TABLE regional_by_row_table FOR ROW ('ap-southeast-2', 1)]
268268
----
269-
<before:/Table/76> …
269+
<before:/Table/XX> …
270270

271271
query TIIII
272272
SELECT crdb_region, pk, pk2, a, b FROM regional_by_row_table
@@ -404,9 +404,9 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX r
404404
ORDER BY 1
405405
----
406406
start_key end_key replicas lease_holder
407-
<before:/Table/76> …/"\x80"/0 {1} 1
407+
<before:/Table/XX> …/"\x80"/0 {1} 1
408408
…/"\x80"/0 …/"\xc0"/0 {4} 4
409-
…/"\xc0"/0 <after:/Table/110/5> {7} 7
409+
…/"\xc0"/0 <after:/Table/XX/5> {7} 7
410410

411411
statement ok
412412
SET locality_optimized_partitioned_index_scan = false

pkg/sql/logictest/logic.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,16 @@ import (
531531
// - For troubleshooting / analysis: add -v -show-sql -error-summary.
532532

533533
var (
534-
resultsRE = regexp.MustCompile(`^(\d+)\s+values?\s+hashing\s+to\s+([0-9A-Fa-f]+)$`)
535-
noticeRE = regexp.MustCompile(`^statement\s+(?:async\s+[[:alnum:]]+\s+)?notice\s+(.*)$`)
536-
errorRE = regexp.MustCompile(`^(?:statement|query)\s+(?:async\s+[[:alnum:]]+\s+)?error\s+(?:pgcode\s+([[:alnum:]]+)\s+)?(.*)$`)
537-
varRE = regexp.MustCompile(`\$[a-zA-Z][a-zA-Z_0-9]*`)
538-
orderRE = regexp.MustCompile(`(?i)ORDER\s+BY`)
539-
explainRE = regexp.MustCompile(`(?i)EXPLAIN\W+`)
540-
showTraceRE = regexp.MustCompile(`(?i)SHOW\s+(KV\s+)?TRACE`)
534+
resultsRE = regexp.MustCompile(`^(\d+)\s+values?\s+hashing\s+to\s+([0-9A-Fa-f]+)$`)
535+
noticeRE = regexp.MustCompile(`^statement\s+(?:async\s+[[:alnum:]]+\s+)?notice\s+(.*)$`)
536+
errorRE = regexp.MustCompile(`^(?:statement|query)\s+(?:async\s+[[:alnum:]]+\s+)?error\s+(?:pgcode\s+([[:alnum:]]+)\s+)?(.*)$`)
537+
varRE = regexp.MustCompile(`\$[a-zA-Z][a-zA-Z_0-9]*`)
538+
orderRE = regexp.MustCompile(`(?i)ORDER\s+BY`)
539+
explainRE = regexp.MustCompile(`(?i)EXPLAIN\W+`)
540+
showTraceRE = regexp.MustCompile(`(?i)SHOW\s+(KV\s+)?TRACE`)
541+
sendingBatchRE = regexp.MustCompile(`r\d+: (sending batch .*)`)
542+
beforeTableRE = regexp.MustCompile(`(<before:/Table/)\d+(>)`)
543+
afterTableRE = regexp.MustCompile(`(<after:/Table/)\d+(/.*>)`)
541544

542545
// Bigtest is a flag which should be set if the long-running sqlite logic tests should be run.
543546
Bigtest = flag.Bool("bigtest", false, "enable the long-running SqlLiteLogic test")
@@ -4076,6 +4079,21 @@ func (t *logicTest) finishExecQuery(query logicQuery, rowses []*gosql.Rows, exec
40764079
if query.roundFloatsInStringsSigFigs > 0 {
40774080
s = floatcmp.RoundFloatsInString(s, query.roundFloatsInStringsSigFigs)
40784081
}
4082+
if colT == 'T' {
4083+
// Remove the rangeID prefix from 'sending batch ...'
4084+
// message in the trace to reduce test churn when
4085+
// adding new system tables.
4086+
//
4087+
// Also replace tableIDs with a constant in messages like
4088+
// '<before:/Table/77>' and '<after:/Table/107/1>'.
4089+
if matches := sendingBatchRE.FindStringSubmatch(s); len(matches) > 1 {
4090+
s = matches[1]
4091+
} else if matches = beforeTableRE.FindStringSubmatch(s); len(matches) > 2 {
4092+
s = matches[1] + "XX" + matches[2]
4093+
} else if matches = afterTableRE.FindStringSubmatch(s); len(matches) > 2 {
4094+
s = matches[1] + "XX" + matches[2]
4095+
}
4096+
}
40794097
// Replace any \n character with an escaped new line. This will ensure that
40804098
// tests pass and the output remains relatively well formatted. This will
40814099
// happen unless:

pkg/sql/logictest/testdata/logic_test/cluster_locks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ query TTTI colnames,rowsort
3030
SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t WITH DETAILS]
3131
----
3232
start_key end_key replicas lease_holder
33-
<before:/Table/76> …/1/"d" {1} 1
33+
<before:/Table/XX> …/1/"d" {1} 1
3434
…/1/"d" …/1/"r" {1} 1
3535
…/1/"r" <after:/Max> {1} 1
3636

pkg/sql/logictest/testdata/logic_test/cluster_locks_write_buffering

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ query TTTI colnames,rowsort
3333
SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t WITH DETAILS]
3434
----
3535
start_key end_key replicas lease_holder
36-
<before:/Table/76> …/1/"d" {1} 1
36+
<before:/Table/XX> …/1/"d" {1} 1
3737
…/1/"d" …/1/"r" {1} 1
3838
…/1/"r" <after:/Max> {1} 1
3939

pkg/sql/logictest/testdata/logic_test/dist_vectorize

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ query TTTI rowsort
3232
SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv WITH DETAILS]
3333
ORDER by 1
3434
----
35-
<before:/Table/76> …/1/1 {1} 1
36-
…/1/1 …/1/2 {1} 1
37-
…/1/2 …/1/3 {2} 2
38-
…/1/3 …/1/4 {3} 3
39-
…/1/4 …/1/5 {4} 4
40-
…/1/5 <after:/Table/107/1/1> {5} 5
35+
<before:/Table/XX> …/1/1 {1} 1
36+
…/1/1 …/1/2 {1} 1
37+
…/1/2 …/1/3 {2} 2
38+
…/1/3 …/1/4 {3} 3
39+
…/1/4 …/1/5 {4} 4
40+
…/1/5 <after:/Table/XX/1/1> {5} 5
4141

4242
# Verify data placement.
4343
query TTTI rowsort

pkg/sql/logictest/testdata/logic_test/distsql_agg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d
2727
ORDER BY 1
2828
----
2929
start_key end_key replicas lease_holder
30-
<before:/Table/76> …/1/1 {1} 1
30+
<before:/Table/XX> …/1/1 {1} 1
3131
…/1/1 …/1/2 {2} 2
3232
…/1/2 …/1/3 {3} 3
3333
…/1/3 …/1/4 {4} 4
@@ -329,10 +329,10 @@ INSERT INTO two VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (
329329
query TTTI colnames,rowsort
330330
SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE one WITH DETAILS]
331331
----
332-
start_key end_key replicas lease_holder
333-
<before:/Table/106/1/9> …/1/0 {5} 5
334-
…/1/0 …/1/99 {1} 1
335-
…/1/99 <after:/Table/108/1/0> {5} 5
332+
start_key end_key replicas lease_holder
333+
<before:/Table/106/1/9> …/1/0 {5} 5
334+
…/1/0 …/1/99 {1} 1
335+
…/1/99 <after:/Table/XX/1/0> {5} 5
336336

337337
query TTTI colnames,rowsort
338338
SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE two WITH DETAILS]

pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE d
2727
ORDER BY 1
2828
----
2929
start_key end_key replicas lease_holder
30-
<before:/Table/76> …/1/1 {1} 1
30+
<before:/Table/XX> …/1/1 {1} 1
3131
…/1/1 …/1/2 {2} 2
3232
…/1/2 …/1/3 {3} 3
3333
…/1/3 …/1/4 {4} 4

0 commit comments

Comments
 (0)