tikv

package
v1.1.0-beta.0...-6d74071 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Follower = iota
	Leader
)

Follower will send detection rpc to Leader

Variables

View Source
var (
	InternalKeyPrefix        = []byte{0xff}
	InternalRegionMetaPrefix = append(InternalKeyPrefix, "region"...)
	InternalStoreMetaKey     = append(InternalKeyPrefix, "store"...)
	InternalSafePointKey     = append(InternalKeyPrefix, "safepoint"...)
)

InternalKey

Functions

func GetTS

func GetTS() (int64, int64)

GetTS gets a timestamp.

func InternalRegionMetaKey

func InternalRegionMetaKey(regionID uint64) []byte

InternalRegionMetaKey returns internal region meta key with the given region id.

func NewDBWriter

func NewDBWriter(bundle *mvcc.DBBundle) mvcc.DBWriter

NewDBWriter returns a new DBWriter.

Types

type Detector

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

Detector detects deadlock.

func NewDetector

func NewDetector(ttl time.Duration, urgentSize uint64, expireInterval time.Duration) *Detector

NewDetector creates a new Detector.

func (*Detector) CleanUp

func (d *Detector) CleanUp(txn uint64)

CleanUp removes the wait for entry for the transaction.

func (*Detector) CleanUpWaitFor

func (d *Detector) CleanUpWaitFor(txn, waitForTxn, keyHash uint64)

CleanUpWaitFor removes a key in the wait for entry for the transaction.

func (*Detector) Detect

func (d *Detector) Detect(sourceTxn, waitForTxn, keyHash uint64, diagCtx diagnosticContext) *kverrors.ErrDeadlock

Detect detects deadlock for the sourceTxn on a locked key.

type DetectorClient

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

DetectorClient represents a detector client.

func NewDetectorClient

func NewDetectorClient(waiterMgr *lockwaiter.Manager, pdClient pd.Client) *DetectorClient

NewDetectorClient will create a new detector util, entryTTL is used for recycling the lock wait edge in detector wait wap. chSize is the pending detection sending task size(used on non leader node)

func (*DetectorClient) CleanUp

func (dt *DetectorClient) CleanUp(startTs uint64)

CleanUp processes cleanup task on local detector user interfaces

func (*DetectorClient) CleanUpWaitFor

func (dt *DetectorClient) CleanUpWaitFor(txnTs, waitForTxn, keyHash uint64)

CleanUpWaitFor cleans up the specific wait edge in detector's wait map

func (*DetectorClient) Detect

func (dt *DetectorClient) Detect(txnTs uint64, waitForTxnTs uint64, keyHash uint64, key []byte, resourceGroupTag []byte)

Detect post the detection request to local deadlock detector or remote first region leader, the caller should use `waiter.ch` to receive possible deadlock response

type DetectorServer

type DetectorServer struct {
	Detector *Detector
	// contains filtered or unexported fields
}

DetectorServer represents a detector server.

func NewDetectorServer

func NewDetectorServer() *DetectorServer

NewDetectorServer creates local detector used by RPC detection handler

func (*DetectorServer) ChangeRole

func (ds *DetectorServer) ChangeRole(newRole int32)

ChangeRole changes the server role.

func (*DetectorServer) Detect

Detect detects deadlock.

func (*DetectorServer) IsLeader

func (ds *DetectorServer) IsLeader() bool

IsLeader returns whether the server is leader or not.

type GCCompactionFilter

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

GCCompactionFilter implements the badger.CompactionFilter interface.

func (*GCCompactionFilter) Filter

func (f *GCCompactionFilter) Filter(key, value, userMeta []byte) badger.Decision

Filter implements the badger.CompactionFilter interface. Since we use txn ts as badger version, we only need to filter Delete, Rollback and Op_Lock. It is called for the first valid version before safe point, older versions are discarded automatically.

func (*GCCompactionFilter) Guards

func (f *GCCompactionFilter) Guards() []badger.Guard

Guards implements the badger.CompactionFilter interface. Guards returns specifications that may splits the SST files A key is associated to a guard that has the longest matched Prefix.

type InnerServer

type InnerServer interface {
	Setup(pdClient pd.Client)
	Start(pdClient pd.Client) error
	Stop() error
	Raft(stream tikvpb.Tikv_RaftServer) error
	BatchRaft(stream tikvpb.Tikv_BatchRaftServer) error
	Snapshot(stream tikvpb.Tikv_SnapshotServer) error
}

InnerServer defines the inner server interface.

type LockPair

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

LockPair contains a pair of key and lock. It's used for reading through locks.

type MPPTaskHandlerMap

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

MPPTaskHandlerMap is a map of *cophandler.MPPTaskHandler.

type MVCCStore

type MVCCStore struct {
	DeadlockDetectCli *DetectorClient
	DeadlockDetectSvr *DetectorServer
	// contains filtered or unexported fields
}

MVCCStore is a wrapper of badger.DB to provide MVCC functions.

func NewMVCCStore

func NewMVCCStore(conf *config.Config, bundle *mvcc.DBBundle, dataDir string, safePoint *SafePoint,
	writer mvcc.DBWriter, pdClient pd.Client) *MVCCStore

NewMVCCStore creates a new MVCCStore

func (*MVCCStore) BatchGet

func (store *MVCCStore) BatchGet(reqCtx *requestCtx, keys [][]byte, version uint64) []*kvrpcpb.KvPair

BatchGet implements the MVCCStore interface.

func (*MVCCStore) CheckKeysLock

func (store *MVCCStore) CheckKeysLock(startTS uint64, resolved, committed []uint64, keys ...[]byte) ([]*LockPair, error)

CheckKeysLock implements the MVCCStore interface.

func (*MVCCStore) CheckKeysLockForRcCheckTS

func (store *MVCCStore) CheckKeysLockForRcCheckTS(startTS uint64, resolved []uint64, keys ...[]byte) error

CheckKeysLockForRcCheckTS is used to check version timestamp if `RcCheckTS` isolation level is used.

func (*MVCCStore) CheckRangeLock

func (store *MVCCStore) CheckRangeLock(startTS uint64, startKey, endKey []byte, resolved []uint64) error

CheckRangeLock implements the MVCCStore interface.

func (*MVCCStore) CheckSecondaryLocks

func (store *MVCCStore) CheckSecondaryLocks(reqCtx *requestCtx, keys [][]byte, startTS uint64) (SecondaryLocksStatus, error)

CheckSecondaryLocks implements the MVCCStore interface.

func (*MVCCStore) CheckTxnStatus

func (store *MVCCStore) CheckTxnStatus(reqCtx *requestCtx,
	req *kvrpcpb.CheckTxnStatusRequest) (txnStatusRes TxnStatus, err error)

CheckTxnStatus implements the MVCCStore interface.

func (*MVCCStore) Cleanup

func (store *MVCCStore) Cleanup(reqCtx *requestCtx, key []byte, startTS, currentTs uint64) error

Cleanup implements the MVCCStore interface.

func (*MVCCStore) Close

func (store *MVCCStore) Close() error

Close closes the MVCCStore.

func (*MVCCStore) Commit

func (store *MVCCStore) Commit(req *requestCtx, keys [][]byte, startTS, commitTS uint64) error

Commit implements the MVCCStore interface.

func (*MVCCStore) DeleteFileInRange

func (store *MVCCStore) DeleteFileInRange(start, end []byte)

DeleteFileInRange implements the MVCCStore interface.

func (*MVCCStore) Flush

func (store *MVCCStore) Flush(reqCtx *requestCtx, req *kvrpcpb.FlushRequest) error

Flush implements the MVCCStore interface.

func (*MVCCStore) Get

func (store *MVCCStore) Get(reqCtx *requestCtx, key []byte, version uint64) ([]byte, error)

Get implements the MVCCStore interface.

func (*MVCCStore) MvccGetByKey

func (store *MVCCStore) MvccGetByKey(reqCtx *requestCtx, key []byte) (*kvrpcpb.MvccInfo, error)

MvccGetByKey gets mvcc information using input key as rawKey

func (*MVCCStore) MvccGetByStartTs

func (store *MVCCStore) MvccGetByStartTs(reqCtx *requestCtx, startTs uint64) (*kvrpcpb.MvccInfo, []byte, error)

MvccGetByStartTs implements the MVCCStore interface.

func (*MVCCStore) PessimisticLock

func (store *MVCCStore) PessimisticLock(reqCtx *requestCtx, req *kvrpcpb.PessimisticLockRequest, resp *kvrpcpb.PessimisticLockResponse) (*lockwaiter.Waiter, error)

PessimisticLock will add pessimistic lock on key

func (*MVCCStore) PessimisticRollback

func (store *MVCCStore) PessimisticRollback(reqCtx *requestCtx, req *kvrpcpb.PessimisticRollbackRequest) error

PessimisticRollback implements the MVCCStore interface.

func (*MVCCStore) PessimisticRollbackWithScanFirst

func (store *MVCCStore) PessimisticRollbackWithScanFirst(reqCtx *requestCtx, req *kvrpcpb.PessimisticRollbackRequest) error

PessimisticRollbackWithScanFirst is used to scan the region first to collect related pessimistic locks and then pessimistic rollback them.

func (*MVCCStore) PhysicalScanLock

func (store *MVCCStore) PhysicalScanLock(startKey []byte, maxTS uint64, limit int) []*kvrpcpb.LockInfo

