Skip to content

Commit

Permalink
region_cache: support buckets
Browse files Browse the repository at this point in the history
Signed-off-by: youjiali1995 <[email protected]>
  • Loading branch information
youjiali1995 committed Mar 7, 2022
1 parent f43cc3a commit 423dc8b
Show file tree
Hide file tree
Showing 15 changed files with 721 additions and 121 deletions.
17 changes: 11 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/tikv/client-go/v2
go 1.16

require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2
github.com/gogo/protobuf v1.3.2
Expand All @@ -14,22 +15,26 @@ require (
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.18.1 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00
github.com/pingcap/failpoint v0.0.0-20220303073211-00fea37feb66
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989
github.com/pingcap/kvproto v0.0.0-20220106070556-3fa8fa04f898
github.com/pingcap/kvproto v0.0.0-20220304032058-ccd676426a27
github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_model v0.2.0
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/stretchr/testify v1.7.0
github.com/tikv/pd/client v0.0.0-20220216070739-26c668271201
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710
github.com/twmb/murmur3 v1.1.3
go.etcd.io/etcd/api/v3 v3.5.2
go.etcd.io/etcd/client/v3 v3.5.2
go.uber.org/atomic v1.9.0
go.uber.org/goleak v1.1.12
go.uber.org/zap v1.20.0
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/grpc v1.43.0
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 // indirect
google.golang.org/grpc v1.44.0
)
299 changes: 281 additions & 18 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions integration_tests/2pc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ func (s *testCommitterSuite) TestPrewritePrimaryKeyFailed() {
func (s *testCommitterSuite) TestWrittenKeysOnConflict() {
// This test checks that when there is a write conflict, written keys is collected,
// so we can use it to clean up keys.
region, _ := s.cluster.GetRegionByKey([]byte("x"))
region, _, _ := s.cluster.GetRegionByKey([]byte("x"))
newRegionID := s.cluster.AllocID()
newPeerID := s.cluster.AllocID()
s.cluster.Split(region.Id, newRegionID, []byte("y"), []uint64{newPeerID}, newPeerID)
Expand Down Expand Up @@ -561,7 +561,7 @@ func (s *testCommitterSuite) TestWrittenKeysOnConflict() {

func (s *testCommitterSuite) TestPrewriteTxnSize() {
// Prepare two regions first: (, 100) and [100, )
region, _ := s.cluster.GetRegionByKey([]byte{50})
region, _, _ := s.cluster.GetRegionByKey([]byte{50})
newRegionID := s.cluster.AllocID()
newPeerID := s.cluster.AllocID()
s.cluster.Split(region.Id, newRegionID, []byte{100}, []uint64{newPeerID}, newPeerID)
Expand Down Expand Up @@ -1118,8 +1118,8 @@ func (s *testCommitterSuite) TestCommitDeadLock() {
k1 := []byte("a_deadlock_k1")
k2 := []byte("y_deadlock_k2")

region1, _ := s.cluster.GetRegionByKey(k1)
region2, _ := s.cluster.GetRegionByKey(k2)
region1, _, _ := s.cluster.GetRegionByKey(k1)
region2, _, _ := s.cluster.GetRegionByKey(k2)
s.True(region1.Id != region2.Id)

txn1 := s.begin()
Expand Down Expand Up @@ -1279,7 +1279,7 @@ func (s *testCommitterSuite) TestResolveMixed() {
// accurate list of secondary keys.
func (s *testCommitterSuite) TestPrewriteSecondaryKeys() {
// Prepare two regions first: (, 100) and [100, )
region, _ := s.cluster.GetRegionByKey([]byte{50})
region, _, _ := s.cluster.GetRegionByKey([]byte{50})
newRegionID := s.cluster.AllocID()
newPeerID := s.cluster.AllocID()
s.cluster.Split(region.Id, newRegionID, []byte{100}, []uint64{newPeerID}, newPeerID)
Expand Down
8 changes: 5 additions & 3 deletions integration_tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ go 1.16
require (
github.com/ninedraft/israce v0.0.3
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00
github.com/pingcap/kvproto v0.0.0-20220215045702-d229fcc888c8
github.com/pingcap/failpoint v0.0.0-20220303073211-00fea37feb66
github.com/pingcap/kvproto v0.0.0-20220304032058-ccd676426a27
github.com/pingcap/tidb v1.1.0-beta.0.20220222031143-5988d0b2f46e
github.com/pingcap/tidb/parser v0.0.0-20220222031143-5988d0b2f46e // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
github.com/tikv/client-go/v2 v2.0.0
github.com/tikv/pd/client v0.0.0-20220216080339-1b8f82378ee7
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710
go.uber.org/goleak v1.1.12
)

replace github.com/tikv/client-go/v2 => ../

replace github.com/pingcap/tidb => github.com/youjiali1995/tidb v0.0.0-20220302091805-f23f8cf1818a
Loading

0 comments on commit 423dc8b

Please sign in to comment.