Documentation ¶
Index ¶
- Constants
- Variables
- func CmpKey(k, another []byte) int
- func NextKey(k []byte) []byte
- func StrKey(k []byte) string
- type FlagsOp
- type KeyFlags
- func (f KeyFlags) AndPersistent() KeyFlags
- func (f KeyFlags) HasIgnoredIn2PC() bool
- func (f KeyFlags) HasLocked() bool
- func (f KeyFlags) HasLockedValueExists() bool
- func (f KeyFlags) HasNeedCheckExists() bool
- func (f KeyFlags) HasNeedLocked() bool
- func (f KeyFlags) HasPresumeKeyNotExists() bool
- func (f KeyFlags) HasPrewriteOnly() bool
- type KeyRange
- type LockCtx
- type ReplicaReadType
- type ReturnedValue
- type Variables
Constants ¶
const ( DefBackoffLockFast = 100 DefBackOffWeight = 2 )
Default values
Variables ¶
var DefaultVars = NewVariables(&ignoreKill)
DefaultVars is the default variables instance.
var StoreLimit atomic.Int64
StoreLimit will update from config reload and global variable set.
Functions ¶
Types ¶
type FlagsOp ¶
type FlagsOp uint16
FlagsOp describes KeyFlags modify operation.
const ( // SetPresumeKeyNotExists marks the existence of the associated key is checked lazily. // Implies KeyFlags.HasNeedCheckExists() == true. SetPresumeKeyNotExists FlagsOp = 1 << iota // DelPresumeKeyNotExists reverts SetPresumeKeyNotExists. DelPresumeKeyNotExists // SetKeyLocked marks the associated key has acquired lock. SetKeyLocked // DelKeyLocked reverts SetKeyLocked. DelKeyLocked // SetNeedLocked marks the associated key need to be acquired lock. SetNeedLocked // DelNeedLocked reverts SetKeyNeedLocked. DelNeedLocked // SetKeyLockedValueExists marks the value exists when key has been locked in Transaction.LockKeys. SetKeyLockedValueExists // SetKeyLockedValueNotExists marks the value doesn't exists when key has been locked in Transaction.LockKeys. SetKeyLockedValueNotExists // DelNeedCheckExists marks the key no need to be checked in Transaction.LockKeys. DelNeedCheckExists // SetPrewriteOnly marks the key shouldn't be used in 2pc commit phase. SetPrewriteOnly // SetIgnoredIn2PC marks the key will be ignored in 2pc. SetIgnoredIn2PC )
type KeyFlags ¶
type KeyFlags uint8
KeyFlags are metadata associated with key
func ApplyFlagsOps ¶
ApplyFlagsOps applys flagspos to origin.
func (KeyFlags) AndPersistent ¶
AndPersistent returns the value of current flags&persistentFlags
func (KeyFlags) HasIgnoredIn2PC ¶
HasIgnoredIn2PC returns whether the key will be ignored in 2pc.
func (KeyFlags) HasLocked ¶
HasLocked returns whether the associated key has acquired pessimistic lock.
func (KeyFlags) HasLockedValueExists ¶
HasLockedValueExists returns whether the value exists when key locked.
func (KeyFlags) HasNeedCheckExists ¶
HasNeedCheckExists returns whether the key need to check existence when it has been locked.
func (KeyFlags) HasNeedLocked ¶
HasNeedLocked return whether the key needed to be locked
func (KeyFlags) HasPresumeKeyNotExists ¶
HasPresumeKeyNotExists returns whether the associated key use lazy check.
func (KeyFlags) HasPrewriteOnly ¶
HasPrewriteOnly returns whether the key should be used in 2pc commit phase.
type LockCtx ¶
type LockCtx struct { Killed *uint32 ForUpdateTS uint64 LockWaitTime int64 WaitStartTime time.Time PessimisticLockWaited *int32 LockKeysDuration *int64 LockKeysCount *int32 ReturnValues bool Values map[string]ReturnedValue ValuesLock sync.Mutex LockExpired *uint32 Stats *util.LockKeysDetails ResourceGroupTag []byte OnDeadlock func(*tikverr.ErrDeadlock) }
LockCtx contains information for LockKeys method.
func (*LockCtx) GetValueNotLocked ¶
GetValueNotLocked returns a value if the key is not already locked. (nil, false) means already locked.
func (*LockCtx) InitReturnValues ¶
InitReturnValues creates the map to store returned value.
func (*LockCtx) IterateValuesNotLocked ¶
IterateValuesNotLocked applies f to all key-values that are not already locked.
type ReplicaReadType ¶
type ReplicaReadType byte
ReplicaReadType is the type of replica to read data from
const ( // ReplicaReadLeader stands for 'read from leader'. ReplicaReadLeader ReplicaReadType = iota // ReplicaReadFollower stands for 'read from follower'. ReplicaReadFollower // ReplicaReadMixed stands for 'read from leader and follower and learner'. ReplicaReadMixed )
func (ReplicaReadType) IsFollowerRead ¶
func (r ReplicaReadType) IsFollowerRead() bool
IsFollowerRead checks if follower is going to be used to read data.
type ReturnedValue ¶
ReturnedValue pairs the Value and AlreadyLocked flag for PessimisticLock return values result.
type Variables ¶
type Variables struct { // BackoffLockFast specifies the LockFast backoff base duration in milliseconds. BackoffLockFast int // BackOffWeight specifies the weight of the max back off time duration. BackOffWeight int // Pointer to SessionVars.Killed // Killed is a flag to indicate that this query is killed. Killed *uint32 }
Variables defines the variables used by KV storage.
func NewVariables ¶
NewVariables create a new Variables instance with default values.