PhysicalScanLock implements the MVCCStore interface.

func (*MVCCStore) Prewrite

func (store *MVCCStore) Prewrite(reqCtx *requestCtx, req *kvrpcpb.PrewriteRequest) error

Prewrite implements the MVCCStore interface.

func (*MVCCStore) ReadBufferFromLock

func (store *MVCCStore) ReadBufferFromLock(startTS uint64, keys ...[]byte) []*kvrpcpb.KvPair

ReadBufferFromLock implements the MVCCStore interface.

func (*MVCCStore) ResolveLock

func (store *MVCCStore) ResolveLock(reqCtx *requestCtx, lockKeys [][]byte, startTS, commitTS uint64) error

ResolveLock implements the MVCCStore interface.

func (*MVCCStore) Rollback

func (store *MVCCStore) Rollback(reqCtx *requestCtx, keys [][]byte, startTS uint64) error

Rollback implements the MVCCStore interface.

func (*MVCCStore) Scan

func (store *MVCCStore) Scan(reqCtx *requestCtx, req *kvrpcpb.ScanRequest) []*kvrpcpb.KvPair

Scan implements the MVCCStore interface.

func (*MVCCStore) ScanLock

func (store *MVCCStore) ScanLock(reqCtx *requestCtx, maxTS uint64, limit int) ([]*kvrpcpb.LockInfo, error)

ScanLock implements the MVCCStore interface.

func (*MVCCStore) StartDeadlockDetection

func (store *MVCCStore) StartDeadlockDetection(isRaft bool)

StartDeadlockDetection implements the MVCCStore interface.

func (*MVCCStore) TxnHeartBeat

func (store *MVCCStore) TxnHeartBeat(reqCtx *requestCtx, req *kvrpcpb.TxnHeartBeatRequest) (lockTTL uint64, err error)

TxnHeartBeat implements the MVCCStore interface.

func (*MVCCStore) UpdateSafePoint

func (store *MVCCStore) UpdateSafePoint(safePoint uint64)

UpdateSafePoint implements the MVCCStore interface.

type MockPD

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

MockPD implements gRPC PDServer.

func NewMockPD

func NewMockPD(rm *MockRegionManager) *MockPD

NewMockPD returns a new MockPD.

func (*MockPD) AllocID

func (pd *MockPD) AllocID(ctx context.Context) (uint64, error)

AllocID implements gRPC PDServer.

func (*MockPD) AskBatchSplit

func (pd *MockPD) AskBatchSplit(ctx context.Context, region *metapb.Region, count int) (*pdpb.AskBatchSplitResponse, error)

AskBatchSplit implements gRPC PDServer.

func (*MockPD) AskSplit

func (pd *MockPD) AskSplit(ctx context.Context, region *metapb.Region) (*pdpb.AskSplitResponse, error)

AskSplit implements gRPC PDServer.

func (*MockPD) BatchScanRegions

func (pd *MockPD) BatchScanRegions(ctx context.Context, keyRanges []pdclient.KeyRange, limit int, opts ...pdclient.GetRegionOption) ([]*pdclient.Region, error)

BatchScanRegions scans regions in batch, return flattened regions. limit limits the maximum number of regions returned.

func (*MockPD) Bootstrap

func (pd *MockPD) Bootstrap(ctx context.Context, store *metapb.Store, region *metapb.Region) (*pdpb.BootstrapResponse, error)

Bootstrap implements gRPC PDServer.

func (*MockPD) Close

func (pd *MockPD) Close()

Close closes the MockPD.

func (*MockPD) GetAllStores

func (pd *MockPD) GetAllStores(ctx context.Context, opts ...pdclient.GetStoreOption) ([]*metapb.Store, error)

GetAllStores gets all stores from pd. The store may expire later. Caller is responsible for caching and taking care of store change.

func (*MockPD) GetClusterID

func (pd *MockPD) GetClusterID(ctx context.Context) uint64

GetClusterID implements gRPC PDServer.

func (*MockPD) GetExternalTimestamp

func (pd *MockPD) GetExternalTimestamp(ctx context.Context) (uint64, error)

GetExternalTimestamp returns external timestamp

func (*MockPD) GetGCSafePoint

func (pd *MockPD) GetGCSafePoint(ctx context.Context) (uint64, error)

GetGCSafePoint gets the gc safePoint

func (*MockPD) GetPrevRegion

func (pd *MockPD) GetPrevRegion(ctx context.Context, key []byte, opts ...pdclient.GetRegionOption) (*pdclient.Region, error)

GetPrevRegion gets the previous region and its leader Peer of the region where the key is located.

func (*MockPD) GetRegion

func (pd *MockPD) GetRegion(ctx context.Context, key []byte, opts ...pdclient.GetRegionOption) (*pdclient.Region, error)

GetRegion implements gRPC PDServer.

func (*MockPD) GetRegionByID

func (pd *MockPD) GetRegionByID(ctx context.Context, regionID uint64, opts ...pdclient.GetRegionOption) (*pdclient.Region, error)

GetRegionByID implements gRPC PDServer.

func (*MockPD) GetStore

func (pd *MockPD) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, error)

GetStore implements gRPC PDServer.

func (*MockPD) GetTS

func (pd *MockPD) GetTS(ctx context.Context) (int64, int64, error)

GetTS gets a timestamp from MockPD.

func (*MockPD) IsBootstrapped

func (pd *MockPD) IsBootstrapped(ctx context.Context) (bool, error)

IsBootstrapped implements gRPC PDServer.

func (*MockPD) PutStore

func (pd *MockPD) PutStore(ctx context.Context, store *metapb.Store) error

PutStore implements gRPC PDServer.

func (*MockPD) ReportBatchSplit

func (pd *MockPD) ReportBatchSplit(ctx context.Context, regions []*metapb.Region) error

ReportBatchSplit implements gRPC PDServer.

func (*MockPD) ReportRegion

func (pd *MockPD) ReportRegion(*pdpb.RegionHeartbeatRequest)

ReportRegion implements gRPC PDServer.

func (*MockPD) ScanRegions

func (pd *MockPD) ScanRegions(ctx context.Context, startKey []byte, endKey []byte, limit int, opts ...pdclient.GetRegionOption) ([]*pdclient.Region, error)

ScanRegions gets a list of regions, starts from the region that contains key. Limit limits the maximum number of regions returned. If a region has no leader, corresponding leader will be placed by a peer with empty value (PeerID is 0).

func (*MockPD) ScatterRegion

func (pd *MockPD) ScatterRegion(ctx context.Context, regionID uint64) error

ScatterRegion scatters the specified region. Should use it for a batch of regions, and the distribution of these regions will be dispersed. NOTICE: This method is the old version of ScatterRegions, you should use the later one as your first choice.

func (*MockPD) SetExternalTimestamp

func (pd *MockPD) SetExternalTimestamp(ctx context.Context, newTimestamp uint64) error

SetExternalTimestamp sets external timestamp

func (*MockPD) SetRegionHeartbeatResponseHandler

func (pd *MockPD) SetRegionHeartbeatResponseHandler(h func(*pdpb.RegionHeartbeatResponse))

SetRegionHeartbeatResponseHandler sets the region heartbeat.

func (*MockPD) StoreHeartbeat

func (pd *MockPD) StoreHeartbeat(ctx context.Context, stats *pdpb.StoreStats) error

StoreHeartbeat stores the heartbeat.

func (*MockPD) UpdateGCSafePoint

func (pd *MockPD) UpdateGCSafePoint(ctx context.Context, safePoint uint64) (uint64, error)

UpdateGCSafePoint implements gRPC PDServer. TiKV will check it and do GC themselves if necessary. If the given safePoint is less than the current one, it will not be updated. Returns the new safePoint after updating.

type MockRegionManager

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

MockRegionManager implements RegionManager interface.

func NewMockRegionManager

func NewMockRegionManager(bundle *mvcc.DBBundle, clusterID uint64, opts RegionOptions) (*MockRegionManager, error)

NewMockRegionManager returns a new MockRegionManager.

func (*MockRegionManager) AddPeer

func (rm *MockRegionManager) AddPeer(regionID, storeID, peerID uint64)

AddPeer adds a new Peer to the cluster.

func (*MockRegionManager) AddStore

func (rm *MockRegionManager) AddStore(storeID uint64, addr string, labels ...*metapb.StoreLabel)

AddStore adds a new Store to the cluster.

func (*MockRegionManager) AllocID

func (rm *MockRegionManager) AllocID() uint64

AllocID allocs an id.

func (*MockRegionManager) AllocIDs

func (rm *MockRegionManager) AllocIDs(n int) []uint64

AllocIDs allocs ids with the given number n.

func (*MockRegionManager) Bootstrap

func (rm *MockRegionManager) Bootstrap(stores []*metapb.Store, region *metapb.Region) error

Bootstrap implements gRPC PDServer

func (*MockRegionManager) Close

func (rm *MockRegionManager) Close() error

Close closes the MockRegionManager.

func (*MockRegionManager) GetAllStores

func (rm *MockRegionManager) GetAllStores() []*metapb.Store

GetAllStores gets all stores from pd. The store may expire later. Caller is responsible for caching and taking care of store change.

func (*MockRegionManager) GetRegion

func (rm *MockRegionManager) GetRegion(id uint64) *metapb.Region

GetRegion gets a region by the id.

func (*MockRegionManager) GetRegionByEndKey

