Skip to content

Commit 9a1ee39

Browse files
authored
copr: make cop request timeout a config parameter (#45131)
close #45298
1 parent 7b1cf3b commit 9a1ee39

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

DEPS.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,8 +3863,8 @@ def go_deps():
38633863
name = "com_github_tikv_client_go_v2",
38643864
build_file_proto_mode = "disable_global",
38653865
importpath = "github.com/tikv/client-go/v2",
3866-
sum = "h1:pLUQsFZGE3z7OlZddP+WHkb85rLoxPwRd8CknfSw804=",
3867-
version = "v2.0.8-0.20230707070242-178f6fa01aab",
3866+
sum = "h1:wRqy8mHs5IocLn4pDvqrwGs4lc3wKhdDXxFyLi8kNbQ=",
3867+
version = "v2.0.8-0.20230711075855-e540aa3b9657",
38683868
)
38693869

38703870
go_repository(

br/pkg/gluetidb/glue.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"bytes"
77
"context"
88
"strings"
9+
"time"
910

1011
"github.com/pingcap/errors"
1112
"github.com/pingcap/log"
@@ -44,6 +45,7 @@ func New() Glue {
4445
config.UpdateGlobal(func(conf *config.Config) {
4546
conf.SkipRegisterToDashboard = true
4647
conf.Log.EnableSlowLog.Store(false)
48+
conf.TiKVClient.CoprReqTimeout = 1800 * time.Second
4749
})
4850
return Glue{}
4951
}

config/config_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"regexp"
2626
"strings"
2727
"testing"
28+
"time"
2829

2930
"github.com/BurntSushi/toml"
3031
"github.com/pingcap/errors"
@@ -752,6 +753,7 @@ region-cache-ttl=6000
752753
store-limit=0
753754
ttl-refreshed-txn-size=8192
754755
resolve-lock-lite-threshold = 16
756+
copr-req-timeout = "120s"
755757
[tikv-client.async-commit]
756758
keys-limit=123
757759
total-key-size-limit=1024
@@ -808,6 +810,7 @@ max_connections = 200
808810
require.Equal(t, uint64(10000), conf.SplitRegionMaxNum)
809811
require.True(t, conf.RepairMode)
810812
require.Equal(t, uint64(16), conf.TiKVClient.ResolveLockLiteThreshold)
813+
require.Equal(t, 120*time.Second, conf.TiKVClient.CoprReqTimeout)
811814
require.Equal(t, uint32(200), conf.Instance.MaxConnections)
812815
require.Equal(t, uint32(10), conf.TiDBMaxReuseChunk)
813816
require.Equal(t, uint32(20), conf.TiDBMaxReuseColumn)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ require (
9797
github.com/stretchr/testify v1.8.4
9898
github.com/tdakkota/asciicheck v0.2.0
9999
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
100-
github.com/tikv/client-go/v2 v2.0.8-0.20230707070242-178f6fa01aab
100+
github.com/tikv/client-go/v2 v2.0.8-0.20230711075855-e540aa3b9657
101101
github.com/tikv/pd/client v0.0.0-20230613052906-7158cb319935
102102
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966
103103
github.com/twmb/murmur3 v1.1.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,8 @@ github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJf
973973
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
974974
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW93SG+q0F8KI+yFrcIDT4c/RNoc4=
975975
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM=
976-
github.com/tikv/client-go/v2 v2.0.8-0.20230707070242-178f6fa01aab h1:pLUQsFZGE3z7OlZddP+WHkb85rLoxPwRd8CknfSw804=
977-
github.com/tikv/client-go/v2 v2.0.8-0.20230707070242-178f6fa01aab/go.mod h1:4KkKqjJgKlvvWMyNqdnAlYFfV4QjEj1fEb5Hb/FoT88=
976+
github.com/tikv/client-go/v2 v2.0.8-0.20230711075855-e540aa3b9657 h1:wRqy8mHs5IocLn4pDvqrwGs4lc3wKhdDXxFyLi8kNbQ=
977+
github.com/tikv/client-go/v2 v2.0.8-0.20230711075855-e540aa3b9657/go.mod h1:4KkKqjJgKlvvWMyNqdnAlYFfV4QjEj1fEb5Hb/FoT88=
978978
github.com/tikv/pd/client v0.0.0-20230613052906-7158cb319935 h1:a5SATBxu/0Z6qNnz4KXDN91gDA06waaYcHM6dkb6lz4=
979979
github.com/tikv/pd/client v0.0.0-20230613052906-7158cb319935/go.mod h1:YmNkj9UT8IjwFov9k3oquH0UgIUHniUaQT3jXKgZYbM=
980980
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M=

store/copr/coprocessor.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/pingcap/kvproto/pkg/errorpb"
3434
"github.com/pingcap/kvproto/pkg/kvrpcpb"
3535
"github.com/pingcap/kvproto/pkg/metapb"
36+
"github.com/pingcap/tidb/config"
3637
"github.com/pingcap/tidb/domain/infosync"
3738
"github.com/pingcap/tidb/domain/resourcegroup"
3839
"github.com/pingcap/tidb/errno"
@@ -1204,7 +1205,8 @@ func (worker *copIteratorWorker) handleTaskOnce(bo *Backoffer, task *copTask, ch
12041205
req.ReplicaReadType = options.GetTiKVReplicaReadType(kv.ReplicaReadFollower)
12051206
ops = append(ops, tikv.WithMatchStores([]uint64{*task.redirect2Replica}))
12061207
}
1207-
resp, rpcCtx, storeAddr, err := worker.kvclient.SendReqCtx(bo.TiKVBackoffer(), req, task.region, tikv.ReadTimeoutMedium, getEndPointType(task.storeType), task.storeAddr, ops...)
1208+
resp, rpcCtx, storeAddr, err := worker.kvclient.SendReqCtx(bo.TiKVBackoffer(), req, task.region,
1209+
config.GetGlobalConfig().TiKVClient.CoprReqTimeout, getEndPointType(task.storeType), task.storeAddr, ops...)
12081210
err = derr.ToTiDBErr(err)
12091211
if err != nil {
12101212
if task.storeType == kv.TiDB {

0 commit comments

Comments
 (0)