diff --git a/integration_tests/go.mod b/integration_tests/go.mod index 60d8a8b5..0e3112d8 100644 --- a/integration_tests/go.mod +++ b/integration_tests/go.mod @@ -8,13 +8,11 @@ require ( github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd github.com/pingcap/kvproto v0.0.0-20210712050333-b66fdbd6bfd5 github.com/pingcap/parser v0.0.0-20210707071004-31c87e37af5c - github.com/pingcap/tidb v1.1.0-beta.0.20210702041526-83acf6a4ac28 + github.com/pingcap/tidb v1.1.0-beta.0.20210713072132-d696ce33a79e github.com/stretchr/testify v1.7.0 github.com/tikv/client-go/v2 v2.0.0 github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d go.uber.org/goleak v1.1.10 ) -replace github.com/pingcap/tidb => github.com/hanfei1991/tidb v1.0.1-0.20210712061812-27b38561e681 - replace github.com/tikv/client-go/v2 => ../ diff --git a/integration_tests/go.sum b/integration_tests/go.sum index 40fa5d2f..d6ea2ef9 100644 --- a/integration_tests/go.sum +++ b/integration_tests/go.sum @@ -265,8 +265,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.12.1 h1:zCy2xE9ablevUOrUZc3Dl72Dt+ya2FNAvC2yLYMHzi4= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69/go.mod h1:YLEMZOtU+AZ7dhN9T/IpGhXVGly2bvkJQ+zxj3WeVQo= -github.com/hanfei1991/tidb v1.0.1-0.20210712061812-27b38561e681 h1:YHateRrJ7gARmABFDp1C6PptXa7fzQjgnz/WX+3Q9eM= -github.com/hanfei1991/tidb v1.0.1-0.20210712061812-27b38561e681/go.mod h1:JFDQNfRCRYGH+ZlBeI7Idh870p2vkqb8BXXFK6c0T0s= github.com/hashicorp/go-uuid v0.0.0-20180228145832-27454136f036/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -438,6 +436,8 @@ github.com/pingcap/parser v0.0.0-20210707071004-31c87e37af5c/go.mod h1:Ek0mLKEqU github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= github.com/pingcap/sysutil v0.0.0-20210315073920-cc0985d983a3 h1:A9KL9R+lWSVPH8IqUuH1QSTRJ5FGoY1bT2IcfPKsWD8= github.com/pingcap/sysutil v0.0.0-20210315073920-cc0985d983a3/go.mod h1:tckvA041UWP+NqYzrJ3fMgC/Hw9wnmQ/tUkp/JaHly8= +github.com/pingcap/tidb v1.1.0-beta.0.20210713072132-d696ce33a79e h1:2ECwaLCOeG+9vpndk0jGOyv2kOscQbSCxW+l1vcniQE= +github.com/pingcap/tidb v1.1.0-beta.0.20210713072132-d696ce33a79e/go.mod h1:VzQZEwPMWZISKvtmE9YbAnYFAzpZLK7puFvVJw5AKPY= github.com/pingcap/tidb-dashboard v0.0.0-20210312062513-eef5d6404638/go.mod h1:OzFN8H0EDMMqeulPhPMw2i2JaiZWOKFQ7zdRPhENNgo= github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible h1:ceznmu/lLseGHP/jKyOa/3u/5H3wtLLLqkH2V3ssSjg= github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= diff --git a/internal/unionstore/memdb_test.go b/internal/unionstore/memdb_test.go index 73f2f4ad..19f09bea 100644 --- a/internal/unionstore/memdb_test.go +++ b/internal/unionstore/memdb_test.go @@ -718,7 +718,6 @@ func TestNewIterator(t *testing.T) { // FnKeyCmp is the function for iterator the keys type FnKeyCmp func(key []byte) bool -// TODO: remove it since it is duplicated with kv.NextUtil // NextUntil applies FnKeyCmp to each entry of the iterator until meets some condition. // It will stop when fn returns true, or iterator is invalid or an error occurs. func NextUntil(it Iterator, fn FnKeyCmp) error { diff --git a/mockstore/cluster/stub.go b/mockstore/cluster/stub.go deleted file mode 100644 index d93d01b7..00000000 --- a/mockstore/cluster/stub.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 TiKV Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// See the License for the specific language governing permissions and -// limitations under the License. - -package cluster - -import "github.com/tikv/client-go/v2/internal/mockstore/cluster" - -// For backward campatibility. -// TODO: remove it. - -// Cluster simulates a TiKV cluster. -type Cluster = cluster.Cluster diff --git a/mockstore/mocktikv/stub.go b/mockstore/mocktikv/stub.go deleted file mode 100644 index 061f024b..00000000 --- a/mockstore/mocktikv/stub.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 TiKV Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// See the License for the specific language governing permissions and -// limitations under the License. - -package mocktikv - -import "github.com/tikv/client-go/v2/internal/mockstore/mocktikv" - -// For backward campatibility. -// TODO: remove it. - -// CoprRPCHandler is the interface to handle coprocessor RPC commands. -type CoprRPCHandler = mocktikv.CoprRPCHandler - -// MVCCStore is a mvcc key-value storage. -type MVCCStore = mocktikv.MVCCStore - -// MustNewMVCCStore creates a MVCCStore for testing. -var MustNewMVCCStore = mocktikv.MustNewMVCCStore - -// Pair is a KV pair read from MvccStore or an error if any occurs. -type Pair = mocktikv.Pair - -// Cluster simulates a TiKV cluster. -type Cluster = mocktikv.Cluster - -// RPCClient sends kv RPC calls to mock cluster. -type RPCClient = mocktikv.RPCClient - -// Session stores session scope rpc data. -type Session = mocktikv.Session - -// NewTiKVAndPDClient creates a TiKV client and PD client from options. -var NewTiKVAndPDClient = mocktikv.NewTiKVAndPDClient - -// BootstrapWithSingleStore initializes a Cluster with 1 Region and 1 Store. -var BootstrapWithSingleStore = mocktikv.BootstrapWithSingleStore - -// BootstrapWithMultiStores initializes a Cluster with 1 Region and n Stores. -var BootstrapWithMultiStores = mocktikv.BootstrapWithMultiStores - -// BootstrapWithMultiRegions initializes a Cluster with multiple Regions and 1 -// Store. The number of Regions will be len(splitKeys) + 1. -var BootstrapWithMultiRegions = mocktikv.BootstrapWithMultiRegions - -// ErrLocked is returned when trying to Read/Write on a locked key. Client should -// backoff or cleanup the lock then retry. -type ErrLocked = mocktikv.ErrLocked diff --git a/tikv/test_util.go b/tikv/test_util.go index cdf43d56..4e2779d7 100644 --- a/tikv/test_util.go +++ b/tikv/test_util.go @@ -35,9 +35,7 @@ package tikv import ( "github.com/google/uuid" "github.com/pingcap/errors" - "github.com/pingcap/failpoint" "github.com/tikv/client-go/v2/internal/locate" - "github.com/tikv/client-go/v2/util" pd "github.com/tikv/pd/client" ) @@ -64,19 +62,3 @@ func NewTestTiKVStore(client Client, pdClient pd.Client, clientHijack func(Clien tikvStore.mock = true return tikvStore, errors.Trace(err) } - -// MockCommitErrorEnable exports for gofail testing. -func MockCommitErrorEnable() { - failpoint.Enable(`tikvclient/mockCommitErrorOpt`, "return(true)") -} - -// MockCommitErrorDisable exports for gofail testing. -func MockCommitErrorDisable() { - failpoint.Disable(`tikvclient/mockCommitErrorOpt`) -} - -// IsMockCommitErrorEnable exports for gofail testing. -func IsMockCommitErrorEnable() bool { - _, err := util.EvalFailpoint(`mockCommitErrorOpt`) - return err == nil -}