From 54f15a4a225daaec97185c4b607598f3af6f5b69 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 29 Aug 2023 04:20:07 +0200 Subject: [PATCH] test: less extensive reorganize partition tests (#46459) close pingcap/tidb#46260, close pingcap/tidb#46262, close pingcap/tidb#46263 --- table/tables/test/partition/partition_test.go | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/table/tables/test/partition/partition_test.go b/table/tables/test/partition/partition_test.go index 7a266cd637c94..2f218db23587a 100644 --- a/table/tables/test/partition/partition_test.go +++ b/table/tables/test/partition/partition_test.go @@ -2572,11 +2572,8 @@ func (c *testCallback) OnJobRunBefore(job *model.Job) { } } -// TODO: do extensive test for LIST [COLUMNS] -// TODO: Either skip this, move it to a separate directory for big tests -// or see if there are ways to speed this up :) -// Leaving the test here, for reference and completeness testing func TestPartitionByIntListExtensivePart(t *testing.T) { + limitSizeOfTest := true store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) schemaName := "PartitionByIntListExtensive" @@ -2589,7 +2586,7 @@ func TestPartitionByIntListExtensivePart(t *testing.T) { t2Str := `create table t2 ` + tBase tStr := `create table t ` + tBase - rows := 1000 + rows := 100 pkInserts := 20 pkUpdates := 20 pkDeletes := 10 // Enough to delete half of what is inserted? @@ -2605,6 +2602,9 @@ func TestPartitionByIntListExtensivePart(t *testing.T) { // HASH with function tStr + ` partition by hash(a DIV 3) partitions 5`, } + if limitSizeOfTest { + tStart = tStart[:2] + } quarterUintRange := 1 << 30 quarterUintRangeStr := fmt.Sprintf("%d", quarterUintRange) halfUintRangeStr := fmt.Sprintf("%d", 2*quarterUintRange) @@ -2633,6 +2633,9 @@ func TestPartitionByIntListExtensivePart(t *testing.T) { `alter table t partition by hash(a DIV 13) partitions 7`, `alter table t partition by hash(a DIV 13) partitions 3`, } + if limitSizeOfTest { + tAlter = tAlter[:2] + } seed := gotime.Now().UnixNano() logutil.BgLogger().Info("Seeding rand", zap.Int64("seed", seed)) @@ -2683,10 +2686,8 @@ func getInt7ValuesFunc() func(string, bool, *rand.Rand) string { } } -// TODO: Either skip this, move it to a separate directory for big tests -// or see if there are ways to speed this up :) -// Leaving the test here, for reference and completeness testing func TestPartitionByIntExtensivePart(t *testing.T) { + limitSizeOfTest := true store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) schemaName := "PartitionByIntExtensive" @@ -2699,7 +2700,7 @@ func TestPartitionByIntExtensivePart(t *testing.T) { t2Str := `create table t2 ` + tBase tStr := `create table t ` + tBase - rows := 1000 + rows := 100 pkInserts := 20 pkUpdates := 20 pkDeletes := 10 // Enough to delete half of what is inserted? @@ -2719,6 +2720,9 @@ func TestPartitionByIntExtensivePart(t *testing.T) { // HASH with function tStr + ` partition by hash(a DIV 3) partitions 5`, } + if limitSizeOfTest { + tStart = tStart[:2] + } quarterUintRange := 1 << 30 quarterUintRangeStr := fmt.Sprintf("%d", quarterUintRange) halfUintRangeStr := fmt.Sprintf("%d", 2*quarterUintRange) @@ -2741,6 +2745,9 @@ func TestPartitionByIntExtensivePart(t *testing.T) { `alter table t partition by hash(a DIV 13) partitions 7`, `alter table t partition by hash(a DIV 13) partitions 3`, } + if limitSizeOfTest { + tAlter = tAlter[:2] + } seed := gotime.Now().UnixNano() logutil.BgLogger().Info("Seeding rand", zap.Int64("seed", seed)) @@ -2813,10 +2820,8 @@ func TestRangePartitionByRange(t *testing.T) { tk.MustQuery(`select * from t`).Sort().Check(testkit.Rows("-1", "0", "1")) } -// TODO: Either skip this, move it to a separate directory for big tests -// or see if there are ways to speed this up :) -// Leaving the test here, for reference and completeness testing func TestPartitionByExtensivePart(t *testing.T) { + limitSizeOfTest := true store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) schemaName := "PartitionByExtensive" @@ -2829,7 +2834,7 @@ func TestPartitionByExtensivePart(t *testing.T) { t2Str := `create table t2 ` + tBase tStr := `create table t ` + tBase - rows := 1000 + rows := 100 pkInserts := 20 pkUpdates := 20 pkDeletes := 10 // Enough to delete half of what is inserted? @@ -2841,6 +2846,9 @@ func TestPartitionByExtensivePart(t *testing.T) { // KEY tStr + ` partition by key(a) partitions 5`, } + if limitSizeOfTest { + tStart = tStart[:2] + } showCreateStr := "t CREATE TABLE `t` (\n" + " `a` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,\n" + " `b` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,\n" + @@ -2886,6 +2894,9 @@ func TestPartitionByExtensivePart(t *testing.T) { "PARTITION BY KEY (`a`) PARTITIONS 3", }, } + if limitSizeOfTest { + tAlter = tAlter[:2] + } seed := gotime.Now().UnixNano() logutil.BgLogger().Info("Seeding rand", zap.Int64("seed", seed)) @@ -2976,7 +2987,7 @@ func TestReorgPartExtensivePart(t *testing.T) { " KEY `e` (`e`)\n" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin")) - rows := 10000 + rows := 1000 pkInserts := 200 pkUpdates := 200 pkDeletes := 100 // Enough to delete half of what is inserted?