mirror of https://github.com/tikv/client-go.git
Update the PD HTTP client to support source mark (#1081)
Signed-off-by: JmPotato <ghzpotato@gmail.com>
This commit is contained in:
parent
8deef63a94
commit
6f9ba8327b
2
go.mod
2
go.mod
|
|
@ -21,7 +21,7 @@ require (
|
|||
github.com/prometheus/client_model v0.3.0
|
||||
github.com/stretchr/testify v1.8.2
|
||||
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27
|
||||
github.com/twmb/murmur3 v1.1.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.10
|
||||
go.etcd.io/etcd/client/v3 v3.5.10
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -114,6 +114,8 @@ github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW
|
|||
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM=
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2 h1:7fnKwFC9pgiOolvnUnquEAb60liIpna+0hFRkopaOSg=
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2/go.mod h1:cd6zBqRM9aogxf26K8NnFRPVtq9BnRE59tKEpX8IaWQ=
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27 h1:U8jPVwFu9Zu8tXYlmOxO/Zv3OcsgoJ/COSwMNWvED9c=
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27/go.mod h1:AwjTSpM7CgAynYwB6qTG5R5fVC9/eXlQXiTO6zDL1HI=
|
||||
github.com/twmb/murmur3 v1.1.3 h1:D83U0XYKcHRYwYIpBKf3Pks91Z0Byda/9SJ8B6EMRcA=
|
||||
github.com/twmb/murmur3 v1.1.3/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ require (
|
|||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tidwall/gjson v1.14.1
|
||||
github.com/tikv/client-go/v2 v2.0.8-0.20231201024404-0ff16620f6c0
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27
|
||||
go.uber.org/goleak v1.3.0
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -518,6 +518,8 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
|||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2 h1:7fnKwFC9pgiOolvnUnquEAb60liIpna+0hFRkopaOSg=
|
||||
github.com/tikv/pd/client v0.0.0-20231204034622-259435d93ae2/go.mod h1:cd6zBqRM9aogxf26K8NnFRPVtq9BnRE59tKEpX8IaWQ=
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27 h1:U8jPVwFu9Zu8tXYlmOxO/Zv3OcsgoJ/COSwMNWvED9c=
|
||||
github.com/tikv/pd/client v0.0.0-20231219031951-25f48f0bdd27/go.mod h1:AwjTSpM7CgAynYwB6qTG5R5fVC9/eXlQXiTO6zDL1HI=
|
||||
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func (s *apiTestSuite) SetupTest() {
|
|||
rpcClient := tikv.NewRPCClient()
|
||||
require.NoError(failpoint.Enable("tikvclient/mockFastSafeTSUpdater", `return()`))
|
||||
// Set PD HTTP client.
|
||||
s.store, err = tikv.NewTestTiKVStore(rpcClient, pdClient, nil, nil, 0, tikv.WithPDHTTPClient(addrs))
|
||||
s.store, err = tikv.NewTestTiKVStore(rpcClient, pdClient, nil, nil, 0, tikv.WithPDHTTPClient("pd-api-test", addrs))
|
||||
require.NoError(err)
|
||||
storeID := uint64(1)
|
||||
s.store.GetRegionCache().SetRegionCacheStore(storeID, s.storeAddr(storeID), s.storeAddr(storeID), tikvrpc.TiKV, 1, nil)
|
||||
|
|
|
|||
|
|
@ -191,12 +191,15 @@ func WithPool(gp Pool) Option {
|
|||
}
|
||||
|
||||
// WithPDHTTPClient sets the PD HTTP client with the given PD addresses and options.
|
||||
// Source is to mark where the HTTP client is created, which is used for metrics and logs.
|
||||
func WithPDHTTPClient(
|
||||
source string,
|
||||
pdAddrs []string,
|
||||
opts ...pdhttp.ClientOption,
|
||||
) Option {
|
||||
return func(o *KVStore) {
|
||||
o.pdHttpClient = pdhttp.NewClient(
|
||||
source,
|
||||
pdAddrs,
|
||||
opts...,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue