Skip to content

Commit

Permalink
store,server: Reduce TiFlashFallBack test time (#45778)
Browse files Browse the repository at this point in the history
close #45773
  • Loading branch information
yibin87 authored Aug 3, 2023
1 parent fab6cb0 commit 20490ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ go_library(

go_test(
name = "server_test",
timeout = "moderate",
timeout = "short",
srcs = [
"conn_stmt_test.go",
"conn_test.go",
Expand Down
2 changes: 2 additions & 0 deletions server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,10 @@ func TestTiFlashFallback(t *testing.T) {
tk.MustQuery("select count(*) from t").Check(testkit.Rows("50"))

require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/executor/internal/mpp/ReduceCopNextMaxBackoff", `return(true)`))
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/store/copr/ReduceCopNextMaxBackoff", `return(true)`))
defer func() {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/executor/internal/mpp/ReduceCopNextMaxBackoff"))
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/store/copr/ReduceCopNextMaxBackoff"))
}()

require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/store/mockstore/unistore/BatchCopRpcErrtiflash0", "return(\"tiflash0\")"))
Expand Down
8 changes: 7 additions & 1 deletion store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,13 @@ func chooseBackoffer(ctx context.Context, backoffermap map[uint64]*Backoffer, ta
if ok {
return bo
}
newbo := backoff.NewBackofferWithVars(ctx, CopNextMaxBackoff, worker.vars)
boMaxSleep := CopNextMaxBackoff
failpoint.Inject("ReduceCopNextMaxBackoff", func(value failpoint.Value) {
if value.(bool) {
boMaxSleep = 2
}
})
newbo := backoff.NewBackofferWithVars(ctx, boMaxSleep, worker.vars)
backoffermap[task.region.GetID()] = newbo
return newbo
}
Expand Down

0 comments on commit 20490ae

Please sign in to comment.