From 1730798019727fbed90617dd749349727ac8c79a Mon Sep 17 00:00:00 2001 From: disksing Date: Mon, 15 Oct 2018 19:32:59 +0800 Subject: [PATCH] *: udpate pd client vendor (#7898) --- Gopkg.lock | 9 +++++---- store/mockstore/mocktikv/mock.go | 2 +- store/mockstore/mocktikv/pd.go | 2 +- store/mockstore/tikv.go | 2 +- store/tikv/gcworker/gc_worker.go | 2 +- store/tikv/interface.go | 2 +- store/tikv/kv.go | 2 +- store/tikv/lock_resolver.go | 2 +- store/tikv/oracle/oracles/pd.go | 4 ++-- store/tikv/pd_codec.go | 2 +- store/tikv/rawkv.go | 2 +- store/tikv/region_cache.go | 2 +- store/tikv/store_test.go | 2 +- store/tikv/test_util.go | 2 +- .../pingcap/pd/{pd-client => client}/client.go | 4 +++- .../pingcap/pd/{pd-client => client}/metrics.go | 0 16 files changed, 22 insertions(+), 19 deletions(-) rename vendor/github.com/pingcap/pd/{pd-client => client}/client.go (99%) rename vendor/github.com/pingcap/pd/{pd-client => client}/metrics.go (100%) diff --git a/Gopkg.lock b/Gopkg.lock index 519d2644324e6..c2843ab18a021 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -299,11 +299,11 @@ [[projects]] branch = "master" - digest = "1:2c64fe28351dc49da088194d80faceb34186e080a60c649694d094b2ccccacf5" + digest = "1:8f576565a8479071ca1951bf678519b1c32480aad8dec2379a64858c31d9e6a9" name = "github.com/pingcap/pd" - packages = ["pd-client"] + packages = ["client"] pruneopts = "NUT" - revision = "b5992e356ff447a6fdaa450b3f5ea33afbd11680" + revision = "eb892dda1e33a0b76191d39894ad4a806f313f6e" [[projects]] branch = "master" @@ -541,6 +541,7 @@ "github.com/grpc-ecosystem/go-grpc-prometheus", "github.com/klauspost/cpuid", "github.com/ngaut/pools", + "github.com/ngaut/sync2", "github.com/opentracing/basictracer-go", "github.com/opentracing/opentracing-go", "github.com/pingcap/check", @@ -556,7 +557,7 @@ "github.com/pingcap/kvproto/pkg/kvrpcpb", "github.com/pingcap/kvproto/pkg/metapb", "github.com/pingcap/kvproto/pkg/tikvpb", - "github.com/pingcap/pd/pd-client", + "github.com/pingcap/pd/client", "github.com/pingcap/tipb/go-binlog", "github.com/pingcap/tipb/go-tipb", "github.com/pkg/errors", diff --git a/store/mockstore/mocktikv/mock.go b/store/mockstore/mocktikv/mock.go index 0d43376a6883d..1b4e08334a54f 100644 --- a/store/mockstore/mocktikv/mock.go +++ b/store/mockstore/mocktikv/mock.go @@ -14,7 +14,7 @@ package mocktikv import ( - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pkg/errors" ) diff --git a/store/mockstore/mocktikv/pd.go b/store/mockstore/mocktikv/pd.go index bb99ce0e2f488..e47e05c55963e 100644 --- a/store/mockstore/mocktikv/pd.go +++ b/store/mockstore/mocktikv/pd.go @@ -18,7 +18,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "golang.org/x/net/context" ) diff --git a/store/mockstore/tikv.go b/store/mockstore/tikv.go index 796aa74e2ba58..7afbe7726bd23 100644 --- a/store/mockstore/tikv.go +++ b/store/mockstore/tikv.go @@ -17,7 +17,7 @@ import ( "net/url" "strings" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/mockstore/mocktikv" diff --git a/store/tikv/gcworker/gc_worker.go b/store/tikv/gcworker/gc_worker.go index fb58859f320cf..c960808d25ba9 100644 --- a/store/tikv/gcworker/gc_worker.go +++ b/store/tikv/gcworker/gc_worker.go @@ -25,7 +25,7 @@ import ( "github.com/pingcap/kvproto/pkg/errorpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" diff --git a/store/tikv/interface.go b/store/tikv/interface.go index 88ed848c73b2b..8c111218b41b0 100644 --- a/store/tikv/interface.go +++ b/store/tikv/interface.go @@ -16,7 +16,7 @@ package tikv import ( "time" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/store/tikv/tikvrpc" diff --git a/store/tikv/kv.go b/store/tikv/kv.go index 84d6747f3a344..fc834d1e530a3 100644 --- a/store/tikv/kv.go +++ b/store/tikv/kv.go @@ -24,7 +24,7 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" diff --git a/store/tikv/lock_resolver.go b/store/tikv/lock_resolver.go index ba8ab179b85c8..a85415398dde6 100644 --- a/store/tikv/lock_resolver.go +++ b/store/tikv/lock_resolver.go @@ -20,7 +20,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/kvrpcpb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/store/tikv/tikvrpc" diff --git a/store/tikv/oracle/oracles/pd.go b/store/tikv/oracle/oracles/pd.go index d02748c3528ef..a8e7db8d8a02f 100644 --- a/store/tikv/oracle/oracles/pd.go +++ b/store/tikv/oracle/oracles/pd.go @@ -17,7 +17,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pkg/errors" @@ -37,7 +37,7 @@ type pdOracle struct { } // NewPdOracle create an Oracle that uses a pd client source. -// Refer https://github.com/pingcap/pd/blob/master/pd-client/client.go for more details. +// Refer https://github.com/pingcap/pd/blob/master/client/client.go for more details. // PdOracle mantains `lastTS` to store the last timestamp got from PD server. If // `GetTimestamp()` is not called after `updateInterval`, it will be called by // itself to keep up with the timestamp on PD server. diff --git a/store/tikv/pd_codec.go b/store/tikv/pd_codec.go index e009a6c17e8d7..1e871c4a223e2 100644 --- a/store/tikv/pd_codec.go +++ b/store/tikv/pd_codec.go @@ -15,7 +15,7 @@ package tikv import ( "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" "golang.org/x/net/context" diff --git a/store/tikv/rawkv.go b/store/tikv/rawkv.go index 44eeef9cb95f1..adbd12b656ed7 100644 --- a/store/tikv/rawkv.go +++ b/store/tikv/rawkv.go @@ -18,7 +18,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/kvrpcpb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/store/tikv/tikvrpc" diff --git a/store/tikv/region_cache.go b/store/tikv/region_cache.go index 9bf21762a0622..381af34c5c6bf 100644 --- a/store/tikv/region_cache.go +++ b/store/tikv/region_cache.go @@ -22,7 +22,7 @@ import ( "github.com/google/btree" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/metrics" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/store/tikv/store_test.go b/store/tikv/store_test.go index 2fe3af12b194d..00735eee64a3f 100644 --- a/store/tikv/store_test.go +++ b/store/tikv/store_test.go @@ -20,7 +20,7 @@ import ( . "github.com/pingcap/check" pb "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/mockoracle" "github.com/pingcap/tidb/store/tikv/tikvrpc" diff --git a/store/tikv/test_util.go b/store/tikv/test_util.go index 060ea68a626c0..d4efcbbd0bc3e 100644 --- a/store/tikv/test_util.go +++ b/store/tikv/test_util.go @@ -14,7 +14,7 @@ package tikv import ( - "github.com/pingcap/pd/pd-client" + "github.com/pingcap/pd/client" "github.com/pingcap/tidb/kv" "github.com/pkg/errors" "github.com/twinj/uuid" diff --git a/vendor/github.com/pingcap/pd/pd-client/client.go b/vendor/github.com/pingcap/pd/client/client.go similarity index 99% rename from vendor/github.com/pingcap/pd/pd-client/client.go rename to vendor/github.com/pingcap/pd/client/client.go index 31d039558f609..1f0c643d1c972 100644 --- a/vendor/github.com/pingcap/pd/pd-client/client.go +++ b/vendor/github.com/pingcap/pd/client/client.go @@ -163,7 +163,9 @@ func (c *client) initClusterID() error { defer cancel() for i := 0; i < maxInitClusterRetries; i++ { for _, u := range c.urls { - members, err := c.getMembers(ctx, u) + timeoutCtx, timeoutCancel := context.WithTimeout(ctx, pdTimeout) + members, err := c.getMembers(timeoutCtx, u) + timeoutCancel() if err != nil || members.GetHeader() == nil { log.Errorf("[pd] failed to get cluster id: %v", err) continue diff --git a/vendor/github.com/pingcap/pd/pd-client/metrics.go b/vendor/github.com/pingcap/pd/client/metrics.go similarity index 100% rename from vendor/github.com/pingcap/pd/pd-client/metrics.go rename to vendor/github.com/pingcap/pd/client/metrics.go