Skip to content

Commit

Permalink
executor: accelerate TestUpdateScanningHandles and TestIssue20658 and…
Browse files Browse the repository at this point in the history
… TestParallelStreamAggGroupConcat (#24132) (#24145)
  • Loading branch information
ti-srebot authored Apr 20, 2021
1 parent 653b6ee commit 41871e0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
24 changes: 20 additions & 4 deletions executor/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,18 @@ func (s *testSuiteAgg) TestParallelStreamAggGroupConcat(c *C) {
tk.MustExec("use test;")
tk.MustExec("drop table if exists t;")
tk.MustExec("CREATE TABLE t(a bigint, b bigint);")
tk.MustExec("set tidb_init_chunk_size=1;")
tk.MustExec("set tidb_max_chunk_size=32;")

for i := 0; i < 10000; i++ {
tk.MustExec("insert into t values(?, ?);", rand.Intn(100), rand.Intn(100))
var insertSQL string
for i := 0; i < 1000; i++ {
if i == 0 {
insertSQL += fmt.Sprintf("(%d, %d)", rand.Intn(100), rand.Intn(100))
} else {
insertSQL += fmt.Sprintf(",(%d, %d)", rand.Intn(100), rand.Intn(100))
}
}
tk.MustExec(fmt.Sprintf("insert into t values %s;", insertSQL))

sql := "select /*+ stream_agg() */ group_concat(a, b) from t group by b;"
concurrencies := []int{1, 2, 4, 8}
Expand Down Expand Up @@ -1283,9 +1291,17 @@ func (s *testSuiteAgg) TestIssue20658(c *C) {

tk.MustExec("drop table if exists t;")
tk.MustExec("CREATE TABLE t(a bigint, b bigint);")
for i := 0; i < 10000; i++ {
tk.MustExec("insert into t values (?, ?);", rand.Intn(100), rand.Intn(100))
tk.MustExec("set tidb_init_chunk_size=1;")
tk.MustExec("set tidb_max_chunk_size=32;")
var insertSQL string
for i := 0; i < 1000; i++ {
if i == 0 {
insertSQL += fmt.Sprintf("(%d, %d)", rand.Intn(100), rand.Intn(100))
} else {
insertSQL += fmt.Sprintf(",(%d, %d)", rand.Intn(100), rand.Intn(100))
}
}
tk.MustExec(fmt.Sprintf("insert into t values %s;", insertSQL))

concurrencies := []int{1, 2, 4, 8}
for _, sql := range sqls {
Expand Down
12 changes: 10 additions & 2 deletions executor/union_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package executor_test

import (
"fmt"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/util/testkit"
)
Expand Down Expand Up @@ -339,9 +341,15 @@ func (s *testSuite7) TestUpdateScanningHandles(c *C) {
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t(a int primary key, b int);")
tk.MustExec("begin")
for i := 2; i < 100000; i++ {
tk.MustExec("insert into t values (?, ?)", i, i)
var insertSQL string
for i := 2; i < 10000; i++ {
if i == 2 {
insertSQL += fmt.Sprintf("(%d, %d)", i, i)
} else {
insertSQL += fmt.Sprintf(",(%d, %d)", i, i)
}
}
tk.MustExec(fmt.Sprintf("insert into t values %s;", insertSQL))
tk.MustExec("commit;")

tk.MustExec("set tidb_distsql_scan_concurrency = 1;")
Expand Down

0 comments on commit 41871e0

Please sign in to comment.