Skip to content

Commit e304dc4

Browse files
committed
support new option for WithAllowRouterServiceHandle
Signed-off-by: 童剑 <1045931706@qq.com>
1 parent 1264c12 commit e304dc4

File tree

6 files changed

+27
-2
lines changed

6 files changed

+27
-2
lines changed

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module github.com/tikv/client-go/v2
22

3-
go 1.23.0
3+
go 1.23.12
4+
5+
toolchain go1.24.1
6+
7+
replace github.com/tikv/pd/client => github.com/bufferflies/pd/client v0.0.0-20251113073927-030b4e3ceaca
48

59
require (
610
github.com/VividCortex/ewma v1.2.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAU
66
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
77
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
88
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
9+
github.com/bufferflies/pd/client v0.0.0-20251113073927-030b4e3ceaca h1:X2vn4hnHMNxcAV4fFEE+3eVYvjp9F9Ll3LWciYaRGNM=
10+
github.com/bufferflies/pd/client v0.0.0-20251113073927-030b4e3ceaca/go.mod h1:3Zt8kRLZHAEGaU65Eg3+8MrlRFH6gpSJ00WdAXn8zTY=
911
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5 h1:BjkPE3785EwPhhyuFkbINB+2a1xATwk8SNDWnJiD41g=
1012
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5/go.mod h1:jtAfVaU/2cu1+wdSRPWE2c1N2qeAA3K4RH9pYgqwets=
1113
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=

integration_tests/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module integration_tests
22

33
go 1.24.1
44

5+
replace github.com/tikv/pd/client => github.com/bufferflies/pd/client v0.0.0-20251113073927-030b4e3ceaca
6+
57
require (
68
github.com/google/uuid v1.6.0
79
github.com/ninedraft/israce v0.0.3

integration_tests/go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ github.com/blacktear23/go-proxyprotocol v1.0.6 h1:eTt6UMpEnq59NjON49b3Cay8Dm0sCs
884884
github.com/blacktear23/go-proxyprotocol v1.0.6/go.mod h1:FSCbgnRZrQXazBLL5snfBbrcFSMtcmUDhSRb9OfFA1o=
885885
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
886886
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
887+
github.com/bufferflies/pd/client v0.0.0-20251113073927-030b4e3ceaca/go.mod h1:3Zt8kRLZHAEGaU65Eg3+8MrlRFH6gpSJ00WdAXn8zTY=
887888
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5 h1:BjkPE3785EwPhhyuFkbINB+2a1xATwk8SNDWnJiD41g=
888889
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5/go.mod h1:jtAfVaU/2cu1+wdSRPWE2c1N2qeAA3K4RH9pYgqwets=
889890
github.com/carlmjohnson/flagext v0.21.0 h1:/c4uK3ie786Z7caXLcIMvePNSSiH3bQVGDvmGLMme60=

internal/locate/region_cache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ func (c *RegionCache) findRegionByKey(bo *retry.Backoffer, key []byte, isEndKey
16381638
if r == nil || expired {
16391639
// load region when it is not exists or expired.
16401640
observeLoadRegion(tag, r, expired, 0)
1641-
lr, err := c.loadRegion(bo, key, isEndKey, opt.WithAllowFollowerHandle())
1641+
lr, err := c.loadRegion(bo, key, isEndKey, opt.WithAllowFollowerHandle(), opt.WithAllowRouterServiceHandle())
16421642
if err != nil {
16431643
// no region data, return error if failure.
16441644
return nil, err
@@ -2447,6 +2447,7 @@ func (c *RegionCache) batchScanRegions(bo *retry.Backoffer, keyRanges []router.K
24472447
start := time.Now()
24482448
pdOpts := []opt.GetRegionOption{
24492449
opt.WithAllowFollowerHandle(),
2450+
opt.WithAllowRouterServiceHandle(),
24502451
opt.WithOutputMustContainAllKeyRange(),
24512452
}
24522453
if batchOpt.needBuckets {

internal/mockstore/mocktikv/pd.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,21 @@ type gcStatesClient struct {
593593
keyspaceID uint32
594594
}
595595

596+
func (c gcStatesClient) SetGlobalGCBarrier(ctx context.Context, barrierID string, barrierTS uint64, ttl time.Duration) (*pdgc.GlobalGCBarrierInfo, error) {
597+
//TODO implement me
598+
return nil, errors.New("unimplemented")
599+
}
600+
601+
func (c gcStatesClient) GetAllKeyspacesGCStates(ctx context.Context) (pdgc.ClusterGCStates, error) {
602+
//TODO implement me
603+
return pdgc.ClusterGCStates{}, errors.New("unimplemented")
604+
}
605+
606+
// DeleteGlobalGCBarrier deletes a global GC barrier.
607+
func (c gcStatesClient) DeleteGlobalGCBarrier(_ context.Context, _ string) (*pdgc.GlobalGCBarrierInfo, error) {
608+
return nil, errors.New("unimplemented")
609+
}
610+
596611
func (c gcStatesClient) SetGCBarrier(ctx context.Context, barrierID string, barrierTS uint64, ttl time.Duration) (*pdgc.GCBarrierInfo, error) {
597612
if c.keyspaceID != constants.NullKeyspaceID {
598613
panic("unimplemented")

0 commit comments

Comments
 (0)