package
9.0.0-alpha+incompatible
Repository: https://github.com/pingcap/tidb.git
Documentation: pkg.go.dev
# Packages
package storewatch provides a `Watcher` type which allows the user to listen the events of lifetime of stores.
# Functions
AdaptTiKVBackoffer creates an "ad-hoc" backoffStrategy, which wraps a backoffer and provides some new functions: When backing off, we can manually provide it a specified sleep duration instead of directly provide a retry.Config Which is sealed in the "client-go/internal".
CatchAndLogPanic recovers when the execution get panicked, and log the panic.
CheckGCSafePoint checks whether the ts is older than GC safepoint.
CheckLogBackupTaskExist checks that whether log-backup is existed.
CheckStoreLiveness checks whether a store is still alive.
CompareBytesExt compare two byte sequences.
CompareEndKey compared two keys that BOTH represent the EXCLUSIVE ending of some range.
EncloseDBAndTable formats the database and table name in sql.
EncloseName formats name in sql.
GetImportTasksFrom try to get all the import tasks with prefix `RegisterTaskPrefix`.
GetOrZero returns the value pointed to by p, or a zero value of its type if p is nil.
GetSysDBCIStrName get the CIStr name of system DB.
GetSysDBName get the original name of system DB.
GetTidbNewCollationEnabled returns the variable name of NewCollationEnabled.
HandleUnknownBackupError UNSAFE! TODO: remove this method and map all the current unknown errors to error types.
InitialRetryState make the initial state for retrying.
IntersectAll returns the intersect of two set of segments.
IsLogBackupInUse checks the log backup task existed.
IsSysDB tests whether the database is system DB.
IsTemplateSysDB checks wheterh the dbname is temporary system database(__TiDB_BR_Temporary_mysql or __TiDB_BR_Temporary_sys).
IsTypeCompatible checks whether type target is compatible with type src they're compatible if - same null/not null and unsigned flag(maybe we can allow src not null flag, target null flag later) - have same evaluation type - target's flen and decimal should be bigger or equals to src's - elements in target is superset of elements in src if they're enum or set type - same charset and collate if they're string types.
LogBackupTaskCountDec decreases the count of log backup task.
LogBackupTaskCountInc increases the count of log backup task.
MakeSafePointID makes a unique safe point ID, for reduce name conflict.
MarshalBackupMeta converts the backupmeta strcture to JSON.
MessageIsRetryableStorageError checks whether the message returning from TiKV is retryable ExternalStorageError.
NeedAutoID checks whether the table needs backing up with an autoid.
NewBackoffStrategy creates a new backoff strategy with custom retry logic.
NewConnPool creates a new Pool by the specified conn factory function and capacity.
NewProgressPrinter returns a new progress printer.
NewStoreManager create a new manager for gRPC connections to stores.
NewTaskRegister build a TaskRegister with key format {RegisterTaskPrefix}/{RegisterTaskType}/{taskName}.
NewTaskRegisterWithTTL build a TaskRegister with key format {RegisterTaskPrefix}/{RegisterTaskType}/{taskName}.
PanicToErr recovers when the execution get panicked, and set the error provided by the arg.
ParseKey parse key by given format.
StartDynamicPProfListener starts the listener that will enable pprof when received `startPProfSignal`.
StartPProfListener forks a new goroutine listening on specified port and provide pprof info.
StartProgress starts progress bar.
StartServiceSafePointKeeper will run UpdateServiceSafePoint periodicity hence keeping service safepoint won't lose.
TemporaryDBName makes a 'private' database name.
UnmarshalBackupMeta converts the prettied JSON format of backupmeta (made by MarshalBackupMeta) back to the go structure.
UpdateServiceSafePoint register BackupTS to PD, to lock down BackupTS as safePoint with TTL seconds.
WithCleanUp runs a function with a timeout, and register its error to its argument if there is one.
WithDelayTime sets the initial delay time.
WithErrorContext sets the error context.
WithMaxDelayTime sets the maximum delay time.
WithNonRetryErrorFunc sets the non-retry error checking function.
WithRemainingAttempts sets the remaining attempts.
WithRetry retries a given operation with a backoff policy.
WithRetryErrorFunc sets the retry error checking function.
WithRetryReturnLastErr is like WithRetry but the returned error is the last error during retry rather than a multierr.
WithRetryV2 retries a given operation with a backoff policy.
# Constants
DefaultBRGCSafePointTTL means PD keep safePoint limit at least 5min.
DefaultCheckpointGCSafePointTTL means PD keep safePoint limit at least 72 minutes.
DefaultStreamPauseSafePointTTL specifies Keeping the server safePoint at list 24h when pause task.
DefaultStreamStartSafePointTTL specifies keeping the server safepoint 30 mins when start task.
region heartbeat are 10 seconds by default, if some region has 2 heartbeat missing (15 seconds), it appear to be a network issue between PD and TiKV.
RegisterImportTaskPrefix is the prefix of the key for task register todo: remove "/import" suffix, it's confusing to have a key like "/tidb/brie/import/restore/restore-xxx".
The key format should be {RegisterImportTaskPrefix}/{RegisterTaskType}/{taskName}.
StrategyGiveUp means unrecoverable error happened and the BR should exit for example: 1.
StrategyRetry error can be retried but will consume the backoff attempt quota.
StrategyUnknown for StrategyUnknown error.
# Structs
BRServiceSafePoint is metadata of service safe point from a BR 'instance'.
Pool is a lazy pool of gRPC channels.
ProgressPrinter prints a progress bar.
RegisterTask saves the task's information.
RetryState is the mutable state needed for retrying.
RetryWithBackoff is a simple context for a "mixed" retry.
# Interfaces
BackoffStrategy implements a backoff strategy for retry operations.
TaskRegister can register the task to PD with a lease.
# Type aliases
BackoffOption defines a function type for configuring backoffStrategyImpl.
ConstantBackoff is a backoff strategy that retry forever until success.
RegisterTaskType for the sub-prefix path for key.
RetryableFunc presents a retryable operation.