diff --git a/DEPS.bzl b/DEPS.bzl index 91adc5614dc12..02d66f4038ab1 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -7067,13 +7067,13 @@ def go_deps(): name = "com_github_tikv_client_go_v2", build_file_proto_mode = "disable_global", importpath = "github.com/tikv/client-go/v2", - sha256 = "e4953948d2346bf26d95fcc860b612c7c1d86f07c80a754db2551067912d37c8", - strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20231010061802-07432ef6c031", + sha256 = "1b4e8e9df95d2ed7ff41d756cd00c8159f0aa9483791b50af8afebefa94e5b6c", + strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20231025022411-cad314220659", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231010061802-07432ef6c031.zip", - "http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231010061802-07432ef6c031.zip", - "https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231010061802-07432ef6c031.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231010061802-07432ef6c031.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231025022411-cad314220659.zip", + "http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231025022411-cad314220659.zip", + "https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231025022411-cad314220659.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20231025022411-cad314220659.zip", ], ) go_repository( diff --git a/go.mod b/go.mod index 292a87898f21b..a9785a358bd3d 100644 --- a/go.mod +++ b/go.mod @@ -103,7 +103,7 @@ require ( github.com/stretchr/testify v1.8.4 github.com/tdakkota/asciicheck v0.2.0 github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 - github.com/tikv/client-go/v2 v2.0.8-0.20231010061802-07432ef6c031 + github.com/tikv/client-go/v2 v2.0.8-0.20231025022411-cad314220659 github.com/tikv/pd/client v0.0.0-20230912103610-2f57a9f050eb github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 github.com/twmb/murmur3 v1.1.6 diff --git a/go.sum b/go.sum index b94e413d9b828..472bfe3b09262 100644 --- a/go.sum +++ b/go.sum @@ -1027,8 +1027,8 @@ github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJf github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU= github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW93SG+q0F8KI+yFrcIDT4c/RNoc4= github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM= -github.com/tikv/client-go/v2 v2.0.8-0.20231010061802-07432ef6c031 h1:+D3p4UBbL1V3vCZ7FtaW9mZgeGq3U14+VfcHyiYn1mU= -github.com/tikv/client-go/v2 v2.0.8-0.20231010061802-07432ef6c031/go.mod h1:AjaU1PM3aVQih/zsYvc5sE9z7dAMxV+e881GNeZGTck= +github.com/tikv/client-go/v2 v2.0.8-0.20231025022411-cad314220659 h1:hAhyOHyCyuwEdSOdMOOc6EJ47JIDuvwYCVN+cxLduIU= +github.com/tikv/client-go/v2 v2.0.8-0.20231025022411-cad314220659/go.mod h1:SbuYRFuWsvtstvyzIjgbJkgDjVlthLlK1apa876+RpQ= github.com/tikv/pd/client v0.0.0-20230912103610-2f57a9f050eb h1:hAcH9tFjQzQ3+ofrAHm4ajOTLliYCOfXpj3+boKOtac= github.com/tikv/pd/client v0.0.0-20230912103610-2f57a9f050eb/go.mod h1:E+6qtPu8fJm5kNjvKWPVFqSgNAFPk07y2EjD03GWzuI= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= diff --git a/pkg/executor/chunk_size_control_test.go b/pkg/executor/chunk_size_control_test.go index e49b3491d2f5e..ac4e9b78f1d93 100644 --- a/pkg/executor/chunk_size_control_test.go +++ b/pkg/executor/chunk_size_control_test.go @@ -73,9 +73,9 @@ func manipulateCluster(cluster testutils.Cluster, splitKeys [][]byte) []uint64 { if len(splitKeys) == 0 { return nil } - region, _, _ := cluster.GetRegionByKey(splitKeys[0]) + region, _, _, _ := cluster.GetRegionByKey(splitKeys[0]) for _, key := range splitKeys { - if r, _, _ := cluster.GetRegionByKey(key); r.Id != region.Id { + if r, _, _, _ := cluster.GetRegionByKey(key); r.Id != region.Id { panic("all split keys should belong to the same region") } } diff --git a/pkg/executor/distsql_test.go b/pkg/executor/distsql_test.go index 64402e8911f2d..c883b178d1eb3 100644 --- a/pkg/executor/distsql_test.go +++ b/pkg/executor/distsql_test.go @@ -103,7 +103,7 @@ func TestCopClientSend(t *testing.T) { // Split one region. key := tablecodec.EncodeRowKeyWithHandle(tblID, kv.IntHandle(500)) - region, _, _ := cluster.GetRegionByKey(key) + region, _, _, _ := cluster.GetRegionByKey(key) peerID := cluster.AllocID() cluster.Split(region.GetId(), cluster.AllocID(), key, []uint64{peerID}, peerID) diff --git a/pkg/store/gcworker/gc_worker_test.go b/pkg/store/gcworker/gc_worker_test.go index 944417dcfe006..3a571515c4397 100644 --- a/pkg/store/gcworker/gc_worker_test.go +++ b/pkg/store/gcworker/gc_worker_test.go @@ -1163,7 +1163,7 @@ func TestResolveLockRangeMeetRegionEnlargeCausedByRegionMerge(t *testing.T) { tikvStore: s.tikvStore, scanLocks: func(_ []*txnlock.Lock, key []byte) ([]*txnlock.Lock, *tikv.KeyLocation) { // first time scan locks - region, _, _ := s.cluster.GetRegionByKey(key) + region, _, _, _ := s.cluster.GetRegionByKey(key) if region.GetId() == s.initRegion.regionID { return []*txnlock.Lock{{Key: []byte("a")}, {Key: []byte("b")}}, &tikv.KeyLocation{ diff --git a/pkg/store/mockstore/unistore/tikv/mock_region.go b/pkg/store/mockstore/unistore/tikv/mock_region.go index 9ca2d782fb4eb..41a4da282cd37 100644 --- a/pkg/store/mockstore/unistore/tikv/mock_region.go +++ b/pkg/store/mockstore/unistore/tikv/mock_region.go @@ -243,7 +243,7 @@ func (rm *MockRegionManager) GetRegion(id uint64) *metapb.Region { } // GetRegionByKey gets a region by the key. -func (rm *MockRegionManager) GetRegionByKey(key []byte) (region *metapb.Region, peer *metapb.Peer, buckets *metapb.Buckets) { +func (rm *MockRegionManager) GetRegionByKey(key []byte) (region *metapb.Region, peer *metapb.Peer, buckets *metapb.Buckets, downPeers []*metapb.Peer) { rm.mu.RLock() defer rm.mu.RUnlock() rm.sortedRegions.AscendGreaterOrEqual(newBtreeSearchItem(key), func(item btree.Item) bool { @@ -255,9 +255,9 @@ func (rm *MockRegionManager) GetRegionByKey(key []byte) (region *metapb.Region, return false }) if region == nil || !rm.regionContainsKey(region, key) { - return nil, nil, nil + return nil, nil, nil, nil } - return proto.Clone(region).(*metapb.Region), proto.Clone(region.Peers[0]).(*metapb.Peer), nil + return proto.Clone(region).(*metapb.Region), proto.Clone(region.Peers[0]).(*metapb.Peer), nil, nil } // GetRegionByEndKey gets a region by the end key. @@ -722,8 +722,8 @@ func (pd *MockPD) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, // GetRegion implements gRPC PDServer. func (pd *MockPD) GetRegion(ctx context.Context, key []byte, opts ...pdclient.GetRegionOption) (*pdclient.Region, error) { - r, p, b := pd.rm.GetRegionByKey(key) - return &pdclient.Region{Meta: r, Leader: p, Buckets: b}, nil + r, p, b, d := pd.rm.GetRegionByKey(key) + return &pdclient.Region{Meta: r, Leader: p, Buckets: b, DownPeers: d}, nil } // GetRegionByID implements gRPC PDServer. diff --git a/tests/realtikvtest/pessimistictest/pessimistic_test.go b/tests/realtikvtest/pessimistictest/pessimistic_test.go index 09df963b08d55..910c6ec82f229 100644 --- a/tests/realtikvtest/pessimistictest/pessimistic_test.go +++ b/tests/realtikvtest/pessimistictest/pessimistic_test.go @@ -287,10 +287,10 @@ func TestSingleStatementRollback(t *testing.T) { tableStart := tablecodec.GenTableRecordPrefix(tblID) cluster.SplitKeys(tableStart, tableStart.PrefixNext(), 2) region1Key := codec.EncodeBytes(nil, tablecodec.EncodeRowKeyWithHandle(tblID, kv.IntHandle(1))) - region1, _, _ := cluster.GetRegionByKey(region1Key) + region1, _, _, _ := cluster.GetRegionByKey(region1Key) region1ID := region1.Id region2Key := codec.EncodeBytes(nil, tablecodec.EncodeRowKeyWithHandle(tblID, kv.IntHandle(3))) - region2, _, _ := cluster.GetRegionByKey(region2Key) + region2, _, _, _ := cluster.GetRegionByKey(region2Key) region2ID := region2.Id syncCh := make(chan bool)