package
9.0.0-alpha+incompatible
Repository: https://github.com/pingcap/tidb.git
Documentation: pkg.go.dev
# Functions
ApplyFlagsOps applys flagspos to origin.
BackOff Implements exponential backoff with full jitter.
FindKeysInStage returns all keys in the given stage that satisfies the given condition.
GenKeyExistsErr generates a ErrKeyExists, it concat the handle columns data with '-'.
GetInt64 get int64 value which created by IncInt64 method.
GetInternalSourceType get internal source.
GetMinInnerTxnStartTS get the min StartTS between startTSLowerLimit and curMinStartTS in globalInnerTxnTsBox.
GetNewestMppVersion returns the mpp-version can be used in mpp plan.
IncInt64 increases the value for key k in kv store by step.
IsErrNotFound checks if err is a kind of NotFound error.
IsTxnRetryableError checks if the error could safely retry the transaction.
KeyRangeSliceMemUsage return the memory usage of []KeyRange.
NewCacheDB news the cacheDB.
NewCommonHandle creates a CommonHandle from a encoded bytes which is encoded by code.EncodeKey.
NewDefaultTxnScopeVar creates a default TxnScopeVar according to the config.
NewGlobalTxnScopeVar creates a Global TxnScopeVar.
NewHandleMap creates a new map for handle.
NewInjectedStore creates a InjectedStore with config.
NewLocalTxnScopeVar creates a Local TxnScopeVar with given real txnScope value.
NewMemAwareHandleMap creates a new map for handle.
NewNonParitionedKeyRangesWithHint constructs a new RequestRange for a non partitioned table with rou count hint.
NewNonPartitionedKeyRanges constructs a new RequestRange for a non-partitioned table.
NewPartitionedKeyRanges constructs a new RequestRange for partitioned table.
NewPartitionedKeyRangesWithHints constructs a new RequestRange for partitioned table with row count hint.
NewPartitionHandle creates a PartitionHandle from a normal handle and a pid.
NewResourceGroupTagBuilder creates a new ResourceGroupTagBuilder.
NewVariables create a new Variables instance with default values.
NewVersion creates a new Version struct.
NextUntil applies FnKeyCmp to each entry of the iterator until meets some condition.
PrintLongTimeInternalTxn print the internal transaction information.
RunInNewTxn will run the f in a new transaction environment, should be used by inner txn only.
SetCDCWriteSource sets the TiCDC write source in the txnSource.
SetLossyDDLReorgSource sets the lossy DDL reorg source in the txnSource.
SetTxnResourceGroup update the resource group name of target txn.
ToExchangeCompressionMode returns the ExchangeCompressionMode from name.
ToMppVersion transforms string to MppVersion.
WalkMemBuffer iterates all buffered kv pairs in memBuf.
# Constants
AssertionLevel controls how strict the assertions on data during transactions should be.
BackgroundGoroutineLifecycleHooks is the hooks to track the start and end of background goroutine.
BinlogInfo contains the binlog data and client.
CollectRuntimeStats is used to enable collect runtime stats.
CommitHook is a callback function called right after the transaction gets committed.
CommitTSUpperBoundCheck is used by cached table The commitTS must be greater than all the write lock lease of the visited cached table.
Enable1PC indicates whether one-phase commit is enabled.
EnableAsyncCommit indicates whether async commit is enabled.
ExchangeCompressionModeFast indicates fast compression/decompression speed, compression ratio is lower than HC mode.
ExchangeCompressionModeHC indicates high compression (HC) ratio mode.
ExchangeCompressionModeNONE indicates no compression.
ExchangeCompressionModeUnspecified indicates unspecified compress method, let TiDB choose one.
ExplicitRequestSourceType is a complement of RequestSourceType, it may specified by the client or users.
GlobalReplicaScope indicates the default replica scope for tidb to request.
GlobalTxnScope is synced with PD's define of global scope.
GuaranteeLinearizability indicates whether to guarantee linearizability at the cost of an extra tso request before prewrite.
InfoSchema is schema version used by txn startTS.
InternalDDLNotifier is the type of DDL notifier.
InternalDistTask is the type of distributed task.
InternalImportInto is the type of IMPORT INTO usage.
InternalLoadData is the type of LOAD DATA usage.
InternalTimer is the type of internal timer.
InternalTxnAdmin is the type of admin operations.
InternalTxnBackfillDDLPrefix is the prefix of the types of DDL operations needs backfilling.
InternalTxnBindInfo is the type of bind info txn.
InternalTxnBootstrap is the type of TiDB bootstrap txns.
InternalTxnBR is the type of BR usage.
InternalTxnCacheTable is the type of cache table usage.
InternalTxnDDL is the type of inner txns in ddl module.
InternalTxnGC is the type of GC txn.
InternalTxnLightning is the type of Lightning usage.
InternalTxnMeta is the type of the miscellaneous meta usage.
InternalTxnOthers is the type of requests that consume low resources.
InternalTxnPrivilege is the type of privilege txn.
InternalTxnStats is the type of statistics txn.
InternalTxnSysVar is the type of sys var txn.
InternalTxnTools is the type of tools usage of TiDB.
InternalTxnTrace handles the trace statement.
InternalTxnTTL is the type of TTL usage.
IsolationLevel sets isolation level for current transaction.
IsStalenessReadOnly indicates whether the transaction is staleness read only transaction.
KeyOnly retrieve only keys, it can be used in scan now.
KVFilter indicates the filter to ignore key-values in the transaction's memory buffer.
LightningPhysicalImportTxnSource the 17th bit is set as the txn source for Lightning physical import.
LoadBasedReplicaReadThreshold sets the TiKV wait duration threshold of enabling replica read automatically.
LocalTxnScope indicates the transaction should use local ts.
The bitmap: |RESERVED|LOSSY_DDL_REORG_SOURCE_BITS|CDC_WRITE_SOURCE_BITS| | 48 | 8 | 4(RESERVED) | 4 |.
MatchStoreLabels indicates the labels the store should be matched.
MppTaskCancelled means the task is cancelled.
MppTaskDone means the task is done.
MppTaskReady means the task is ready.
MppTaskRunning means the task is running.
MppVersionUnspecified means the illegal or unspecified version, it only used in TiDB.
MppVersionUnspecifiedName denotes name of UNSPECIFIED mpp version.
MppVersionV0 supports TiFlash version [~, ~].
MppVersionV1 supports TiFlash version [v6.6.x, ~].
MppVersionV2 supports TiFlash version [v7.3, ~], support ReportMPPTaskStatus service.
NotFillCache makes this request do not touch the LRU cache of the underlying storage.
Pessimistic is defined for pessimistic lock.
Priority marks the priority of this transaction.
Priority value for transaction priority.
Priority value for transaction priority.
Priority value for transaction priority.
RC stands for 'read committed'.
RCCheckTS stands for 'read consistency read with ts check'.
ReadReplicaScope.
RecommendedExchangeCompressionMode indicates recommended compression mode.
ReplicaRead Set replica read.
ReplicaReadAdjuster set the adjust function of cop requests.
ReplicaReadClosest stands for 'read from leader and follower which locates with the same zone'.
ReplicaReadClosestAdaptive stands for 'read from follower which locates in the same zone if the response size exceeds certain threshold'.
ReplicaReadFollower stands for 'read from follower'.
ReplicaReadLeader stands for 'read from leader'.
ReplicaReadLearner stands for 'read from learner'.
ReplicaReadMixed stands for 'read from leader and follower'.
ReplicaReadPreferLeader stands for 'read from leader and auto-turn to followers if leader is abnormal'.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
ReqTypes.
RequestSourceInternal set request source scope of transaction.
RequestSourceType set request source type of the current statement.
ResourceGroupName set the bind resource group name.
ResourceGroupTag indicates the resource group tag of the kv request.
ResourceGroupTagger can be used to set the ResourceGroupTag dynamically according to the request content.
RPCInterceptor is interceptor.RPCInterceptor on Transaction or Snapshot, used to decorate additional logic before and after the underlying client-go RPC request.
SampleStep skips 'SampleStep - 1' number of keys after each returned key.
ScanBatchSize set the iter scan batch size.
SchemaAmender is used to amend mutations for pessimistic transactions.
SchemaChecker is used for checking schema-validity.
SessionID marks the connection id, for logging and tracing.
SetAssertExist marks the associated key must exist.
SetAssertNone marks the associated key without any assert.
SetAssertNotExist marks the associated key must not exists.
SetAssertUnknown marks the associated key is unknown and can not apply other assertion.
SetNeedConstraintCheckInPrewrite sets the flag flagNeedConstraintCheckInPrewrite.
SetNeedLocked marks the associated key need to be acquired lock.
SetPresumeKeyNotExists marks the existence of the associated key is checked lazily.
SetPreviousPresumeKeyNotExists marks the PNE flag is set in previous statements, thus it cannot be unset when retrying or rolling back a statement.
SI stands for 'snapshot isolation'.
SizeLimits sets the size limits of membuf.
SizeofHandleMap presents the memory size of struct HandleMap.
SizeofStrHandleVal presents the memory size of struct strHandleVal.
SnapInterceptor is used for setting the interceptor for snapshot.
SnapshotTS is defined to set snapshot ts.
SyncLog is not used anymore.
TableToColumnMaps is a map from tableID to a series of maps.
TaskID Set task ID.
TiDB means the type of store engine is TiDB.
TiFlash means the type of store engine is TiFlash.
TiKV means the type of store engine is TiKV.
TiKVClientReadTimeout sets the timeout value for readonly kv request in milliseconds.
TimeToPrintLongTimeInternalTxn is the duration if the internal transaction lasts more than it, TiDB prints a log message.
TxnRetryableMark is used to uniform the commit error messages which could retry the transaction.
TxnScope indicates which @@txn_scope this transaction will work with.
TxnSource set the source of this transaction.
UnCommitIndexKVFlag uses to indicate the index key/value is no need to commit.
UnSpecified means the store engine type is unknown.
# Variables
DecodeTableIDFunc is used to decode table id from key.
ErrAssertionFailed is the error when an assertion fails.
ErrCannotSetNilValue is the error when sets an empty value.
ErrEntryTooLarge is the error when a key value entry is too large.
ErrInvalidTxn is the error when commits or rollbacks in an invalid transaction.
ErrKeyExists returns when key is already exist.
ErrKeyTooLarge is the error when a key is too large to be handled by MemBuffer.
ErrLockExpire is the error when the lock is expired.
ErrNotExist is used when try to get an entry with an unexist key from KV store.
ErrNotImplemented returns when a function is not implemented yet.
ErrTxnRetryable is used when KV store occurs retryable error which SQL layer can safely retry the transaction.
ErrTxnTooLarge is the error when transaction is too large, lock time reached the maximum value.
ErrWriteConflict is the error when the commit meets an write conflict error.
ErrWriteConflictInTiDB is the error when the commit meets an write conflict error when local latch is enabled.
InvalidStagingHandle is an invalid handler, MemBuffer will check handler to ensure safety.
LastActiveStagingHandle is an special handler which always point to the last active staging buffer.
MaxRetryCnt represents maximum retry times.
MaxVersion is the maximum version, notice that it's not a valid version.
MinVersion is the minimum version, it's not a valid version, too.
RequestSourceKey is used as the key of request source type in context.
TxnEntrySizeLimit is limit of single entry size (len(key) + len(value)).
TxnTotalSizeLimit is limit of the sum of all entry size.
WithInternalSourceAndTaskType create context with internal source and task name.
WithInternalSourceType create context with internal source.
# Structs
CancelMPPTasksParam represents parameter for MPPClient's CancelMPPTasks.
ClientSendOption wraps options during Client Send.
CommonHandle implements the Handle interface for non-int64 type handle.
DispatchMPPTaskParam represents parameter for MPPClient's DispatchMPPTask.
EmptyIterator is an iterator without any entry.
EmptyRetriever is a retriever without any entry.
Entry is the entry for key and value.
EstablishMPPConnsParam represents parameter for MPPClient's EstablishMPPConns.
HandleMap is the map for Handle.
InjectedSnapshot wraps a Snapshot with injections.
InjectedStore wraps a Storage with injections.
InjectedTransaction wraps a Transaction with injections.
InjectionConfig is used for fault injections for KV components.
KeyRange represents a range where StartKey <= key < EndKey.
KeyRanges wrap the ranges for partitioned table cases.
MemAwareHandleMap is similar to HandleMap, but it's aware of its memory usage and doesn't support delete.
MPPBuildTasksRequest request the stores allocation for a mpp plan fragment.
MPPDispatchRequest stands for a dispatching task.
MPPQueryID means the global unique id of a mpp query.
MPPTask means the minimum execution unit of a mpp computation job.
PartitionHandle combines a handle and a PartitionID, used to location a row in partitioned table.
PartitionIDAndRanges used by PartitionTableScan in tiflash.
ReportStatusRequest wraps mpp ReportStatusRequest.
Request represents a kv request.
RequestTypeSupportedChecker is used to check expression can be pushed down.
ResourceGroupTagBuilder is used to build the resource group tag for a kv request.
TxnScopeVar indicates the used txnScope for oracle.
TxnSizeLimits is the argument type for `SizeLimits` option.
Version is the wrapper of KV's version.
# Interfaces
AssertionProto is an interface defined for the assertion protocol.
BatchGetter is the interface for BatchGet.
Client is used to send request to KV layer.
Driver is the interface that must be implemented by a KV storage.
EtcdBackend is used for judging a storage is a real TiKV.
FairLockingController is the interface that defines fair locking related operations.
Getter is the interface for the Get method.
Handle is the ID of a row.
Iterator is the interface for a iterator on KV store.
MemBuffer is an in-memory kv collection, can be used to buffer write operations.
MPPClient accepts and processes mpp requests.
MppCoordinator describes the basic api for executing mpp physical plan.
MPPTaskMeta means the meta info such as location of a mpp task.
Mutator is the interface wraps the basic Set and Delete methods.
Response represents the response returned from KV layer.
ResultSubset represents a result subset from a single storage unit.
Retriever is the interface wraps the basic Get and Seek methods.
RetrieverMutator is the interface that groups Retriever and Mutator interfaces.
Snapshot defines the interface for the snapshot fetched from KV store.
SnapshotInterceptor is used to intercept snapshot's read operation.
SplittableStore is the kv store which supports split regions.
Storage defines the interface for storage.
StorageWithPD is used to get pd client.
Transaction defines the interface for operations inside a Transaction.
VersionProvider provides increasing IDs.
# Type aliases
CoprRequestAdjuster is used to check and adjust a copr request according to specific rules.
ExchangeCompressionMode means the compress method used in exchange operator.
FlagsOp describes KeyFlags modify operation.
FnKeyCmp is the function for iterator the keys.
IntHandle implement the Handle interface for int64 type handle.
IsoLevel is the transaction's isolation level.
Key represents high-level Key type.
KeyFlags are metadata associated with key.
LockCtx contains information for LockKeys method.
MppTaskStates denotes the state of mpp tasks.
MppVersion indicates the mpp-version used to build mpp plan.
ReplicaReadType is the type of replica to read data from.
RequestSource is the scope and type of the request and it's passed by go context.
StagingHandle is the reference of a staging buffer.
StoreType represents the type of storage engine.
Variables defines the variables used by KV storage.