mirror of https://github.com/tikv/client-go.git
*: update tidb and cleanup unused code (#196)
This commit is contained in:
parent
afd913a985
commit
1c834e747b
|
@ -38,7 +38,6 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/tikv/client-go/v2/metrics"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/oracle"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
"github.com/tikv/client-go/v2/util"
|
||||
|
@ -198,7 +197,7 @@ func (s *testOnePCSuite) Test1PCIsolation() {
|
|||
|
||||
func (s *testOnePCSuite) Test1PCDisallowMultiRegion() {
|
||||
// This test doesn't support tikv mode.
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -266,7 +265,7 @@ func (s *testOnePCSuite) Test1PCLinearizability() {
|
|||
|
||||
func (s *testOnePCSuite) Test1PCWithMultiDC() {
|
||||
// It requires setting placement rules to run with TiKV
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ import (
|
|||
"github.com/pingcap/parser/terror"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tikverr "github.com/tikv/client-go/v2/error"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
"github.com/tikv/client-go/v2/util"
|
||||
)
|
||||
|
@ -69,7 +68,7 @@ func (s *testAsyncCommitFailSuite) TearDownTest() {
|
|||
// committing primary region task.
|
||||
func (s *testAsyncCommitFailSuite) TestFailAsyncCommitPrewriteRpcErrors() {
|
||||
// This test doesn't support tikv mode because it needs setting failpoint in unistore.
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -101,7 +100,7 @@ func (s *testAsyncCommitFailSuite) TestFailAsyncCommitPrewriteRpcErrors() {
|
|||
|
||||
func (s *testAsyncCommitFailSuite) TestAsyncCommitPrewriteCancelled() {
|
||||
// This test doesn't support tikv mode because it needs setting failpoint in unistore.
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -161,7 +160,7 @@ func (s *testAsyncCommitFailSuite) TestPointGetWithAsyncCommit() {
|
|||
|
||||
func (s *testAsyncCommitFailSuite) TestSecondaryListInPrimaryLock() {
|
||||
// This test doesn't support tikv mode.
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ import (
|
|||
"github.com/pingcap/tidb/store/mockstore/unistore"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tikverr "github.com/tikv/client-go/v2/error"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/mockstore/cluster"
|
||||
"github.com/tikv/client-go/v2/oracle"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
|
@ -67,7 +66,7 @@ type testAsyncCommitCommon struct {
|
|||
}
|
||||
|
||||
func (s *testAsyncCommitCommon) setUpTest() {
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
s.store = NewTestStore(s.T())
|
||||
return
|
||||
}
|
||||
|
@ -228,7 +227,7 @@ func (s *testAsyncCommitSuite) lockKeysWithAsyncCommit(keys, values [][]byte, pr
|
|||
|
||||
func (s *testAsyncCommitSuite) TestCheckSecondaries() {
|
||||
// This test doesn't support tikv mode.
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -435,7 +434,7 @@ func (s *testAsyncCommitSuite) TestAsyncCommitLinearizability() {
|
|||
// TestAsyncCommitWithMultiDC tests that async commit can only be enabled in global transactions
|
||||
func (s *testAsyncCommitSuite) TestAsyncCommitWithMultiDC() {
|
||||
// It requires setting placement rules to run with TiKV
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd
|
||||
github.com/pingcap/kvproto v0.0.0-20210611081648-a215b4e61d2f
|
||||
github.com/pingcap/parser v0.0.0-20210618053735-57843e8185c4
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20210630013525-0e1420db12d4
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20210630084325-e8af6eb0adec
|
||||
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
|
||||
|
|
|
@ -433,8 +433,8 @@ github.com/pingcap/parser v0.0.0-20210618053735-57843e8185c4/go.mod h1:xZC8I7bug
|
|||
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.20210630013525-0e1420db12d4 h1:x087K40I4zm9hUo7BmJk1q52O7DPPmv8tfnDXIYHkBU=
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20210630013525-0e1420db12d4/go.mod h1:bszEbe/WvvmVFNh4BVjyb/8YDjlA7IxweZLQy+EVBmk=
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20210630084325-e8af6eb0adec h1:tXST/5Q0YnPOm70meDfkxCvwK39+aN2fdQOSDEw0+Ko=
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20210630084325-e8af6eb0adec/go.mod h1:6lc1Xx//CQuv5mdJmxKVtxA3dT5FUbRk3aOrtaqqJBA=
|
||||
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=
|
||||
|
|
|
@ -42,7 +42,6 @@ import (
|
|||
"github.com/pingcap/tidb/store/mockstore/unistore"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tikverr "github.com/tikv/client-go/v2/error"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
)
|
||||
|
||||
|
@ -84,7 +83,7 @@ func (s *testSnapshotFailSuite) TearDownTest() {
|
|||
|
||||
func (s *testSnapshotFailSuite) TestBatchGetResponseKeyError() {
|
||||
// Meaningless to test with tikv because it has a mock key error
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -112,7 +111,7 @@ func (s *testSnapshotFailSuite) TestBatchGetResponseKeyError() {
|
|||
|
||||
func (s *testSnapshotFailSuite) TestScanResponseKeyError() {
|
||||
// Meaningless to test with tikv because it has a mock key error
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ import (
|
|||
"github.com/pingcap/tidb/kv"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tikvstore "github.com/tikv/client-go/v2/kv"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
)
|
||||
|
||||
|
@ -153,7 +152,7 @@ func (s *testTiclientSuite) TestLargeRequest() {
|
|||
}
|
||||
|
||||
func (s *testTiclientSuite) TestSplitRegionIn2PC() {
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
s.T().Skip("scatter will timeout with single node TiKV")
|
||||
}
|
||||
if israce.Race {
|
||||
|
|
|
@ -46,14 +46,14 @@ import (
|
|||
"github.com/pingcap/tidb/store/mockstore/unistore"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tikv/client-go/v2/config"
|
||||
"github.com/tikv/client-go/v2/mockstore"
|
||||
"github.com/tikv/client-go/v2/tikv"
|
||||
"github.com/tikv/client-go/v2/util/codec"
|
||||
pd "github.com/tikv/pd/client"
|
||||
)
|
||||
|
||||
var (
|
||||
pdAddrs = flag.String("pd-addrs", "127.0.0.1:2379", "pd addrs")
|
||||
withTiKV = flag.Bool("with-tikv", false, "run tests with TiKV cluster started. (not use the mock server)")
|
||||
pdAddrs = flag.String("pd-addrs", "127.0.0.1:2379", "pd addrs")
|
||||
)
|
||||
|
||||
// NewTestStore creates a KVStore for testing purpose.
|
||||
|
@ -62,7 +62,7 @@ func NewTestStore(t *testing.T) *tikv.KVStore {
|
|||
flag.Parse()
|
||||
}
|
||||
|
||||
if *mockstore.WithTiKV {
|
||||
if *withTiKV {
|
||||
addrs := strings.Split(*pdAddrs, ",")
|
||||
pdClient, err := pd.NewClient(addrs, pd.SecurityOption{})
|
||||
require.Nil(t, err)
|
||||
|
|
|
@ -1,42 +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.
|
||||
|
||||
// NOTE: The code in this file is based on code from the
|
||||
// TiDB project, licensed under the Apache License v 2.0
|
||||
//
|
||||
// https://github.com/pingcap/tidb/tree/cc5e161ac06827589c4966674597c137cc9e809c/store/tikv/mockstore/test_suite.go
|
||||
//
|
||||
|
||||
// Copyright 2018 PingCAP, Inc.
|
||||
//
|
||||
// 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 mockstore
|
||||
|
||||
import (
|
||||
"flag"
|
||||
)
|
||||
|
||||
var (
|
||||
// WithTiKV is the flag which indicates whether it runs with tikv.
|
||||
WithTiKV = flag.Bool("with-tikv", false, "run tests with TiKV cluster started. (not use the mock server)")
|
||||
)
|
|
@ -1,25 +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 retry
|
||||
|
||||
import "github.com/tikv/client-go/v2/internal/retry"
|
||||
|
||||
// Re-export internal/retry for compatibility.
|
||||
// TODO: Remove it.
|
||||
|
||||
// NewNoopBackoff create a Backoffer do nothing just return error directly
|
||||
var NewNoopBackoff = retry.NewNoopBackoff
|
||||
|
||||
// BoTiFlashRPC is the backoff config for TiFlash RPCs.
|
||||
var BoTiFlashRPC = retry.BoTiFlashRPC
|
|
@ -1,35 +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 unionstore
|
||||
|
||||
import "github.com/tikv/client-go/v2/internal/unionstore"
|
||||
|
||||
// Re-export internal/unionstore for compatibility.
|
||||
// TODO: Remove it.
|
||||
|
||||
// Getter is the interface for the Get method.
|
||||
type Getter = unionstore.Getter
|
||||
|
||||
// Iterator is the interface for a iterator on KV store.
|
||||
type Iterator = unionstore.Iterator
|
||||
|
||||
// MemDB is rollbackable Red-Black Tree optimized for transaction states buffer use scenario.
|
||||
// You can think MemDB is a combination of two separate tree map, one for key => value and another for key => keyFlags.
|
||||
//
|
||||
// The value map is rollbackable, that means you can use the `Staging`, `Release` and `Cleanup` API to safely modify KVs.
|
||||
//
|
||||
// The flags map is not rollbackable. There are two types of flag, persistent and non-persistent.
|
||||
// When discarding a newly added KV in `Cleanup`, the non-persistent flags will be cleared.
|
||||
// If there are persistent flags associated with key, we will keep this key in node without value.
|
||||
type MemDB = unionstore.MemDB
|
Loading…
Reference in New Issue