func (rm *MockRegionManager) GetRegionByEndKey(key []byte) (region *metapb.Region, peer *metapb.Peer)

GetRegionByEndKey gets a region by the end key.

func (*MockRegionManager) GetRegionByKey

func (rm *MockRegionManager) GetRegionByKey(key []byte) (region *metapb.Region, peer *metapb.Peer, buckets *metapb.Buckets, downPeers []*metapb.Peer)

GetRegionByKey gets a region by the key.

func (*MockRegionManager) GetRegionFromCtx

func (rm *MockRegionManager) GetRegionFromCtx(ctx *kvrpcpb.Context) (RegionCtx, *errorpb.Error)

GetRegionFromCtx gets the region from the context.

func (*MockRegionManager) GetStoreAddrByStoreID

func (rm *MockRegionManager) GetStoreAddrByStoreID(storeID uint64) (string, error)

GetStoreAddrByStoreID gets a store address by the store id.

func (*MockRegionManager) GetStoreIDByAddr

func (rm *MockRegionManager) GetStoreIDByAddr(addr string) (uint64, error)

GetStoreIDByAddr gets a store id by the store address.

func (*MockRegionManager) GetStoreInfoFromCtx

func (rm *MockRegionManager) GetStoreInfoFromCtx(ctx *kvrpcpb.Context) (string, uint64, *errorpb.Error)

GetStoreInfoFromCtx gets the store info from the context.

func (*MockRegionManager) IsBootstrapped

func (rm *MockRegionManager) IsBootstrapped() (bool, error)

IsBootstrapped returns whether the MockRegionManager is bootstrapped or not.

func (*MockRegionManager) RemoveStore

func (rm *MockRegionManager) RemoveStore(storeID uint64)

RemoveStore removes a Store from the cluster.

func (*MockRegionManager) ScanRegions

func (rm *MockRegionManager) ScanRegions(startKey, endKey []byte, limit int, _ ...pdclient.GetRegionOption) []*pdclient.Region

ScanRegions gets a list of regions, starts from the region that contains key. Limit limits the maximum number of regions returned. If a region has no leader, corresponding leader will be placed by a peer with empty value (PeerID is 0).

func (*MockRegionManager) Split

func (rm *MockRegionManager) Split(regionID, newRegionID uint64, key []byte, peerIDs []uint64, leaderPeerID uint64)

Split splits a Region at the key (encoded) and creates new Region.

func (*MockRegionManager) SplitArbitrary

func (rm *MockRegionManager) SplitArbitrary(keys ...[]byte)

SplitArbitrary splits the cluster by the split point manually provided. The keys provided are raw key.

func (*MockRegionManager) SplitIndex

func (rm *MockRegionManager) SplitIndex(tableID, indexID int64, count int)

SplitIndex evenly splits the data in index into count regions.

func (*MockRegionManager) SplitKeys

func (rm *MockRegionManager) SplitKeys(start, end kv.Key, count int)

SplitKeys evenly splits the start, end key into "count" regions.

func (*MockRegionManager) SplitRaw

func (rm *MockRegionManager) SplitRaw(regionID, newRegionID uint64, rawKey []byte, peerIDs []uint64, leaderPeerID uint64) *metapb.Region

SplitRaw splits a Region at the key (not encoded) and creates new Region.

func (*MockRegionManager) SplitRegion

SplitRegion implements the RegionManager interface.

func (*MockRegionManager) SplitTable

func (rm *MockRegionManager) SplitTable(tableID int64, count int)

SplitTable evenly splits the data in table into count regions.

type RegionCtx

type RegionCtx interface {
	Meta() *metapb.Region
	Diff() *int64
	RawStart() []byte
	RawEnd() []byte
	AcquireLatches(hashes []uint64)
	ReleaseLatches(hashes []uint64)
}

RegionCtx defines the region context interface.

type RegionError

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

RegionError represents a region error

func (*RegionError) Error

func (regionError *RegionError) Error() string

Error implements Error method.

type RegionManager

type RegionManager interface {
	GetRegionFromCtx(ctx *kvrpcpb.Context) (RegionCtx, *errorpb.Error)
	GetStoreInfoFromCtx(ctx *kvrpcpb.Context) (string, uint64, *errorpb.Error)
	SplitRegion(req *kvrpcpb.SplitRegionRequest) *kvrpcpb.SplitRegionResponse
	GetStoreIDByAddr(addr string) (uint64, error)
	GetStoreAddrByStoreID(storeID uint64) (string, error)
	Close() error
}

RegionManager defines the region manager interface.

type RegionOptions

type RegionOptions struct {
	StoreAddr  string
	PDAddr     string
	RegionSize int64
}

RegionOptions represents the region options.

type SafePoint

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

SafePoint represents a safe point.

