lockwaiter

package
v0.0.0-...-7ad6a20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LockAlwaysWait = int64(0)
	LockNoWait     = int64(-1)
)

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

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(conf *config.Config) *Manager

func (*Manager) CleanUp

func (lw *Manager) CleanUp(w *Waiter)

CleanUp removes a waiter from waitingQueues when wait timeout.

func (*Manager) NewWaiter

func (lw *Manager) NewWaiter(startTS, lockTS, keyHash uint64, timeout time.Duration) *Waiter

Wait waits on a lock until waked by others or timeout.

func (*Manager) WakeUp

func (lw *Manager) WakeUp(txn, commitTS uint64, keyHashes []uint64)

WakeUp wakes up waiters that waiting on the transaction.

func (*Manager) WakeUpForDeadlock

func (lw *Manager) WakeUpForDeadlock(resp *deadlock.DeadlockResponse)

WakeUpDetection wakes up waiters waiting for deadlock detection results

type WaitResult

type WaitResult struct {
	// WakeupSleepTime, -1 means the wait is already timeout, 0 means the lock will be granted to this waiter
	// others are the wake-up-delay-duration sleep time, in milliseconds
	WakeupSleepTime WakeupWaitTime
	CommitTS        uint64
	DeadlockResp    *deadlock.DeadlockResponse
}

type Waiter

type Waiter struct {
	LockTS   uint64
	KeyHash  uint64
	CommitTs uint64
	// contains filtered or unexported fields
}

func (*Waiter) DrainCh

func (w *Waiter) DrainCh()

func (*Waiter) Wait

func (w *Waiter) Wait() WaitResult

type WakeupWaitTime

type WakeupWaitTime int

WakeupWaitTime is the implementation of variable "wake-up-delay-duration"

const WaitTimeout WakeupWaitTime = -1
const WakeUpThisWaiter WakeupWaitTime = 0
const WakeupDelayTimeout WakeupWaitTime = 1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL