From 195d9dda169f98bee94ef377cb39e4c02ee19ab8 Mon Sep 17 00:00:00 2001 From: Evan Wall Date: Mon, 18 Sep 2023 15:40:30 +0000 Subject: [PATCH 1/2] Revert "testing: add table id placeholder in multi-node SQLTranslator tests" This reverts commit 9bfb5dac9c6c0b9066fd9d8bb20e3505bdfd92d2. Release note: None --- .../datadriven_test.go | 44 +------------------ .../testdata/3node/partition/all_indexes | 8 ++-- .../3node/partition/all_indexes_shuffled | 8 ++-- .../3node/partition/list_list_partitioning | 22 +++++----- .../3node/partition/list_range_partitioning | 18 ++++---- .../partition/multi_col_list_partitioning | 12 ++--- .../multi_col_list_partitioning_default | 16 +++---- ...ulti_col_list_partitioning_default_default | 20 ++++----- ...artitioning_default_default_subpartitioned | 20 ++++----- .../partition/multi_col_range_partitioning | 10 ++--- .../multi_col_range_partitioning_descending | 10 ++--- .../multi_col_range_partitioning_maxvalue | 12 ++--- ...i_col_range_partitioning_maxvalue_maxvalue | 14 +++--- .../multi_col_range_partitioning_sparse | 10 ++--- .../testdata/3node/partition/scans | 14 +++--- .../secondary_index_list_partitioning | 12 ++--- .../secondary_index_list_partitioning_default | 12 ++--- .../3node/partition/secondary_index_null | 18 ++++---- .../partition/secondary_index_unpartitioned | 2 +- .../partition/single_col_list_partitioning | 8 ++-- .../single_col_list_partitioning_default | 12 ++--- .../partition/single_col_range_partitioning | 8 ++-- .../single_col_range_partitioning_maxvalue | 10 ++--- .../single_col_range_partitioning_sparse | 10 ++--- .../testdata/3node/partition/some_indexes | 6 +-- .../testdata/3node/partition/unpartitioned | 2 +- 26 files changed, 149 insertions(+), 189 deletions(-) diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go index 5f45b025267f..00aac6223a40 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go @@ -12,9 +12,7 @@ import ( "context" "fmt" "path/filepath" - "regexp" "sort" - "strconv" "strings" "sync" "testing" @@ -44,8 +42,6 @@ import ( "github.com/stretchr/testify/require" ) -var tableIDPrefixRegexp = regexp.MustCompile("(/Table/)([0-9]+)(.*)") - // TestDataDriven is a data-driven test for the spanconfig.SQLTranslator. It // allows users to set up zone config hierarchies and validate their translation // to SpanConfigs is as expected. Only fields that are different from the @@ -129,10 +125,9 @@ func TestDataDriven(t *testing.T) { }, } } - isMultiNode := strings.Contains(path, "3node") // Use 1 node by default to make tests run faster. nodes := 1 - if isMultiNode { + if strings.Contains(path, "3node") { nodes = 3 } tc := testcluster.StartTestCluster(t, nodes, base.TestClusterArgs{ @@ -222,42 +217,7 @@ func TestDataDriven(t *testing.T) { for _, record := range records { switch { case record.GetTarget().IsSpanTarget(): - var translateOutputFmt, spanStr string - // The span's table ID may change in multi-node tests. Replace the - // table ID with or to make output - // deterministic. - if isMultiNode { - translateOutputFmt = "%-54s %s\n" - span := record.GetTarget().GetSpan() - parseKey := func(key roachpb.Key) (prefix string, tableID int, suffix string) { - keyStr := key.String() - matches := tableIDPrefixRegexp.FindStringSubmatch(keyStr) - require.Lenf(t, matches, 4, keyStr) - prefix = matches[1] - var err error - tableID, err = strconv.Atoi(matches[2]) - require.NoErrorf(t, err, keyStr) - suffix = matches[3] - return - } - startPrefix, startTableID, startSuffix := parseKey(span.Key) - var tableIDPlaceholder = "" - startKeyStr := fmt.Sprintf("%s%s%s", startPrefix, tableIDPlaceholder, startSuffix) - endPrefix, endTableID, endSuffix := parseKey(span.EndKey) - switch endTableID { - case startTableID: - case startTableID + 1: - tableIDPlaceholder = "" - default: - t.Fatalf("invalid table IDs startTableID=%d endTableID=%d", startTableID, endTableID) - } - endKeyStr := fmt.Sprintf("%s%s%s", endPrefix, tableIDPlaceholder, endSuffix) - spanStr = fmt.Sprintf("[%s, %s)", startKeyStr, endKeyStr) - } else { - translateOutputFmt = "%-42s %s\n" - spanStr = record.GetTarget().GetSpan().String() - } - output.WriteString(fmt.Sprintf(translateOutputFmt, spanStr, + output.WriteString(fmt.Sprintf("%-42s %s\n", record.GetTarget().GetSpan(), spanconfigtestutils.PrintSpanConfigDiffedAgainstDefaults(record.GetConfig()))) case record.GetTarget().IsSystemTarget(): output.WriteString(fmt.Sprintf("%-42s %s\n", record.GetTarget().GetSystemTarget(), diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes index f3a9bb87d3a5..3bd9c7b9d1ca 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes @@ -8,7 +8,7 @@ ALTER INDEX db.tbl@idx2 CONFIGURE ZONE USING constraints = '[+n3]'; translate database=db table=tbl ---- -[/Table/, /Table//2) range default -[/Table//2, /Table//3) constraints=[+n2] -[/Table//3, /Table//4) constraints=[+n3] -[/Table//4, /Table/) range default +/Table/106{-/2} range default +/Table/106/{2-3} constraints=[+n2] +/Table/106/{3-4} constraints=[+n3] +/Table/10{6/4-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes_shuffled b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes_shuffled index 1e6dc93804c7..fed1ed9211db 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes_shuffled +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/all_indexes_shuffled @@ -8,7 +8,7 @@ ALTER INDEX db.tbl@idx1 CONFIGURE ZONE USING constraints = '[+n3]'; translate database=db table=tbl ---- -[/Table/, /Table//2) range default -[/Table//2, /Table//3) constraints=[+n3] -[/Table//3, /Table//4) constraints=[+n2] -[/Table//4, /Table/) range default +/Table/106{-/2} range default +/Table/106/{2-3} constraints=[+n3] +/Table/106/{3-4} constraints=[+n2] +/Table/10{6/4-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_list_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_list_partitioning index c3da55878b32..c3fe647b937b 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_list_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_list_partitioning @@ -22,14 +22,14 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3) constraints=[+n1] -[/Table//1/3, /Table//1/3/4) constraints=[+n2] -[/Table//1/3/4, /Table//1/3/5) constraints=[+n3] -[/Table//1/3/5, /Table//1/4) constraints=[+n2] -[/Table//1/4, /Table//1/5) constraints=[+n1] -[/Table//1/5, /Table//1/5/6) constraints=[+n3] -[/Table//1/5/6, /Table//1/5/7) constraints=[+n2] -[/Table//1/5/7, /Table//1/6) constraints=[+n3] -[/Table//1/6, /Table//2) constraints=[+n1] -[/Table//2, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3} constraints=[+n1] +/Table/106/1/3{-/4} constraints=[+n2] +/Table/106/1/3/{4-5} constraints=[+n3] +/Table/106/1/{3/5-4} constraints=[+n2] +/Table/106/1/{4-5} constraints=[+n1] +/Table/106/1/5{-/6} constraints=[+n3] +/Table/106/1/5/{6-7} constraints=[+n2] +/Table/106/1/{5/7-6} constraints=[+n3] +/Table/106/{1/6-2} constraints=[+n1] +/Table/10{6/2-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_range_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_range_partitioning index 8c4b5f4539f4..8b30b9c49714 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_range_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/list_range_partitioning @@ -22,12 +22,12 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3) constraints=[+n1] -[/Table//1/3, /Table//1/3/4) constraints=[+n3] -[/Table//1/3/4, /Table//1/4) constraints=[+n2] -[/Table//1/4, /Table//1/5) constraints=[+n1] -[/Table//1/5, /Table//1/5/6) constraints=[+n2] -[/Table//1/5/6, /Table//1/6) constraints=[+n3] -[/Table//1/6, /Table//2) constraints=[+n1] -[/Table//2, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3} constraints=[+n1] +/Table/106/1/3{-/4} constraints=[+n3] +/Table/106/1/{3/4-4} constraints=[+n2] +/Table/106/1/{4-5} constraints=[+n1] +/Table/106/1/5{-/6} constraints=[+n2] +/Table/106/1/{5/6-6} constraints=[+n3] +/Table/106/{1/6-2} constraints=[+n1] +/Table/10{6/2-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning index d4cdd9469a8d..7c06320ee98b 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning @@ -14,9 +14,9 @@ ALTER PARTITION p57 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1/3/4) constraints=[+n1] -[/Table//1/3/4, /Table//1/3/5) constraints=[+n2] -[/Table//1/3/5, /Table//1/5/6) constraints=[+n1] -[/Table//1/5/6, /Table//1/5/7) constraints=[+n3] -[/Table//1/5/7, /Table//1/5/8) constraints=[+n1] -[/Table//1/5/8, /Table/) constraints=[+n1] +/Table/106{-/1/3/4} constraints=[+n1] +/Table/106/1/3/{4-5} constraints=[+n2] +/Table/106/1/{3/5-5/6} constraints=[+n1] +/Table/106/1/5/{6-7} constraints=[+n3] +/Table/106/1/5/{7-8} constraints=[+n1] +/Table/10{6/1/5/8-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default index 8ffb41271ab1..2910ff6fe2f1 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default @@ -16,11 +16,11 @@ ALTER PARTITION p5d OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1/3/4) constraints=[+n1] -[/Table//1/3/4, /Table//1/3/5) constraints=[+n2] -[/Table//1/3/5, /Table//1/5) constraints=[+n1] -[/Table//1/5, /Table//1/5/7) constraints=[+n2] -[/Table//1/5/7, /Table//1/5/8) constraints=[+n3] -[/Table//1/5/8, /Table//1/5/9) constraints=[+n1] -[/Table//1/5/9, /Table//1/6) constraints=[+n2] -[/Table//1/6, /Table/) constraints=[+n1] +/Table/106{-/1/3/4} constraints=[+n1] +/Table/106/1/3/{4-5} constraints=[+n2] +/Table/106/1/{3/5-5} constraints=[+n1] +/Table/106/1/5{-/7} constraints=[+n2] +/Table/106/1/5/{7-8} constraints=[+n3] +/Table/106/1/5/{8-9} constraints=[+n1] +/Table/106/1/{5/9-6} constraints=[+n2] +/Table/10{6/1/6-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default index 3fae371621da..17bdd5c3ad8c 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default @@ -18,13 +18,13 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/3/4) constraints=[+n2] -[/Table//1/3/4, /Table//1/3/5) constraints=[+n1] -[/Table//1/3/5, /Table//1/5) constraints=[+n2] -[/Table//1/5, /Table//1/5/7) constraints=[+n1] -[/Table//1/5/7, /Table//1/5/8) constraints=[+n2] -[/Table//1/5/8, /Table//1/5/9) constraints=[+n3] -[/Table//1/5/9, /Table//1/6) constraints=[+n1] -[/Table//1/6, /Table//2) constraints=[+n2] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/3/4} constraints=[+n2] +/Table/106/1/3/{4-5} constraints=[+n1] +/Table/106/1/{3/5-5} constraints=[+n2] +/Table/106/1/5{-/7} constraints=[+n1] +/Table/106/1/5/{7-8} constraints=[+n2] +/Table/106/1/5/{8-9} constraints=[+n3] +/Table/106/1/{5/9-6} constraints=[+n1] +/Table/106/{1/6-2} constraints=[+n2] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default_subpartitioned b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default_subpartitioned index 7d01138da9f3..bdb524f2afcc 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default_subpartitioned +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_list_partitioning_default_default_subpartitioned @@ -22,13 +22,13 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/3/4) constraints=[+n2] -[/Table//1/3/4, /Table//1/3/5) constraints=[+n1] -[/Table//1/3/5, /Table//1/5) constraints=[+n2] -[/Table//1/5, /Table//1/5/7) constraints=[+n1] -[/Table//1/5/7, /Table//1/5/8) constraints=[+n2] -[/Table//1/5/8, /Table//1/5/9) constraints=[+n3] -[/Table//1/5/9, /Table//1/6) constraints=[+n1] -[/Table//1/6, /Table//2) constraints=[+n2] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/3/4} constraints=[+n2] +/Table/106/1/3/{4-5} constraints=[+n1] +/Table/106/1/{3/5-5} constraints=[+n2] +/Table/106/1/5{-/7} constraints=[+n1] +/Table/106/1/5/{7-8} constraints=[+n2] +/Table/106/1/5/{8-9} constraints=[+n3] +/Table/106/1/{5/9-6} constraints=[+n1] +/Table/106/{1/6-2} constraints=[+n2] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning index 3fe3ecc3b3aa..ebad3302469b 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning @@ -14,8 +14,8 @@ ALTER PARTITION p57 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3/4) constraints=[+n2] -[/Table//1/3/4, /Table//1/5/6) constraints=[+n3] -[/Table//1/5/6, /Table//1/5/7) constraints=[+n1] -[/Table//1/5/7, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3/4} constraints=[+n2] +/Table/106/1/{3/4-5/6} constraints=[+n3] +/Table/106/1/5/{6-7} constraints=[+n1] +/Table/10{6/1/5/7-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_descending b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_descending index 6592df561548..10df0e766fba 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_descending +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_descending @@ -14,8 +14,8 @@ ALTER PARTITION pxxx OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/7) constraints=[+n1] -[/Table//1/7, /Table//1/7/-6) constraints=[+n2] -[/Table//1/7/-6, /Table//2) constraints=[+n3] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/7} constraints=[+n1] +/Table/106/1/7{-/-6} constraints=[+n2] +/Table/106/{1/7/-6-2} constraints=[+n3] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue index f30f3e8d9c9d..7149d7f5a8a4 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue @@ -16,9 +16,9 @@ ALTER PARTITION p57 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3) constraints=[+n2] -[/Table//1/3, /Table//1/4) constraints=[+n3] -[/Table//1/4, /Table//1/5/6) constraints=[+n1] -[/Table//1/5/6, /Table//1/5/7) constraints=[+n2] -[/Table//1/5/7, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3} constraints=[+n2] +/Table/106/1/{3-4} constraints=[+n3] +/Table/106/1/{4-5/6} constraints=[+n1] +/Table/106/1/5/{6-7} constraints=[+n2] +/Table/10{6/1/5/7-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue_maxvalue b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue_maxvalue index ca18394c6a4b..5825917d7b2f 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue_maxvalue +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_maxvalue_maxvalue @@ -18,10 +18,10 @@ ALTER PARTITION pxx OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/3/4) constraints=[+n1] -[/Table//1/3/4, /Table//1/4) constraints=[+n2] -[/Table//1/4, /Table//1/5/6) constraints=[+n3] -[/Table//1/5/6, /Table//1/5/7) constraints=[+n1] -[/Table//1/5/7, /Table//2) constraints=[+n2] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/3/4} constraints=[+n1] +/Table/106/1/{3/4-4} constraints=[+n2] +/Table/106/1/{4-5/6} constraints=[+n3] +/Table/106/1/5/{6-7} constraints=[+n1] +/Table/106/{1/5/7-2} constraints=[+n2] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_sparse b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_sparse index 270b05d302c7..97f5a4d4c6c9 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_sparse +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/multi_col_range_partitioning_sparse @@ -12,8 +12,8 @@ ALTER PARTITION p78 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = translate database=db table=tbl ---- -[/Table/, /Table//1/1/2) constraints=[+n1] -[/Table//1/1/2, /Table//1/3/4) constraints=[+n2] -[/Table//1/3/4, /Table//1/5/6) constraints=[+n1] -[/Table//1/5/6, /Table//1/7/8) constraints=[+n3] -[/Table//1/7/8, /Table/) constraints=[+n1] +/Table/106{-/1/1/2} constraints=[+n1] +/Table/106/1/{1/2-3/4} constraints=[+n2] +/Table/106/1/{3/4-5/6} constraints=[+n1] +/Table/106/1/{5/6-7/8} constraints=[+n3] +/Table/10{6/1/7/8-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/scans b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/scans index 4c4464f8b508..44b4a5609afc 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/scans +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/scans @@ -14,10 +14,10 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3) constraints=[+n1] -[/Table//1/3, /Table//1/4) constraints=[+n2] -[/Table//1/4, /Table//1/5) constraints=[+n3] -[/Table//1/5, /Table//1/6) constraints=[+n2] -[/Table//1/6, /Table//2) constraints=[+n1] -[/Table//2, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3} constraints=[+n1] +/Table/106/1/{3-4} constraints=[+n2] +/Table/106/1/{4-5} constraints=[+n3] +/Table/106/1/{5-6} constraints=[+n2] +/Table/106/{1/6-2} constraints=[+n1] +/Table/10{6/2-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning index 62b904bbd84e..8d419d6d2f4b 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning @@ -12,9 +12,9 @@ ALTER PARTITION p4 OF INDEX db.tbl@b_idx CONFIGURE ZONE USING constraints = '[+n translate database=db table=tbl ---- -[/Table/, /Table//2) range default -[/Table//2, /Table//2/3) constraints=[+n2] -[/Table//2/3, /Table//2/4) constraints=[+n2] -[/Table//2/4, /Table//2/5) constraints=[+n3] -[/Table//2/5, /Table//3) constraints=[+n2] -[/Table//3, /Table/) range default +/Table/106{-/2} range default +/Table/106/2{-/3} constraints=[+n2] +/Table/106/2/{3-4} constraints=[+n2] +/Table/106/2/{4-5} constraints=[+n3] +/Table/106/{2/5-3} constraints=[+n2] +/Table/10{6/3-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning_default b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning_default index 0b8107a03878..ad82df6a8fbd 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning_default +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_list_partitioning_default @@ -14,9 +14,9 @@ ALTER PARTITION pd OF INDEX db.tbl@b_idx CONFIGURE ZONE USING constraints = '[+n translate database=db table=tbl ---- -[/Table/, /Table//2) range default -[/Table//2, /Table//2/4) constraints=[+n1] -[/Table//2/4, /Table//2/5) constraints=[+n2] -[/Table//2/5, /Table//2/6) constraints=[+n3] -[/Table//2/6, /Table//3) constraints=[+n1] -[/Table//3, /Table/) range default +/Table/106{-/2} range default +/Table/106/2{-/4} constraints=[+n1] +/Table/106/2/{4-5} constraints=[+n2] +/Table/106/2/{5-6} constraints=[+n3] +/Table/106/{2/6-3} constraints=[+n1] +/Table/10{6/3-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_null b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_null index 96ea3c5d1b2b..2a60adbfd1da 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_null +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_null @@ -12,12 +12,12 @@ ALTER PARTITION p3 OF INDEX db.tbl@b_idx CONFIGURE ZONE USING constraints = '[+n translate database=db table=tbl ---- -[/Table/, /Table//2) range default -[/Table//2, /Table//2/NULL) constraints=[+n1] -[/Table//2/NULL, /Table//2/!NULL) constraints=[+n2] -[/Table//2/!NULL, /Table//2/1) constraints=[+n1] -[/Table//2/1, /Table//2/2) constraints=[+n2] -[/Table//2/2, /Table//2/3) constraints=[+n1] -[/Table//2/3, /Table//2/4) constraints=[+n3] -[/Table//2/4, /Table//3) constraints=[+n1] -[/Table//3, /Table/) range default +/Table/106{-/2} range default +/Table/106/2{-/NULL} constraints=[+n1] +/Table/106/2/{NULL-!NULL} constraints=[+n2] +/Table/106/2/{!NULL-1} constraints=[+n1] +/Table/106/2/{1-2} constraints=[+n2] +/Table/106/2/{2-3} constraints=[+n1] +/Table/106/2/{3-4} constraints=[+n3] +/Table/106/{2/4-3} constraints=[+n1] +/Table/10{6/3-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_unpartitioned b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_unpartitioned index bbf4cb1c00c1..e2722fc2197f 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_unpartitioned +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/secondary_index_unpartitioned @@ -7,4 +7,4 @@ ALTER INDEX db.tbl@b_idx CONFIGURE ZONE DISCARD; translate database=db table=tbl ---- -[/Table/, /Table/) range default +/Table/10{6-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning index 442b2d4129e4..40673102b9a5 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning @@ -12,7 +12,7 @@ ALTER PARTITION p4 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1/3) range default -[/Table//1/3, /Table//1/4) constraints=[+n2] -[/Table//1/4, /Table//1/5) constraints=[+n3] -[/Table//1/5, /Table/) range default +/Table/106{-/1/3} range default +/Table/106/1/{3-4} constraints=[+n2] +/Table/106/1/{4-5} constraints=[+n3] +/Table/10{6/1/5-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning_default b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning_default index e2e9aa481880..02964ecb3d04 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning_default +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_list_partitioning_default @@ -14,9 +14,9 @@ ALTER PARTITION pd OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/4) constraints=[+n1] -[/Table//1/4, /Table//1/5) constraints=[+n2] -[/Table//1/5, /Table//1/6) constraints=[+n3] -[/Table//1/6, /Table//2) constraints=[+n1] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/4} constraints=[+n1] +/Table/106/1/{4-5} constraints=[+n2] +/Table/106/1/{5-6} constraints=[+n3] +/Table/106/{1/6-2} constraints=[+n1] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning index b590719774a1..8f4880085b90 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning @@ -12,7 +12,7 @@ ALTER PARTITION p4 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) constraints=[+n1] -[/Table//1, /Table//1/3) constraints=[+n2] -[/Table//1/3, /Table//1/4) constraints=[+n3] -[/Table//1/4, /Table/) constraints=[+n1] +/Table/106{-/1} constraints=[+n1] +/Table/106/1{-/3} constraints=[+n2] +/Table/106/1/{3-4} constraints=[+n3] +/Table/10{6/1/4-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_maxvalue b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_maxvalue index d87b35d59abf..6d1866cdfbcd 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_maxvalue +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_maxvalue @@ -14,8 +14,8 @@ ALTER PARTITION px OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1) range default -[/Table//1, /Table//1/4) constraints=[+n1] -[/Table//1/4, /Table//1/5) constraints=[+n2] -[/Table//1/5, /Table//2) constraints=[+n3] -[/Table//2, /Table/) range default +/Table/106{-/1} range default +/Table/106/1{-/4} constraints=[+n1] +/Table/106/1/{4-5} constraints=[+n2] +/Table/106/{1/5-2} constraints=[+n3] +/Table/10{6/2-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_sparse b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_sparse index ad76e19b216f..03422cb57c2b 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_sparse +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/single_col_range_partitioning_sparse @@ -12,8 +12,8 @@ ALTER PARTITION p3 OF INDEX db.tbl@tbl_pkey CONFIGURE ZONE USING constraints = ' translate database=db table=tbl ---- -[/Table/, /Table//1/1) constraints=[+n1] -[/Table//1/1, /Table//1/2) constraints=[+n2] -[/Table//1/2, /Table//1/3) constraints=[+n1] -[/Table//1/3, /Table//1/4) constraints=[+n3] -[/Table//1/4, /Table/) constraints=[+n1] +/Table/106{-/1/1} constraints=[+n1] +/Table/106/1/{1-2} constraints=[+n2] +/Table/106/1/{2-3} constraints=[+n1] +/Table/106/1/{3-4} constraints=[+n3] +/Table/10{6/1/4-7} constraints=[+n1] diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/some_indexes b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/some_indexes index f9a9430deb1b..5858d5cd9461 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/some_indexes +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/some_indexes @@ -7,6 +7,6 @@ ALTER INDEX db.tbl@idx2 CONFIGURE ZONE USING constraints = '[+n2]'; translate database=db table=tbl ---- -[/Table/, /Table//3) range default -[/Table//3, /Table//4) constraints=[+n2] -[/Table//4, /Table/) range default +/Table/106{-/3} range default +/Table/106/{3-4} constraints=[+n2] +/Table/10{6/4-7} range default diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/unpartitioned b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/unpartitioned index 366db39d5ded..deba40ee04ed 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/unpartitioned +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/testdata/3node/partition/unpartitioned @@ -7,4 +7,4 @@ ALTER TABLE db.tbl CONFIGURE ZONE DISCARD; translate database=db table=tbl ---- -[/Table/, /Table/) range default +/Table/10{6-7} range default From f58037c81122253fbacd96a93827bef48f40f51c Mon Sep 17 00:00:00 2001 From: Evan Wall Date: Mon, 18 Sep 2023 15:47:53 +0000 Subject: [PATCH 2/2] testing: set UseTransactionalDescIDGenerator testing knob in SQLTranslator tests Fixes #110242 Set UseTransactionalDescIDGenerator to true to prevent transaction retries from resulting in different descriptor IDs. Descriptor IDs appear directly in the test output and must remain stable. Release note: None --- .../spanconfigsqltranslatorccl/datadriven_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go index 00aac6223a40..f6e582269f15 100644 --- a/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go +++ b/pkg/ccl/spanconfigccl/spanconfigsqltranslatorccl/datadriven_test.go @@ -111,14 +111,18 @@ func TestDataDriven(t *testing.T) { // test cluster). ManagerDisableJobCreation: true, } + sqlExecutorKnobs := &sql.ExecutorTestingKnobs{ + UseTransactionalDescIDGenerator: true, + } tsArgs := func(attr string) base.TestServerArgs { return base.TestServerArgs{ // Test fails when run within a tenant. More investigation // is required. Tracked with #76378. DisableDefaultTestTenant: true, Knobs: base.TestingKnobs{ - GCJob: gcTestingKnobs, - SpanConfig: scKnobs, + GCJob: gcTestingKnobs, + SpanConfig: scKnobs, + SQLExecutor: sqlExecutorKnobs, }, StoreSpecs: []base.StoreSpec{ {InMemory: true, Attributes: roachpb.Attributes{Attrs: []string{attr}}},