func (*SafePoint) CreateCompactionFilter

func (sp *SafePoint) CreateCompactionFilter(targetLevel int, startKey, endKey []byte) badger.CompactionFilter

CreateCompactionFilter implements badger.CompactionFilterFactory function.

func (*SafePoint) UpdateTS

func (sp *SafePoint) UpdateTS(ts uint64)

UpdateTS is used to record the timestamp of updating the table's schema information. These changing schema operations don't include 'truncate table' and 'rename table'.

type SecondaryLocksStatus

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

SecondaryLocksStatus is the result of `CheckSecondaryLocksStatus` API.

type Server

type Server struct {
	// After updating the kvproto, some methods of TikvServer are not implemented.
	// Construct `Server` based on `UnimplementedTikvServer`, in order to compile successfully
	tikvpb.UnimplementedTikvServer

	RPCClient client.Client
	// contains filtered or unexported fields
}

Server implements the tikvpb.TikvServer interface.

func NewServer

func NewServer(rm RegionManager, store *MVCCStore, innerServer InnerServer) *Server

NewServer returns a new server.

func (*Server) BatchCommands

func (svr *Server) BatchCommands(stream tikvpb.Tikv_BatchCommandsServer) error

BatchCommands implements the TiKVServer interface.

func (*Server) BatchCoprocessor

func (svr *Server) BatchCoprocessor(req *coprocessor.BatchRequest, batchCopServer tikvpb.Tikv_BatchCoprocessorServer) error

BatchCoprocessor implements the tikvpb.TikvServer interface.

func (*Server) BatchRaft

func (svr *Server) BatchRaft(stream tikvpb.Tikv_BatchRaftServer) error

BatchRaft implements the tikvpb.TikvServer interface.

func (*Server) CancelMPPTask

func (svr *Server) CancelMPPTask(_ context.Context, _ *mpp.CancelTaskRequest) (*mpp.CancelTaskResponse, error)

CancelMPPTask implements the tikvpb.TikvServer interface.

func (*Server) CheckLeader

CheckLeader implements the tikvpb.TikvServer interface.

func (*Server) CheckLockObserver

CheckLockObserver implements the tikvpb.TikvServer interface.

func (*Server) Compact

Compact implements the tikvpb.TikvServer interface.

func (*Server) Coprocessor

func (svr *Server) Coprocessor(ctx context.Context, req *coprocessor.Request) (*coprocessor.Response, error)

Coprocessor implements the tikvpb.TikvServer interface.

func (*Server) CoprocessorStream

CoprocessorStream implements the tikvpb.TikvServer interface.

func (*Server) CreateMPPTaskHandler

func (svr *Server) CreateMPPTaskHandler(meta *mpp.TaskMeta, storeID uint64) (*cophandler.MPPTaskHandler, error)

CreateMPPTaskHandler implements the tikvpb.TikvServer interface.

func (*Server) Detect

func (svr *Server) Detect(stream deadlockPb.Deadlock_DetectServer) error

Detect will handle detection rpc from other nodes

func (*Server) DispatchMPPTask

func (svr *Server) DispatchMPPTask(_ context.Context, _ *mpp.DispatchTaskRequest) (*mpp.DispatchTaskResponse, error)

DispatchMPPTask implements the tikvpb.TikvServer interface.

func (*Server) DispatchMPPTaskWithStoreID

func (svr *Server) DispatchMPPTaskWithStoreID(ctx context.Context, req *mpp.DispatchTaskRequest, storeID uint64) (*mpp.DispatchTaskResponse, error)

DispatchMPPTaskWithStoreID implements the tikvpb.TikvServer interface.

func (*Server) EstablishMPPConnection

EstablishMPPConnection implements the tikvpb.TikvServer interface.

func (*Server) EstablishMPPConnectionWithStoreID

func (svr *Server) EstablishMPPConnectionWithStoreID(req *mpp.EstablishMPPConnectionRequest, server tikvpb.Tikv_EstablishMPPConnectionServer, storeID uint64) error

EstablishMPPConnectionWithStoreID implements the tikvpb.TikvServer interface.

func (*Server) GetLockWaitHistory

GetLockWaitHistory implements the tikvpb.TikvServer interface.

func (*Server) GetLockWaitInfo

GetLockWaitInfo implements the tikvpb.TikvServer interface.

func (*Server) GetMPPTaskHandler

func (svr *Server) GetMPPTaskHandler(taskID int64, storeID uint64) (*cophandler.MPPTaskHandler, error)

GetMPPTaskHandler implements the tikvpb.TikvServer interface.

func (*Server) GetStoreAddrByStoreID

func (svr *Server) GetStoreAddrByStoreID(storeID uint64) (string, error)

GetStoreAddrByStoreID gets a store address by the store id.

