mocktikv: resolve misc dependencies (#24106)

This commit is contained in:
disksing
2021-04-19 15:07:52 +08:00
committed by GitHub
parent 1c45ce43b5
commit 9a407ed9f7
2 changed files with 12 additions and 6 deletions

View File

@ -27,14 +27,21 @@ import (
"github.com/pingcap/goleveldb/leveldb/util"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/store/tikv/logutil"
"github.com/pingcap/tidb/store/tikv/mockstore/deadlock"
"github.com/pingcap/tidb/store/tikv/oracle"
"github.com/pingcap/tidb/store/tikv/util/codec"
"github.com/pingcap/tidb/util/logutil"
"go.uber.org/zap"
)
// Used for pessimistic lock wait time
// these two constants are special for lock protocol with tikv
// 0 means always wait, -1 means nowait, others meaning lock wait in milliseconds
var (
LockAlwaysWait = int64(0)
LockNoWait = int64(-1)
)
// MVCCLevelDB implements the MVCCStore interface.
type MVCCLevelDB struct {
// Key layout:
@ -502,14 +509,14 @@ func (mvcc *MVCCLevelDB) PessimisticLock(req *kvrpcpb.PessimisticLockRequest) *k
if err != nil {
anyError = true
}
if lockWaitTime == kv.LockNoWait {
if lockWaitTime == LockNoWait {
if _, ok := err.(*ErrLocked); ok {
break
}
}
}
if anyError {
if lockWaitTime != kv.LockNoWait {
if lockWaitTime != LockNoWait {
// TODO: remove this when implement sever side wait.
simulateServerSideWaitLock(errs)
}

View File

@ -18,7 +18,6 @@ import (
"github.com/pingcap/kvproto/pkg/errorpb"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/tidb/ddl/placement"
)
// Session stores session scope rpc data.
@ -164,7 +163,7 @@ func (s *Session) checkKeyInRegion(key []byte) bool {
func isTiFlashStore(store *metapb.Store) bool {
for _, l := range store.GetLabels() {
if l.GetKey() == placement.EngineLabelKey && l.GetValue() == placement.EngineLabelTiFlash {
if l.GetKey() == "engine" && l.GetValue() == "tiflash" {
return true
}
}