Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go.mod: update client-go to the new version #26256

Merged
merged 4 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmd/benchraw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package main

import (
"context"
"flag"
"fmt"
"net/http"
Expand All @@ -26,7 +27,8 @@ import (
"github.com/pingcap/log"
"github.com/pingcap/parser/terror"
"github.com/tikv/client-go/v2/config"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/rawkv"

"go.uber.org/zap"
)

Expand All @@ -42,7 +44,8 @@ var (

// batchRawPut blinds put bench.
func batchRawPut(value []byte) {
cli, err := tikv.NewRawKVClient(strings.Split(*pdAddr, ","), config.Security{
ctx := context.Background()
cli, err := rawkv.NewClient(ctx, strings.Split(*pdAddr, ","), config.Security{
ClusterSSLCA: *sslCA,
ClusterSSLCert: *sslCert,
ClusterSSLKey: *sslKey,
Expand All @@ -61,7 +64,7 @@ func batchRawPut(value []byte) {
for j := 0; j < base; j++ {
k := base*i + j
key := fmt.Sprintf("key_%d", k)
err = cli.Put([]byte(key), value)
err = cli.Put(ctx, []byte(key), value)
if err != nil {
log.Fatal("put failed", zap.Error(err))
}
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/opentracing/opentracing-go v1.1.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19
github.com/pingcap/br v5.2.0-alpha.0.20210714061533-935998df85b2+incompatible
github.com/pingcap/br v5.2.0-alpha.0.20210714104733-65ae7dd3a2f2+incompatible
github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712
github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63
github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd
Expand All @@ -56,7 +56,7 @@ require (
github.com/soheilhy/cmux v0.1.4
github.com/stretchr/testify v1.7.0
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210712082038-2c7970b2b7e8
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210715021615-05398690243f
github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d
github.com/twmb/murmur3 v1.1.3
github.com/uber-go/atomic v1.4.0
Expand All @@ -78,6 +78,7 @@ require (
golang.org/x/tools v0.1.4
google.golang.org/grpc v1.27.1
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
honnef.co/go/tools v0.2.0 // indirect
modernc.org/mathutil v1.2.2 // indirect
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d h1:U+PMnTlV2tu7RuMK5e
github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d/go.mod h1:lXfE4PvvTW5xOjO6Mba8zDPyw8M93B6AQ7frTGnMlA8=
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19 h1:IXpGy7y9HyoShAFmzW2OPF0xCA5EOoSTyZHwsgYk9Ro=
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19/go.mod h1:LyrqUOHZrUDf9oGi1yoz1+qw9ckSIhQb5eMa1acOLNQ=
github.com/pingcap/br v5.2.0-alpha.0.20210714061533-935998df85b2+incompatible h1:wmtS4lgnDDPWfbG6Orco+6ViZ0qQWmHqugCnBv8/9D4=
github.com/pingcap/br v5.2.0-alpha.0.20210714061533-935998df85b2+incompatible/go.mod h1:ymVmo50lQydxib0tmK5hHk4oteB7hZ0IMCArunwy3UQ=
github.com/pingcap/br v5.2.0-alpha.0.20210714104733-65ae7dd3a2f2+incompatible h1:KIh0fJHRB44kRPccXl7V0f5mtzXmR+0mM8vNciWst8g=
github.com/pingcap/br v5.2.0-alpha.0.20210714104733-65ae7dd3a2f2+incompatible/go.mod h1:ymVmo50lQydxib0tmK5hHk4oteB7hZ0IMCArunwy3UQ=
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ=
github.com/pingcap/check v0.0.0-20191107115940-caf2b9e6ccf4/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc=
github.com/pingcap/check v0.0.0-20191216031241-8a5a85928f12/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc=
Expand Down Expand Up @@ -561,8 +561,8 @@ github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfK
github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210712082038-2c7970b2b7e8 h1:xMbxiAVbJPzzrITV8yqUBgltm4GNdYebkuwUBB5RX9Y=
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210712082038-2c7970b2b7e8/go.mod h1:+bOiuuZZUqIq19EqyhTWQFaB0PeXLOh/il1vnVZx3Tk=
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210715021615-05398690243f h1:lNw2kTpDx+mMjyNEouHMVog4GKlw2Z5wjQOmNyigBRM=
github.com/tikv/client-go/v2 v2.0.0-alpha.0.20210715021615-05398690243f/go.mod h1:+bOiuuZZUqIq19EqyhTWQFaB0PeXLOh/il1vnVZx3Tk=
github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d h1:K0XnvsnT6ofLDuM8Rt3PuFQO4p8bNraeHYstspD316g=
github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d/go.mod h1:Jw9KG11C/23Rr7DW4XWQ7H5xOgGZo6DFL1OKAF4+Igw=
github.com/tklauser/go-sysconf v0.3.4 h1:HT8SVixZd3IzLdfs/xlpq0jeSfTX57g1v6wB1EuzV7M=
Expand Down
17 changes: 9 additions & 8 deletions store/gcworker/gc_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"github.com/tikv/client-go/v2/oracle"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/tikvrpc"
"github.com/tikv/client-go/v2/txnkv/rangetask"
tikvutil "github.com/tikv/client-go/v2/util"
pd "github.com/tikv/pd/client"
"go.uber.org/zap"
Expand Down Expand Up @@ -1021,11 +1022,11 @@ func (w *GCWorker) legacyResolveLocks(ctx context.Context, safePoint uint64, con
zap.Int("concurrency", concurrency))
startTime := time.Now()

handler := func(ctx context.Context, r tikvstore.KeyRange) (tikv.RangeTaskStat, error) {
handler := func(ctx context.Context, r tikvstore.KeyRange) (rangetask.TaskStat, error) {
return w.resolveLocksForRange(ctx, safePoint, r.StartKey, r.EndKey)
}

runner := tikv.NewRangeTaskRunner("resolve-locks-runner", w.tikvStore, concurrency, handler)
runner := rangetask.NewRangeTaskRunner("resolve-locks-runner", w.tikvStore, concurrency, handler)
// Run resolve lock on the whole TiKV cluster. Empty keys means the range is unbounded.
err := runner.RunOnRange(ctx, []byte(""), []byte(""))
if err != nil {
Expand All @@ -1044,7 +1045,7 @@ func (w *GCWorker) legacyResolveLocks(ctx context.Context, safePoint uint64, con
return nil
}

func (w *GCWorker) resolveLocksForRange(ctx context.Context, safePoint uint64, startKey []byte, endKey []byte) (tikv.RangeTaskStat, error) {
func (w *GCWorker) resolveLocksForRange(ctx context.Context, safePoint uint64, startKey []byte, endKey []byte) (rangetask.TaskStat, error) {
// for scan lock request, we must return all locks even if they are generated
// by the same transaction. because gc worker need to make sure all locks have been
// cleaned.
Expand All @@ -1057,7 +1058,7 @@ func (w *GCWorker) resolveLocksForRange(ctx context.Context, safePoint uint64, s
req.ScanLock().Limit = 3
})

var stat tikv.RangeTaskStat
var stat rangetask.TaskStat
key := startKey
bo := tikv.NewGcResolveLockMaxBackoffer(ctx)
failpoint.Inject("setGcResolveMaxBackoff", func(v failpoint.Value) {
Expand Down Expand Up @@ -1547,8 +1548,8 @@ func (w *GCWorker) uploadSafePointToPD(ctx context.Context, safePoint uint64) er
return nil
}

func (w *GCWorker) doGCForRange(ctx context.Context, startKey []byte, endKey []byte, safePoint uint64) (tikv.RangeTaskStat, error) {
var stat tikv.RangeTaskStat
func (w *GCWorker) doGCForRange(ctx context.Context, startKey []byte, endKey []byte, safePoint uint64) (rangetask.TaskStat, error) {
var stat rangetask.TaskStat
defer func() {
metrics.GCActionRegionResultCounter.WithLabelValues("success").Add(float64(stat.CompletedRegions))
metrics.GCActionRegionResultCounter.WithLabelValues("fail").Add(float64(stat.FailedRegions))
Expand Down Expand Up @@ -1631,11 +1632,11 @@ func (w *GCWorker) doGC(ctx context.Context, safePoint uint64, concurrency int)
zap.Uint64("safePoint", safePoint))
startTime := time.Now()

runner := tikv.NewRangeTaskRunner(
runner := rangetask.NewRangeTaskRunner(
"gc-runner",
w.tikvStore,
concurrency,
func(ctx context.Context, r tikvstore.KeyRange) (tikv.RangeTaskStat, error) {
func(ctx context.Context, r tikvstore.KeyRange) (rangetask.TaskStat, error) {
return w.doGCForRange(ctx, r.StartKey, r.EndKey, safePoint)
})

Expand Down