func (*Server) GetStoreIDByAddr

func (svr *Server) GetStoreIDByAddr(addr string) (uint64, error)

GetStoreIDByAddr gets a store id by the store address.

func (*Server) GetStoreSafeTS

GetStoreSafeTS implements the tikvpb.TikvServer interface.

func (*Server) GetWaitForEntries

GetWaitForEntries tries to get the waitFor entries deadlock detection related services

func (*Server) IsAlive

func (svr *Server) IsAlive(_ context.Context, _ *mpp.IsAliveRequest) (*mpp.IsAliveResponse, error)

IsAlive implements the tikvpb.TikvServer interface.

func (*Server) KVPessimisticRollback

KVPessimisticRollback implements the tikvpb.TikvServer interface.

func (*Server) KvBatchGet

func (svr *Server) KvBatchGet(ctx context.Context, req *kvrpcpb.BatchGetRequest) (*kvrpcpb.BatchGetResponse, error)

KvBatchGet implements the tikvpb.TikvServer interface.

func (*Server) KvBatchRollback

KvBatchRollback implements the tikvpb.TikvServer interface.

func (*Server) KvBufferBatchGet

KvBufferBatchGet implements the tikvpb.TikvServer interface.

func (*Server) KvCheckSecondaryLocks

KvCheckSecondaryLocks implements the tikvpb.TikvServer interface.

func (*Server) KvCheckTxnStatus

KvCheckTxnStatus implements the tikvpb.TikvServer interface.

func (*Server) KvCleanup

func (svr *Server) KvCleanup(ctx context.Context, req *kvrpcpb.CleanupRequest) (*kvrpcpb.CleanupResponse, error)

KvCleanup implements the tikvpb.TikvServer interface.

func (*Server) KvCommit

func (svr *Server) KvCommit(ctx context.Context, req *kvrpcpb.CommitRequest) (*kvrpcpb.CommitResponse, error)

KvCommit implements the tikvpb.TikvServer interface.

func (*Server) KvDeleteRange

KvDeleteRange implements the tikvpb.TikvServer interface.

func (*Server) KvFlush

func (svr *Server) KvFlush(ctx context.Context, req *kvrpcpb.FlushRequest) (*kvrpcpb.FlushResponse, error)

KvFlush implements the tikvpb.TikvServer interface.

func (*Server) KvGC

func (svr *Server) KvGC(ctx context.Context, req *kvrpcpb.GCRequest) (*kvrpcpb.GCResponse, error)

KvGC implements the tikvpb.TikvServer interface.

func (*Server) KvGet

func (svr *Server) KvGet(ctx context.Context, req *kvrpcpb.GetRequest) (*kvrpcpb.GetResponse, error)

KvGet implements the tikvpb.TikvServer interface.

func (*Server) KvImport

KvImport implements the tikvpb.TikvServer interface.

func (*Server) KvPessimisticLock

KvPessimisticLock implements the tikvpb.TikvServer interface.

func (*Server) KvPrewrite

func (svr *Server) KvPrewrite(ctx context.Context, req *kvrpcpb.PrewriteRequest) (*kvrpcpb.PrewriteResponse, error)

KvPrewrite implements the tikvpb.TikvServer interface.

func (*Server) KvResolveLock

KvResolveLock implements the tikvpb.TikvServer interface.

func (*Server) KvScan

func (svr *Server) KvScan(ctx context.Context, req *kvrpcpb.ScanRequest) (*kvrpcpb.ScanResponse, error)

KvScan implements the tikvpb.TikvServer interface.

func (*Server) KvScanLock

func (svr *Server) KvScanLock(ctx context.Context, req *kvrpcpb.ScanLockRequest) (*kvrpcpb.ScanLockResponse, error)

KvScanLock implements the tikvpb.TikvServer interface.

func (*Server) KvTxnHeartBeat

KvTxnHeartBeat implements the tikvpb.TikvServer interface.

func (*Server) MvccGetByKey

MvccGetByKey implements the tikvpb.TikvServer interface.

func (*Server) MvccGetByStartTs

MvccGetByStartTs implements the tikvpb.TikvServer interface.

func (*Server) PhysicalScanLock

PhysicalScanLock implements the tikvpb.TikvServer interface.

func (*Server) Raft

func (svr *Server) Raft(stream tikvpb.Tikv_RaftServer) error

Raft implements the tikvpb.TikvServer interface.

func (*Server) RawBatchDelete

RawBatchDelete implements the tikvpb.TikvServer interface.

func (*Server) RawBatchGet

RawBatchGet implements the tikvpb.TikvServer interface.

func (*Server) RawBatchPut

RawBatchPut implements the tikvpb.TikvServer interface.

func (*Server) RawBatchScan

RawBatchScan implements the tikvpb.TikvServer interface.

