mocktikv: resolve misc dependencies (#24106)
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user