Skip to content

Commit

Permalink
*: update pd client and increase maxWaitDuration (pingcap#321)
Browse files Browse the repository at this point in the history
Signed-off-by: disksing <[email protected]>
  • Loading branch information
disksing authored Mar 16, 2023
1 parent c3af40a commit fbbf110
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
12 changes: 6 additions & 6 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3365,8 +3365,8 @@ def go_deps():
name = "com_github_pingcap_kvproto",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/kvproto",
sum = "h1:bgLRG7gPJCq6aduA65ZV7xWQBThTcuarBB9VdfAzV4g=",
version = "v0.0.0-20230228041042-1e9aca94bab6",
sum = "h1:z6WwBPP0Txmal5zf+H7vf/lSmKZtSS8BTNwiLjEjdnA=",
version = "v0.0.0-20230312142449-01623096c924",
)
go_repository(
name = "com_github_pingcap_log",
Expand Down Expand Up @@ -4085,8 +4085,8 @@ def go_deps():
name = "com_github_tikv_client_go_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sum = "h1:u3ZBOP7xD9c8FtaUyXXvcby3HZ+9LmgD+m8Sod6orP8=",
version = "v2.0.7-0.20230307075841-4037273b3ca7",
sum = "h1:AeLAMwXhHioWqjGTWRRHFv0KHd7Rf/W9dvkGBjcbD0w=",
version = "v2.0.7-0.20230316021936-9d950905d743",
)
go_repository(
name = "com_github_tikv_pd",
Expand All @@ -4100,8 +4100,8 @@ def go_deps():
name = "com_github_tikv_pd_client",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/pd/client",
sum = "h1:ECJ8D5/WLh16i3wPja1guDH0xRc37GWqjagdM9LSgHc=",
version = "v0.0.0-20230302085510-a99ff9f67bbf",
sum = "h1:DQ4lXPrbjY5YNhOHa97Ci1fPLIKpVITeyZKPWQ805yQ=",
version = "v0.0.0-20230315081439-dcdf34fc1235",
)
go_repository(
name = "com_github_timakin_bodyclose",
Expand Down
2 changes: 1 addition & 1 deletion distsql/select_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (r *selectResult) updateCopRuntimeStats(ctx context.Context, copStats *copr

if copStats.ScanDetail != nil {
readKeys := copStats.ScanDetail.ProcessedKeys
readTime := copStats.TimeDetail.KvReadWallTimeMs.Seconds()
readTime := copStats.TimeDetail.KvReadWallTime.Seconds()
readSize := float64(copStats.ScanDetail.ProcessedKeysSize)
tikvmetrics.ObserveReadSLI(uint64(readKeys), readTime, readSize)
}
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ require (
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c
github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059
github.com/pingcap/kvproto v0.0.0-20230228041042-1e9aca94bab6
github.com/pingcap/kvproto v0.0.0-20230312142449-01623096c924
github.com/pingcap/log v1.1.1-0.20221116035753-734d527bc87c
github.com/pingcap/sysutil v0.0.0-20220114020952-ea68d2dbf5b4
github.com/pingcap/tidb/parser v0.0.0-20211011031125-9b13dc409c5e
Expand All @@ -92,8 +92,8 @@ require (
github.com/stretchr/testify v1.8.1
github.com/tdakkota/asciicheck v0.1.1
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.7-0.20230307075841-4037273b3ca7
github.com/tikv/pd/client v0.0.0-20230302085510-a99ff9f67bbf
github.com/tikv/client-go/v2 v2.0.7-0.20230316021936-9d950905d743
github.com/tikv/pd/client v0.0.0-20230315081439-dcdf34fc1235
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e
github.com/twmb/murmur3 v1.1.3
github.com/uber/jaeger-client-go v2.22.1+incompatible
Expand Down Expand Up @@ -269,6 +269,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
stathat.com/c/consistent v1.0.0 // indirect
)

replace (
Expand Down
13 changes: 7 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059/go.mod h1:fMRU1BA1y+r89
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 h1:surzm05a8C9dN8dIUmo4Be2+pMRb6f55i+UIYrluu2E=
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw=
github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w=
github.com/pingcap/kvproto v0.0.0-20230228041042-1e9aca94bab6 h1:bgLRG7gPJCq6aduA65ZV7xWQBThTcuarBB9VdfAzV4g=
github.com/pingcap/kvproto v0.0.0-20230228041042-1e9aca94bab6/go.mod h1:KUrW1FGoznGMMTssYBu0czfAhn6vQcIrHyZoSC6T990=
github.com/pingcap/kvproto v0.0.0-20230312142449-01623096c924 h1:z6WwBPP0Txmal5zf+H7vf/lSmKZtSS8BTNwiLjEjdnA=
github.com/pingcap/kvproto v0.0.0-20230312142449-01623096c924/go.mod h1:KUrW1FGoznGMMTssYBu0czfAhn6vQcIrHyZoSC6T990=
github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8=
github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM=
github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
Expand Down Expand Up @@ -933,10 +933,10 @@ github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJf
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW93SG+q0F8KI+yFrcIDT4c/RNoc4=
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM=
github.com/tikv/client-go/v2 v2.0.7-0.20230307075841-4037273b3ca7 h1:u3ZBOP7xD9c8FtaUyXXvcby3HZ+9LmgD+m8Sod6orP8=
github.com/tikv/client-go/v2 v2.0.7-0.20230307075841-4037273b3ca7/go.mod h1:HdCAbFaUCsjI4n5vlCJ0rGpMfIHoD1o6UlA1rwD9u1o=
github.com/tikv/pd/client v0.0.0-20230302085510-a99ff9f67bbf h1:ECJ8D5/WLh16i3wPja1guDH0xRc37GWqjagdM9LSgHc=
github.com/tikv/pd/client v0.0.0-20230302085510-a99ff9f67bbf/go.mod h1:N2QHc05Vll8CofXQor47lpW5d22WDosFC8WPVx9BsbU=
github.com/tikv/client-go/v2 v2.0.7-0.20230316021936-9d950905d743 h1:AeLAMwXhHioWqjGTWRRHFv0KHd7Rf/W9dvkGBjcbD0w=
github.com/tikv/client-go/v2 v2.0.7-0.20230316021936-9d950905d743/go.mod h1:DPL03G+QwLmypNjDIl+B02UltorBMx3WzSh4yJbp+cw=
github.com/tikv/pd/client v0.0.0-20230315081439-dcdf34fc1235 h1:DQ4lXPrbjY5YNhOHa97Ci1fPLIKpVITeyZKPWQ805yQ=
github.com/tikv/pd/client v0.0.0-20230315081439-dcdf34fc1235/go.mod h1:N2QHc05Vll8CofXQor47lpW5d22WDosFC8WPVx9BsbU=
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo=
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
Expand Down Expand Up @@ -1566,3 +1566,4 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI=
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
stathat.com/c/consistent v1.0.0 h1:ezyc51EGcRPJUxfHGSgJjWzJdj3NiMU9pNfLNGiXV0c=
stathat.com/c/consistent v1.0.0/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0=
8 changes: 1 addition & 7 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1627,18 +1627,12 @@ func (worker *copIteratorWorker) handleCollectExecutionInfo(bo *Backoffer, rpcCt
}
sd := &util.ScanDetail{}
td := util.TimeDetail{}
td.MergeFromTimeDetail(resp.pbResp.ExecDetailsV2.GetTimeDetailV2(), resp.pbResp.ExecDetails.GetTimeDetail())
if pbDetails := resp.pbResp.ExecDetailsV2; pbDetails != nil {
// Take values in `ExecDetailsV2` first.
if timeDetail := pbDetails.TimeDetail; timeDetail != nil {
td.MergeFromTimeDetail(timeDetail)
}
if scanDetailV2 := pbDetails.ScanDetailV2; scanDetailV2 != nil {
sd.MergeFromScanDetailV2(scanDetailV2)
}
} else if pbDetails := resp.pbResp.ExecDetails; pbDetails != nil {
if timeDetail := pbDetails.TimeDetail; timeDetail != nil {
td.MergeFromTimeDetail(timeDetail)
}
if scanDetail := pbDetails.ScanDetail; scanDetail != nil {
if scanDetail.Write != nil {
sd.ProcessedKeys = scanDetail.Write.Processed
Expand Down
7 changes: 6 additions & 1 deletion store/driver/tikv_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ func TrySetupGlobalResourceController(ctx context.Context, serverID uint64, s kv
return errors.New("cannot setup up resource controller, should use tikv storage")
}

control, err := rmclient.NewResourceGroupController(ctx, serverID, store.GetPDClient(), rmclient.DefaultRequestUnitConfig(), rmclient.EnableSingleGroupByKeyspace())
opts := []rmclient.ResourceControlCreateOption{
rmclient.EnableSingleGroupByKeyspace(),
rmclient.WithMaxWaitDuration(time.Second * 30),
}

control, err := rmclient.NewResourceGroupController(ctx, serverID, store.GetPDClient(), rmclient.DefaultRequestUnitConfig(), opts...)
if err != nil {
return err
}
Expand Down

0 comments on commit fbbf110

Please sign in to comment.