func (*Server) RawChecksum

RawChecksum implements the tikvpb.TikvServer interface.

func (*Server) RawCompareAndSwap

func (svr *Server) RawCompareAndSwap(context.Context, *kvrpcpb.RawCASRequest) (*kvrpcpb.RawCASResponse, error)

RawCompareAndSwap implements the tikvpb.TikvServer interface.

func (*Server) RawCoprocessor

RawCoprocessor implements the tikvpb.TikvServer interface.

func (*Server) RawDelete

RawDelete implements the tikvpb.TikvServer interface.

func (*Server) RawDeleteRange

RawDeleteRange implements the tikvpb.TikvServer interface.

func (*Server) RawGet

RawGet implements the tikvpb.TikvServer interface.

func (*Server) RawGetKeyTTL

RawGetKeyTTL implements the tikvpb.TikvServer interface.

func (*Server) RawPut

RawPut implements the tikvpb.TikvServer interface.

func (*Server) RawScan

RawScan implements the tikvpb.TikvServer interface.

func (*Server) ReadIndex

ReadIndex implements the tikvpb.TikvServer interface.

func (*Server) RegisterLockObserver

RegisterLockObserver implements the tikvpb.TikvServer interface.

func (*Server) RemoveLockObserver

RemoveLockObserver implements the tikvpb.TikvServer interface.

func (*Server) RemoveMPPTaskHandler

func (svr *Server) RemoveMPPTaskHandler(taskID int64, storeID uint64) error

RemoveMPPTaskHandler implements the tikvpb.TikvServer interface.

func (*Server) Snapshot

func (svr *Server) Snapshot(stream tikvpb.Tikv_SnapshotServer) error

Snapshot implements the tikvpb.TikvServer interface.

func (*Server) SplitRegion

SplitRegion implements the tikvpb.TikvServer interface.

func (*Server) Stop

func (svr *Server) Stop()

Stop stops the server.

func (*Server) StoreBatchCoprocessor

func (svr *Server) StoreBatchCoprocessor(ctx context.Context, req *coprocessor.Request) []*coprocessor.StoreBatchTaskResponse

StoreBatchCoprocessor handle batched tasks in the same store.

func (*Server) UnsafeDestroyRange

UnsafeDestroyRange implements the tikvpb.TikvServer interface.

type StandAloneRegionManager

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

StandAloneRegionManager represents a standalone region manager.

func NewStandAloneRegionManager

func NewStandAloneRegionManager(bundle *mvcc.DBBundle, opts RegionOptions, pdc pd.Client) *StandAloneRegionManager

NewStandAloneRegionManager returns a new standalone region manager.

func (*StandAloneRegionManager) Close

func (rm *StandAloneRegionManager) Close() error

Close closes the standalone region manager.

func (*StandAloneRegionManager) GetRegionFromCtx

func (rm *StandAloneRegionManager) GetRegionFromCtx(ctx *kvrpcpb.Context) (RegionCtx, *errorpb.Error)

func (*StandAloneRegionManager) GetStoreAddrByStoreID

func (rm *StandAloneRegionManager) GetStoreAddrByStoreID(storeID uint64) (string, error)

func (*StandAloneRegionManager) GetStoreIDByAddr

func (rm *StandAloneRegionManager) GetStoreIDByAddr(addr string) (uint64, error)

func (*StandAloneRegionManager) GetStoreInfoFromCtx

func (rm *StandAloneRegionManager) GetStoreInfoFromCtx(ctx *kvrpcpb.Context) (string, uint64, *errorpb.Error)

func (*StandAloneRegionManager) SplitRegion

SplitRegion splits a region.

type StandAlongInnerServer

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

StandAlongInnerServer implements the InnerServer interface.

func NewStandAlongInnerServer

func NewStandAlongInnerServer(bundle *mvcc.DBBundle) *StandAlongInnerServer

NewStandAlongInnerServer returns a new StandAlongInnerServer.

func (*StandAlongInnerServer) BatchRaft

BatchRaft implements the InnerServer BatchRaft method.

func (*StandAlongInnerServer) Raft

Raft implements the InnerServer Raft method.

func (*StandAlongInnerServer) Setup

func (is *StandAlongInnerServer) Setup(pdClient pd.Client)

Setup implements the InnerServer Setup method.

func (*StandAlongInnerServer) Snapshot

Snapshot implements the InnerServer Snapshot method.

func (*StandAlongInnerServer) Start

func (is *StandAlongInnerServer) Start(pdClient pd.Client) error

Start implements the InnerServer Start method.

func (*StandAlongInnerServer) Stop

func (is *StandAlongInnerServer) Stop() error

Stop implements the InnerServer Stop method.

type TxnStatus

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

TxnStatus is the result of `CheckTxnStatus` API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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