Skip to content

Commit

Permalink
test: less extensive reorganize partition tests (#46459)
Browse files Browse the repository at this point in the history
close #46260, close #46262, close #46263
  • Loading branch information
mjonss authored Aug 29, 2023
1 parent 4f7bf3b commit 54f15a4
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions table/tables/test/partition/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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?
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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"
Expand All @@ -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?
Expand All @@ -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)
Expand All @@ -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))
Expand Down Expand Up @@ -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"
Expand All @@ -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?
Expand All @@ -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" +
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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?
Expand Down

0 comments on commit 54f15a4

Please sign in to comment.