Skip to content

Commit

Permalink
feat(failpoint): control chunk size
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <eke@fastmail.com>
  • Loading branch information
ekexium committed Apr 28, 2024
1 parent 024fdd2 commit 220308d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/executor/internal/exec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ go_library(
"//pkg/util/topsql/state",
"//pkg/util/tracing",
"@com_github_ngaut_pools//:pools",
"@com_github_pingcap_failpoint//:failpoint",
"@org_uber_go_atomic//:atomic",
],
)
Expand Down
7 changes: 7 additions & 0 deletions pkg/executor/internal/exec/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"github.com/ngaut/pools"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/domain"
"github.com/pingcap/tidb/pkg/expression"
"github.com/pingcap/tidb/pkg/parser"
Expand Down Expand Up @@ -89,6 +90,9 @@ func newExecutorChunkAllocator(vars *variable.SessionVars, retFieldTypes []*type

// InitCap returns the initial capacity for chunk
func (e *executorChunkAllocator) InitCap() int {
failpoint.Inject("initCap", func(val failpoint.Value) {
failpoint.Return(val.(int))
})
return e.initCap
}

Expand All @@ -99,6 +103,9 @@ func (e *executorChunkAllocator) SetInitCap(c int) {

// MaxChunkSize returns the max chunk size.
func (e *executorChunkAllocator) MaxChunkSize() int {
failpoint.Inject("maxChunkSize", func(val failpoint.Value) {
failpoint.Return(val.(int))
})
return e.maxChunkSize
}

Expand Down

0 comments on commit 220308d

Please sign in to comment.