Skip to content

Commit

Permalink
*: update client-go
Browse files Browse the repository at this point in the history
close #33537

Signed-off-by: youjiali1995 <[email protected]>
  • Loading branch information
youjiali1995 committed Mar 29, 2022
1 parent c58e005 commit 41fd8cb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.1-0.20220321123529-f4eae62b7ed5
github.com/tikv/client-go/v2 v2.0.1-0.20220328083738-8489c3e8c3d9
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710
github.com/twmb/murmur3 v1.1.3
github.com/uber/jaeger-client-go v2.22.1+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tikv/client-go/v2 v2.0.1-0.20220321123529-f4eae62b7ed5 h1:XcvL365oWoFAdprI2H23vvFQYHc2MBQ/CcWHvkvIzGk=
github.com/tikv/client-go/v2 v2.0.1-0.20220321123529-f4eae62b7ed5/go.mod h1:0scaG+seu7L56apm+Gjz9vckyO7ABIzM6T7n00mrIXs=
github.com/tikv/client-go/v2 v2.0.1-0.20220328083738-8489c3e8c3d9 h1:TgSywPECh84B5S6Z97jhMdQVrezPwUbOKbCZFie2kPI=
github.com/tikv/client-go/v2 v2.0.1-0.20220328083738-8489c3e8c3d9/go.mod h1:0scaG+seu7L56apm+Gjz9vckyO7ABIzM6T7n00mrIXs=
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710 h1:jxgmKOscXSjaFEKQGRyY5qOpK8hLqxs2irb/uDJMtwk=
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710/go.mod h1:AtvppPwkiyUgQlR1W9qSqfTB+OsOIu19jDCOxOsPkmU=
github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
Expand Down
5 changes: 5 additions & 0 deletions store/copr/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func (c *tikvClient) Close() error {
return derr.ToTiDBErr(err)
}

func (c *tikvClient) CloseAddr(addr string) error {
err := c.c.CloseAddr(addr)
return derr.ToTiDBErr(err)
}

// SendRequest sends Request.
func (c *tikvClient) SendRequest(ctx context.Context, addr string, req *tikvrpc.Request, timeout time.Duration) (*tikvrpc.Response, error) {
res, err := c.c.SendRequest(ctx, addr, req, timeout)
Expand Down
11 changes: 11 additions & 0 deletions store/mockstore/redirector.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ func (c *clientRedirector) Close() error {
return err
}

func (c *clientRedirector) CloseAddr(addr string) error {
err := c.mockClient.CloseAddr(addr)
if err != nil {
return err
}
if c.rpcClient != nil {
err = c.rpcClient.CloseAddr(addr)
}
return err
}

func (c *clientRedirector) SendRequest(ctx context.Context, addr string, req *tikvrpc.Request, timeout time.Duration) (*tikvrpc.Response, error) {
if req.StoreTp == tikvrpc.TiDB {
c.Once.Do(func() {
Expand Down
5 changes: 5 additions & 0 deletions store/mockstore/unistore/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ func (c *RPCClient) Close() error {
return nil
}

// CloseAddr implements tikv.Client interface and it does nothing.
func (c *RPCClient) CloseAddr(addr string) error {
return nil
}

type mockClientStream struct{}

// Header implements grpc.ClientStream interface
Expand Down

0 comments on commit 41fd8cb

Please sign in to comment.