Documentation ¶
Index ¶
- Constants
- Variables
- func ContainHiddenConfig(s string) bool
- func FlattenConfigItems(nestedConfig map[string]any) map[string]any
- func GetGlobalKeyspaceName() string
- func GetJSONConfig() (string, error)
- func GetTxnScopeFromConfig() string
- func InitializeConfig(confPath string, configCheck, configStrict bool, ...)
- func MergeConfigItems(dstConf, newConf *Config) (acceptedItems, rejectedItems []string)
- func RestoreFunc() (restore func())
- func StoreGlobalConfig(config *Config)
- func TableLockEnabled() bool
- func UpdateGlobal(f func(conf *Config))
- type AtomicBool
- type ConfReloadFunc
- type Config
- type ErrConfigInstanceSection
- type ErrConfigValidationFailed
- type Experimental
- type Instance
- type InstanceConfigSection
- type IsolationRead
- type Log
- type LogBackup
- type OpenTracing
- type OpenTracingReporter
- type OpenTracingSampler
- type Performance
- type PessimisticTxn
- type PlanCache
- type Plugin
- type PreparedPlanCache
- type ProxyProtocol
- type Security
- type Status
- type StoreType
- type TopSQL
- type TrxSummary
Constants ¶
const ( MaxLogFileSize = 4096 // MB // MaxTxnEntrySize is the max value of TxnEntrySizeLimit. MaxTxnEntrySizeLimit = 120 * 1024 * 1024 // 120MB // DefTxnEntrySizeLimit is the default value of TxnEntrySizeLimit. DefTxnEntrySizeLimit = 6 * 1024 * 1024 // DefTxnTotalSizeLimit is the default value of TxnTxnTotalSizeLimit. DefTxnTotalSizeLimit = 100 * 1024 * 1024 SuperLargeTxnSize uint64 = 100 * 1024 * 1024 * 1024 * 1024 // 100T, we expect a txn can never be this large // DefMaxIndexLength is the maximum index length(in bytes). This value is consistent with MySQL. DefMaxIndexLength = 3072 // DefMaxOfMaxIndexLength is the maximum index length(in bytes) for TiDB v3.0.7 and previous version. DefMaxOfMaxIndexLength = 3072 * 4 // DefIndexLimit is the limitation of index on a single table. This value is consistent with MySQL. DefIndexLimit = 64 // DefMaxOfIndexLimit is the maximum limitation of index on a single table for TiDB. DefMaxOfIndexLimit = 64 * 8 // DefPort is the default port of TiDB DefPort = 4000 // DefStatusPort is the default status port of TiDB DefStatusPort = 10080 // DefHost is the default host of TiDB DefHost = "0.0.0.0" // DefStatusHost is the default status host of TiDB DefStatusHost = "0.0.0.0" // DefTableColumnCountLimit is limit of the number of columns in a table DefTableColumnCountLimit = 1017 // DefMaxOfTableColumnCountLimit is maximum limitation of the number of columns in a table DefMaxOfTableColumnCountLimit = 4096 // DefStatsLoadConcurrencyLimit is limit of the concurrency of stats-load. When it is set to 0, it will be set by syncload.GetSyncLoadConcurrencyByCPU. DefStatsLoadConcurrencyLimit = 0 // DefMaxOfStatsLoadConcurrencyLimit is maximum limitation of the concurrency of stats-load DefMaxOfStatsLoadConcurrencyLimit = 128 // DefStatsLoadQueueSizeLimit is limit of the size of stats-load request queue DefStatsLoadQueueSizeLimit = 1 // DefMaxOfStatsLoadQueueSizeLimit is maximum limitation of the size of stats-load request queue DefMaxOfStatsLoadQueueSizeLimit = 100000 // DefDDLSlowOprThreshold sets log DDL operations whose execution time exceeds the threshold value. DefDDLSlowOprThreshold = 300 // DefExpensiveQueryTimeThreshold indicates the time threshold of expensive query. DefExpensiveQueryTimeThreshold = 60 // DefExpensiveTxnTimeThreshold indicates the time threshold of expensive txn. DefExpensiveTxnTimeThreshold = 600 // DefMemoryUsageAlarmRatio is the threshold triggering an alarm which the memory usage of tidb-server instance exceeds. DefMemoryUsageAlarmRatio = 0.8 // DefTempDir is the default temporary directory path for TiDB. DefTempDir = "/tmp/tidb" // DefAuthTokenRefreshInterval is the default time interval to refresh tidb auth token. DefAuthTokenRefreshInterval = time.Hour // EnvVarKeyspaceName is the system env name for keyspace name. EnvVarKeyspaceName = "KEYSPACE_NAME" // MaxTokenLimit is the max token limit value. MaxTokenLimit = 1024 * 1024 DefSchemaLease = 45 * time.Second )
Config number limitations
const ( SpilledFileEncryptionMethodPlaintext = "plaintext" SpilledFileEncryptionMethodAES128CTR = "aes128-ctr" )
The following constants represents the valid action configurations for Security.SpilledFileEncryptionMethod. "plaintext" means encryption is disabled. NOTE: Although the values is case insensitive, we should use lower-case strings because the configuration value will be transformed to lower-case string and compared with these constants in the further usage.
const DefRowsForSampleRate = 110000
DefRowsForSampleRate is default sample rows used to calculate samplerate.
Variables ¶
var ( // ConflictOptions indicates the conflict config options existing in both [instance] and other sections in config file. ConflictOptions []InstanceConfigSection // DeprecatedOptions indicates the config options existing in some other sections in config file. // They should be moved to [instance] section. DeprecatedOptions []InstanceConfigSection // TikvConfigLock protects against concurrent tikv config refresh TikvConfigLock sync.Mutex )
var ( // CheckTableBeforeDrop enable to execute `admin check table` before `drop table`. CheckTableBeforeDrop = false )
Valid config maps
var TableLockDelayClean = func() uint64 { return GetGlobalConfig().DelayCleanTableLock }
TableLockDelayClean uses to get the time of delay clean table lock.
Functions ¶
func ContainHiddenConfig ¶
ContainHiddenConfig checks whether it contains the configuration that needs to be hidden.
func FlattenConfigItems ¶
FlattenConfigItems flatten this config, see more cases in the test.
func GetGlobalKeyspaceName ¶
func GetGlobalKeyspaceName() string
GetGlobalKeyspaceName is used to get global keyspace name from config file or command line.
func GetJSONConfig ¶
GetJSONConfig returns the config as JSON with hidden items removed It replaces the earlier HideConfig() which used strings.Split() in an way that didn't work for similarly named items (like enable).
func GetTxnScopeFromConfig ¶
func GetTxnScopeFromConfig() string
GetTxnScopeFromConfig extracts @@txn_scope value from the config.
func InitializeConfig ¶
func InitializeConfig(confPath string, configCheck, configStrict bool, enforceCmdArgs func(*Config, *flag.FlagSet), fset *flag.FlagSet)
InitializeConfig initialize the global config handler. The function enforceCmdArgs is used to merge the config file with command arguments: For example, if you start TiDB by the command "./tidb-server --port=3000", the port number should be overwritten to 3000 and ignore the port number in the config file.
func MergeConfigItems ¶
MergeConfigItems overwrites the dynamic config items and leaves the other items unchanged.
func RestoreFunc ¶
func RestoreFunc() (restore func())
RestoreFunc gets a function that restore the config to the current value.
func StoreGlobalConfig ¶
func StoreGlobalConfig(config *Config)
StoreGlobalConfig stores a new config to the globalConf. It mostly uses in the test to avoid some data races.
func TableLockEnabled ¶
func TableLockEnabled() bool
TableLockEnabled uses to check whether enabled the table lock feature.
func UpdateGlobal ¶
func UpdateGlobal(f func(conf *Config))
UpdateGlobal updates the global config, and provide a restore function that can be used to restore to the original.
Types ¶
type AtomicBool ¶
type AtomicBool struct {
atomicutil.Bool
}
AtomicBool is a helper type for atomic operations on a boolean value.
func (AtomicBool) MarshalText ¶
func (b AtomicBool) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*AtomicBool) UnmarshalText ¶
func (b *AtomicBool) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ConfReloadFunc ¶
type ConfReloadFunc func(oldConf, newConf *Config)
ConfReloadFunc is used to reload the config to make it work.
type Config ¶
type Config struct { Host string `toml:"host" json:"host"` AdvertiseAddress string `toml:"advertise-address" json:"advertise-address"` Port uint `toml:"port" json:"port"` Cors string `toml:"cors" json:"cors"` Store StoreType `toml:"store" json:"store"` Path string `toml:"path" json:"path"` Socket string `toml:"socket" json:"socket"` Lease string `toml:"lease" json:"lease"` SplitTable bool `toml:"split-table" json:"split-table"` TokenLimit uint `toml:"token-limit" json:"token-limit"` TempDir string `toml:"temp-dir" json:"temp-dir"` TempStoragePath string `toml:"tmp-storage-path" json:"tmp-storage-path"` // TempStorageQuota describe the temporary storage Quota during query exector when TiDBEnableTmpStorageOnOOM is enabled // If the quota exceed the capacity of the TempStoragePath, the tidb-server would exit with fatal error TempStorageQuota int64 `toml:"tmp-storage-quota" json:"tmp-storage-quota"` // Bytes TxnLocalLatches tikvcfg.TxnLocalLatches `toml:"-" json:"-"` ServerVersion string `toml:"server-version" json:"server-version"` VersionComment string `toml:"version-comment" json:"version-comment"` TiDBEdition string `toml:"tidb-edition" json:"tidb-edition"` TiDBReleaseVersion string `toml:"tidb-release-version" json:"tidb-release-version"` KeyspaceName string `toml:"keyspace-name" json:"keyspace-name"` Log Log `toml:"log" json:"log"` Instance Instance `toml:"instance" json:"instance"` Security Security `toml:"security" json:"security"` Status Status `toml:"status" json:"status"` Performance Performance `toml:"performance" json:"performance"` PreparedPlanCache PreparedPlanCache `toml:"prepared-plan-cache" json:"prepared-plan-cache"` OpenTracing OpenTracing `toml:"opentracing" json:"opentracing"` ProxyProtocol ProxyProtocol `toml:"proxy-protocol" json:"proxy-protocol"` PDClient tikvcfg.PDClient `toml:"pd-client" json:"pd-client"` TiKVClient tikvcfg.TiKVClient `toml:"tikv-client" json:"tikv-client"` CompatibleKillQuery bool `toml:"compatible-kill-query" json:"compatible-kill-query"` PessimisticTxn PessimisticTxn `toml:"pessimistic-txn" json:"pessimistic-txn"` MaxIndexLength int `toml:"max-index-length" json:"max-index-length"` IndexLimit int `toml:"index-limit" json:"index-limit"` TableColumnCountLimit uint32 `toml:"table-column-count-limit" json:"table-column-count-limit"` GracefulWaitBeforeShutdown int `toml:"graceful-wait-before-shutdown" json:"graceful-wait-before-shutdown"` // AlterPrimaryKey is used to control alter primary key feature. AlterPrimaryKey bool `toml:"alter-primary-key" json:"alter-primary-key"` // TreatOldVersionUTF8AsUTF8MB4 is use to treat old version table/column UTF8 charset as UTF8MB4. This is for compatibility. // Currently not support dynamic modify, because this need to reload all old version schema. TreatOldVersionUTF8AsUTF8MB4 bool `toml:"treat-old-version-utf8-as-utf8mb4" json:"treat-old-version-utf8-as-utf8mb4"` // EnableTableLock indicate whether enable table lock. // TODO: remove this after table lock features stable. EnableTableLock bool `toml:"enable-table-lock" json:"enable-table-lock"` DelayCleanTableLock uint64 `toml:"delay-clean-table-lock" json:"delay-clean-table-lock"` SplitRegionMaxNum uint64 `toml:"split-region-max-num" json:"split-region-max-num"` TopSQL TopSQL `toml:"top-sql" json:"top-sql"` // RepairMode indicates that the TiDB is in the repair mode for table meta. RepairMode bool `toml:"repair-mode" json:"repair-mode"` RepairTableList []string `toml:"repair-table-list" json:"repair-table-list"` // IsolationRead indicates that the TiDB reads data from which isolation level(engine and label). IsolationRead IsolationRead `toml:"isolation-read" json:"isolation-read"` // NewCollationsEnabledOnFirstBootstrap indicates if the new collations are enabled, it effects only when a TiDB cluster bootstrapped on the first time. NewCollationsEnabledOnFirstBootstrap bool `toml:"new_collations_enabled_on_first_bootstrap" json:"new_collations_enabled_on_first_bootstrap"` // Experimental contains parameters for experimental features. Experimental Experimental `toml:"experimental" json:"experimental"` // SkipRegisterToDashboard tells TiDB don't register itself to the dashboard. SkipRegisterToDashboard bool `toml:"skip-register-to-dashboard" json:"skip-register-to-dashboard"` // EnableTelemetry enables the usage data report to PingCAP. Deprecated: Telemetry has been removed. EnableTelemetry bool `toml:"enable-telemetry" json:"enable-telemetry"` // Labels indicates the labels set for the tidb server. The labels describe some specific properties for the tidb // server like `zone`/`rack`/`host`. Currently, labels won't affect the tidb server except for some special // label keys. Now we have following special keys: // 1. 'group' is a special label key which should be automatically set by tidb-operator. We don't suggest // users to set 'group' in labels. // 2. 'zone' is a special key that indicates the DC location of this tidb-server. If it is set, the value for this // key will be the default value of the session variable `txn_scope` for this tidb-server. Labels map[string]string `toml:"labels" json:"labels"` // EnableGlobalIndex is deprecated. EnableGlobalIndex bool `toml:"enable-global-index" json:"enable-global-index"` // DeprecateIntegerDisplayWidth indicates whether deprecating the max display length for integer. DeprecateIntegerDisplayWidth bool `toml:"deprecate-integer-display-length" json:"deprecate-integer-display-length"` // EnableEnumLengthLimit indicates whether the enum/set element length is limited. // According to MySQL 8.0 Refman: // The maximum supported length of an individual SET element is M <= 255 and (M x w) <= 1020, // where M is the element literal length and w is the number of bytes required for the maximum-length character in the character set. // See https://dev.mysql.com/doc/refman/8.0/en/string-type-syntax.html for more details. EnableEnumLengthLimit bool `toml:"enable-enum-length-limit" json:"enable-enum-length-limit"` // StoresRefreshInterval indicates the interval of refreshing stores info, the unit is second. StoresRefreshInterval uint64 `toml:"stores-refresh-interval" json:"stores-refresh-interval"` // EnableTCP4Only enables net.Listen("tcp4",...) // Note that: it can make lvs with toa work and thus tidb can get real client ip. EnableTCP4Only bool `toml:"enable-tcp4-only" json:"enable-tcp4-only"` // The client will forward the requests through the follower // if one of the following conditions happens: // 1. there is a network partition problem between TiDB and PD leader. // 2. there is a network partition problem between TiDB and TiKV leader. EnableForwarding bool `toml:"enable-forwarding" json:"enable-forwarding"` // MaxBallastObjectSize set the max size of the ballast object, the unit is byte. // The default value is the smallest of the following two values: 2GB or // one quarter of the total physical memory in the current system. MaxBallastObjectSize int `toml:"max-ballast-object-size" json:"max-ballast-object-size"` // BallastObjectSize set the initial size of the ballast object, the unit is byte. BallastObjectSize int `toml:"ballast-object-size" json:"ballast-object-size"` TrxSummary TrxSummary `toml:"transaction-summary" json:"transaction-summary"` // EnableGlobalKill indicates whether to enable global kill. EnableGlobalKill bool `toml:"enable-global-kill" json:"enable-global-kill"` // Enable32BitsConnectionID indicates whether to enable 32bits connection ID for global kill. Enable32BitsConnectionID bool `toml:"enable-32bits-connection-id" json:"enable-32bits-connection-id"` // InitializeSQLFile is a file that will be executed after first bootstrap only. // It can be used to set GLOBAL system variable values InitializeSQLFile string `toml:"initialize-sql-file" json:"initialize-sql-file"` // EnableBatchDML, MemQuotaQuery, OOMAction unused since bootstrap v90 EnableBatchDML bool `toml:"enable-batch-dml" json:"enable-batch-dml"` MemQuotaQuery int64 `toml:"mem-quota-query" json:"mem-quota-query"` OOMAction string `toml:"oom-action" json:"oom-action"` // OOMUseTmpStorage unused since bootstrap v93 OOMUseTmpStorage bool `toml:"oom-use-tmp-storage" json:"oom-use-tmp-storage"` // These items are deprecated because they are turned into instance system variables. CheckMb4ValueInUTF8 AtomicBool `toml:"check-mb4-value-in-utf8" json:"check-mb4-value-in-utf8"` EnableCollectExecutionInfo bool `toml:"enable-collect-execution-info" json:"enable-collect-execution-info"` Plugin Plugin `toml:"plugin" json:"plugin"` MaxServerConnections uint32 `toml:"max-server-connections" json:"max-server-connections"` RunDDL bool `toml:"run-ddl" json:"run-ddl"` // These configs are related to disaggregated-tiflash mode. DisaggregatedTiFlash bool `toml:"disaggregated-tiflash" json:"disaggregated-tiflash"` TiFlashComputeAutoScalerType string `toml:"autoscaler-type" json:"autoscaler-type"` TiFlashComputeAutoScalerAddr string `toml:"autoscaler-addr" json:"autoscaler-addr"` IsTiFlashComputeFixedPool bool `toml:"is-tiflashcompute-fixed-pool" json:"is-tiflashcompute-fixed-pool"` AutoScalerClusterID string `toml:"autoscaler-cluster-id" json:"autoscaler-cluster-id"` UseAutoScaler bool `toml:"use-autoscaler" json:"use-autoscaler"` // TiDBMaxReuseChunk indicates max cached chunk num TiDBMaxReuseChunk uint32 `toml:"tidb-max-reuse-chunk" json:"tidb-max-reuse-chunk"` // TiDBMaxReuseColumn indicates max cached column num TiDBMaxReuseColumn uint32 `toml:"tidb-max-reuse-column" json:"tidb-max-reuse-column"` // TiDBEnableExitCheck indicates whether exit-checking in domain for background process TiDBEnableExitCheck bool `toml:"tidb-enable-exit-check" json:"tidb-enable-exit-check"` // InMemSlowQueryTopNNum indicates the number of TopN slow queries stored in memory. InMemSlowQueryTopNNum int `toml:"in-mem-slow-query-topn-num" json:"in-mem-slow-query-topn-num"` // InMemSlowQueryRecentNum indicates the number of recent slow queries stored in memory. InMemSlowQueryRecentNum int `toml:"in-mem-slow-query-recent-num" json:"in-mem-slow-query-recent-num"` }
Config contains configuration options.
func GetGlobalConfig ¶
func GetGlobalConfig() *Config
GetGlobalConfig returns the global configuration for this server. It should store configuration from command line and configuration file. Other parts of the system can read the global configuration use this function.
func NewConfig ¶
func NewConfig() *Config
NewConfig creates a new config instance with default value.
func (*Config) GetTiKVConfig ¶
GetTiKVConfig returns configuration options from tikvcfg
func (*Config) RemovedVariableCheck ¶
RemovedVariableCheck checks if the config file contains any items which have been removed. These will not take effect any more.
func (*Config) UpdateTempStoragePath ¶
func (c *Config) UpdateTempStoragePath()
UpdateTempStoragePath is to update the `TempStoragePath` if port/statusPort was changed and the `tmp-storage-path` was not specified in the conf.toml or was specified the same as the default value.
type ErrConfigInstanceSection ¶
type ErrConfigInstanceSection struct {
// contains filtered or unexported fields
}
ErrConfigInstanceSection error is used to warning the user which config options should be moved to 'instance'.
func (*ErrConfigInstanceSection) Error ¶
func (e *ErrConfigInstanceSection) Error() string
type ErrConfigValidationFailed ¶
type ErrConfigValidationFailed struct { UndecodedItems []string // contains filtered or unexported fields }
The ErrConfigValidationFailed error is used so that external callers can do a type assertion to defer handling of this specific error when someone does not want strict type checking. This is needed only because logging hasn't been set up at the time we parse the config file. This should all be ripped out once strict config checking is made the default behavior.
func (*ErrConfigValidationFailed) Error ¶
func (e *ErrConfigValidationFailed) Error() string
type Experimental ¶
type Experimental struct { // Whether enable creating expression index. AllowsExpressionIndex bool `toml:"allow-expression-index" json:"allow-expression-index"` // Whether enable charset feature. EnableNewCharset bool `toml:"enable-new-charset" json:"-"` }
Experimental controls the features that are still experimental: their semantics, interfaces are subject to change. Using these features in the production environment is not recommended.
type Instance ¶
type Instance struct { // TiDBGeneralLog is used to log every query in the server in info level. TiDBGeneralLog bool `toml:"tidb_general_log" json:"tidb_general_log"` // EnablePProfSQLCPU is used to add label sql label to pprof result. EnablePProfSQLCPU bool `toml:"tidb_pprof_sql_cpu" json:"tidb_pprof_sql_cpu"` // DDLSlowOprThreshold sets log DDL operations whose execution time exceeds the threshold value. DDLSlowOprThreshold uint32 `toml:"ddl_slow_threshold" json:"ddl_slow_threshold"` // ExpensiveQueryTimeThreshold indicates the time threshold of expensive query. ExpensiveQueryTimeThreshold uint64 `toml:"tidb_expensive_query_time_threshold" json:"tidb_expensive_query_time_threshold"` // ExpensiveTxnTimeThreshold indicates the time threshold of expensive transaction. ExpensiveTxnTimeThreshold uint64 `toml:"tidb_expensive_txn_time_threshold" json:"tidb_expensive_txn_time_threshold"` // StmtSummaryEnablePersistent indicates whether to enable file persistence for stmtsummary. StmtSummaryEnablePersistent bool `toml:"tidb_stmt_summary_enable_persistent" json:"tidb_stmt_summary_enable_persistent"` // StmtSummaryFilename indicates the file name written by stmtsummary // when StmtSummaryEnablePersistent is true. StmtSummaryFilename string `toml:"tidb_stmt_summary_filename" json:"tidb_stmt_summary_filename"` // StmtSummaryFileMaxDays indicates how many days the files written by // stmtsummary will be kept when StmtSummaryEnablePersistent is true. StmtSummaryFileMaxDays int `toml:"tidb_stmt_summary_file_max_days" json:"tidb_stmt_summary_file_max_days"` // StmtSummaryFileMaxSize indicates the maximum size (in mb) of a single file // written by stmtsummary when StmtSummaryEnablePersistent is true. StmtSummaryFileMaxSize int `toml:"tidb_stmt_summary_file_max_size" json:"tidb_stmt_summary_file_max_size"` // StmtSummaryFileMaxBackups indicates the maximum number of files written // by stmtsummary when StmtSummaryEnablePersistent is true. StmtSummaryFileMaxBackups int `toml:"tidb_stmt_summary_file_max_backups" json:"tidb_stmt_summary_file_max_backups"` EnableSlowLog AtomicBool `toml:"tidb_enable_slow_log" json:"tidb_enable_slow_log"` SlowThreshold uint64 `toml:"tidb_slow_log_threshold" json:"tidb_slow_log_threshold"` RecordPlanInSlowLog uint32 `toml:"tidb_record_plan_in_slow_log" json:"tidb_record_plan_in_slow_log"` CheckMb4ValueInUTF8 AtomicBool `toml:"tidb_check_mb4_value_in_utf8" json:"tidb_check_mb4_value_in_utf8"` ForcePriority string `toml:"tidb_force_priority" json:"tidb_force_priority"` MemoryUsageAlarmRatio float64 `toml:"tidb_memory_usage_alarm_ratio" json:"tidb_memory_usage_alarm_ratio"` // EnableCollectExecutionInfo enables the TiDB to collect execution info. EnableCollectExecutionInfo AtomicBool `toml:"tidb_enable_collect_execution_info" json:"tidb_enable_collect_execution_info"` PluginDir string `toml:"plugin_dir" json:"plugin_dir"` PluginLoad string `toml:"plugin_load" json:"plugin_load"` // MaxConnections is the maximum permitted number of simultaneous client connections. MaxConnections uint32 `toml:"max_connections" json:"max_connections"` TiDBEnableDDL AtomicBool `toml:"tidb_enable_ddl" json:"tidb_enable_ddl"` TiDBEnableStatsOwner AtomicBool `toml:"tidb_enable_stats_owner" json:"tidb_enable_stats_owner"` TiDBRCReadCheckTS bool `toml:"tidb_rc_read_check_ts" json:"tidb_rc_read_check_ts"` // TiDBServiceScope indicates the role for tidb for distributed task framework. TiDBServiceScope string `toml:"tidb_service_scope" json:"tidb_service_scope"` }
Instance is the section of instance scope system variables.
type InstanceConfigSection ¶
type InstanceConfigSection struct { // SectionName indicates the origin section name. SectionName string // NameMappings maps the origin name to the name in [instance]. NameMappings map[string]string }
InstanceConfigSection indicates a config session that has options moved to [instance] session.
type IsolationRead ¶
type IsolationRead struct { // Engines filters tidb-server access paths by engine type. Engines []string `toml:"engines" json:"engines"` }
IsolationRead is the config for isolation read.
type Log ¶
type Log struct { // Log level. Level string `toml:"level" json:"level"` // Log format, one of json or text. Format string `toml:"format" json:"format"` // Disable automatic timestamps in output. Deprecated: use EnableTimestamp instead. DisableTimestamp nullableBool `toml:"disable-timestamp" json:"disable-timestamp"` // EnableTimestamp enables automatic timestamps in log output. EnableTimestamp nullableBool `toml:"enable-timestamp" json:"enable-timestamp"` // DisableErrorStack stops annotating logs with the full stack error // message. Deprecated: use EnableErrorStack instead. DisableErrorStack nullableBool `toml:"disable-error-stack" json:"disable-error-stack"` // EnableErrorStack enables annotating logs with the full stack error // message. EnableErrorStack nullableBool `toml:"enable-error-stack" json:"enable-error-stack"` // File log config. File logutil.FileLogConfig `toml:"file" json:"file"` SlowQueryFile string `toml:"slow-query-file" json:"slow-query-file"` // ExpensiveThreshold is deprecated. ExpensiveThreshold uint `toml:"expensive-threshold" json:"expensive-threshold"` GeneralLogFile string `toml:"general-log-file" json:"general-log-file"` // QueryLogMaxLen unused since bootstrap v90 QueryLogMaxLen uint64 `toml:"query-log-max-len" json:"query-log-max-len"` // EnableSlowLog, SlowThreshold, RecordPlanInSlowLog are deprecated. EnableSlowLog AtomicBool `toml:"enable-slow-log" json:"enable-slow-log"` SlowThreshold uint64 `toml:"slow-threshold" json:"slow-threshold"` RecordPlanInSlowLog uint32 `toml:"record-plan-in-slow-log" json:"record-plan-in-slow-log"` // Make tidb panic if write log operation hang in `Timeout` seconds Timeout int `toml:"timeout" json:"timeout"` }
Log is the log section of config.
func (*Log) ToLogConfig ¶
ToLogConfig converts *Log to *logutil.LogConfig.
type LogBackup ¶
type LogBackup struct { Advancer logbackupconf.Config `toml:"advancer" json:"advancer"` Enabled bool `toml:"enabled" json:"enabled"` }
LogBackup is the config for log backup service. For now, it includes the embed advancer.
type OpenTracing ¶
type OpenTracing struct { Enable bool `toml:"enable" json:"enable"` RPCMetrics bool `toml:"rpc-metrics" json:"rpc-metrics"` Sampler OpenTracingSampler `toml:"sampler" json:"sampler"` Reporter OpenTracingReporter `toml:"reporter" json:"reporter"` }
OpenTracing is the opentracing section of the config.
func (*OpenTracing) ToTracingConfig ¶
func (t *OpenTracing) ToTracingConfig() *tracing.Configuration
ToTracingConfig converts *OpenTracing to *tracing.Configuration.
type OpenTracingReporter ¶
type OpenTracingReporter struct { QueueSize int `toml:"queue-size" json:"queue-size"` BufferFlushInterval time.Duration `toml:"buffer-flush-interval" json:"buffer-flush-interval"` LogSpans bool `toml:"log-spans" json:"log-spans"` LocalAgentHostPort string `toml:"local-agent-host-port" json:"local-agent-host-port"` }
OpenTracingReporter is the config for opentracing reporter. See https://godoc.org/github.com/uber/jaeger-client-go/config#ReporterConfig
type OpenTracingSampler ¶
type OpenTracingSampler struct { Type string `toml:"type" json:"type"` Param float64 `toml:"param" json:"param"` SamplingServerURL string `toml:"sampling-server-url" json:"sampling-server-url"` MaxOperations int `toml:"max-operations" json:"max-operations"` SamplingRefreshInterval time.Duration `toml:"sampling-refresh-interval" json:"sampling-refresh-interval"` }
OpenTracingSampler is the config for opentracing sampler. See https://godoc.org/github.com/uber/jaeger-client-go/config#SamplerConfig
type Performance ¶
type Performance struct { MaxProcs uint `toml:"max-procs" json:"max-procs"` // Deprecated: use ServerMemoryQuota instead MaxMemory uint64 `toml:"max-memory" json:"max-memory"` ServerMemoryQuota uint64 `toml:"server-memory-quota" json:"server-memory-quota"` StatsLease string `toml:"stats-lease" json:"stats-lease"` // Deprecated: transaction auto retry is deprecated. StmtCountLimit uint `toml:"stmt-count-limit" json:"stmt-count-limit"` PseudoEstimateRatio float64 `toml:"pseudo-estimate-ratio" json:"pseudo-estimate-ratio"` BindInfoLease string `toml:"bind-info-lease" json:"bind-info-lease"` TxnEntrySizeLimit uint64 `toml:"txn-entry-size-limit" json:"txn-entry-size-limit"` TxnTotalSizeLimit uint64 `toml:"txn-total-size-limit" json:"txn-total-size-limit"` TCPKeepAlive bool `toml:"tcp-keep-alive" json:"tcp-keep-alive"` TCPNoDelay bool `toml:"tcp-no-delay" json:"tcp-no-delay"` CrossJoin bool `toml:"cross-join" json:"cross-join"` DistinctAggPushDown bool `toml:"distinct-agg-push-down" json:"distinct-agg-push-down"` MaxTxnTTL uint64 `toml:"max-txn-ttl" json:"max-txn-ttl"` // Deprecated MemProfileInterval string `toml:"-" json:"-"` // Deprecated: this config will not have any effect IndexUsageSyncLease string `toml:"index-usage-sync-lease" json:"index-usage-sync-lease"` PlanReplayerGCLease string `toml:"plan-replayer-gc-lease" json:"plan-replayer-gc-lease"` GOGC int `toml:"gogc" json:"gogc"` EnforceMPP bool `toml:"enforce-mpp" json:"enforce-mpp"` StatsLoadConcurrency int `toml:"stats-load-concurrency" json:"stats-load-concurrency"` StatsLoadQueueSize uint `toml:"stats-load-queue-size" json:"stats-load-queue-size"` // Deprecated: this config has been deprecated. It has no effect. AnalyzePartitionConcurrencyQuota uint `toml:"analyze-partition-concurrency-quota" json:"analyze-partition-concurrency-quota"` PlanReplayerDumpWorkerConcurrency uint `toml:"plan-replayer-dump-worker-concurrency" json:"plan-replayer-dump-worker-concurrency"` EnableStatsCacheMemQuota bool `toml:"enable-stats-cache-mem-quota" json:"enable-stats-cache-mem-quota"` // CommitterConcurrency, RunAutoAnalyze unused since bootstrap v90 CommitterConcurrency int `toml:"committer-concurrency" json:"committer-concurrency"` RunAutoAnalyze bool `toml:"run-auto-analyze" json:"run-auto-analyze"` // ForcePriority, MemoryUsageAlarmRatio are deprecated. ForcePriority string `toml:"force-priority" json:"force-priority"` MemoryUsageAlarmRatio float64 `toml:"memory-usage-alarm-ratio" json:"memory-usage-alarm-ratio"` EnableLoadFMSketch bool `toml:"enable-load-fmsketch" json:"enable-load-fmsketch"` // LiteInitStats indicates whether to use the lite version of stats. // 1. Basic stats meta data is loaded.(count, modify count, etc.) // 2. Column/index stats are loaded. (only histogram) // 3. TopN, Bucket, FMSketch are not loaded. // The lite version of stats is enabled by default. LiteInitStats bool `toml:"lite-init-stats" json:"lite-init-stats"` // If ForceInitStats is true, when tidb starts up, it doesn't provide service until init stats is finished. // If ForceInitStats is false, tidb can provide service before init stats is finished. Note that during the period // of init stats the optimizer may make bad decisions due to pseudo stats. ForceInitStats bool `toml:"force-init-stats" json:"force-init-stats"` // ConcurrentlyInitStats indicates whether to use concurrency to init stats. ConcurrentlyInitStats bool `toml:"concurrently-init-stats" json:"concurrently-init-stats"` // Deprecated: this config will not have any effect ProjectionPushDown bool `toml:"projection-push-down" json:"projection-push-down"` }
Performance is the performance section of the config.
type PessimisticTxn ¶
type PessimisticTxn struct { // The max count of retry for a single statement in a pessimistic transaction. MaxRetryCount uint `toml:"max-retry-count" json:"max-retry-count"` // The max count of deadlock events that will be recorded in the information_schema.deadlocks table. DeadlockHistoryCapacity uint `toml:"deadlock-history-capacity" json:"deadlock-history-capacity"` // Whether retryable deadlocks (in-statement deadlocks) are collected to the information_schema.deadlocks table. DeadlockHistoryCollectRetryable bool `toml:"deadlock-history-collect-retryable" json:"deadlock-history-collect-retryable"` // PessimisticAutoCommit represents if true it means the auto-commit transactions will be in pessimistic mode. PessimisticAutoCommit AtomicBool `toml:"pessimistic-auto-commit" json:"pessimistic-auto-commit"` // ConstraintCheckInPlacePessimistic is the default value for the session variable `tidb_constraint_check_in_place_pessimistic` ConstraintCheckInPlacePessimistic bool `toml:"constraint-check-in-place-pessimistic" json:"constraint-check-in-place-pessimistic"` }
PessimisticTxn is the config for pessimistic transaction.
func DefaultPessimisticTxn ¶
func DefaultPessimisticTxn() PessimisticTxn
DefaultPessimisticTxn returns the default configuration for PessimisticTxn
type PlanCache ¶
type PlanCache struct { Enabled bool `toml:"enabled" json:"enabled"` Capacity uint `toml:"capacity" json:"capacity"` Shards uint `toml:"shards" json:"shards"` }
PlanCache is the PlanCache section of the config.
type PreparedPlanCache ¶
type PreparedPlanCache struct { Enabled bool `toml:"enabled" json:"enabled"` Capacity uint `toml:"capacity" json:"capacity"` MemoryGuardRatio float64 `toml:"memory-guard-ratio" json:"memory-guard-ratio"` }
PreparedPlanCache is the PreparedPlanCache section of the config.
type ProxyProtocol ¶
type ProxyProtocol struct { // PROXY protocol acceptable client networks. // Empty string means disable PROXY protocol, // * means all networks. Networks string `toml:"networks" json:"networks"` // PROXY protocol header read timeout, Unit is second. HeaderTimeout uint `toml:"header-timeout" json:"header-timeout"` // PROXY protocol header process fallback-able. // If set to true and not send PROXY protocol header, connection will return connection's client IP. Fallbackable bool `toml:"fallbackable" json:"fallbackable"` }
ProxyProtocol is the PROXY protocol section of the config.
type Security ¶
type Security struct { SkipGrantTable bool `toml:"skip-grant-table" json:"skip-grant-table"` SSLCA string `toml:"ssl-ca" json:"ssl-ca"` SSLCert string `toml:"ssl-cert" json:"ssl-cert"` SSLKey string `toml:"ssl-key" json:"ssl-key"` ClusterSSLCA string `toml:"cluster-ssl-ca" json:"cluster-ssl-ca"` ClusterSSLCert string `toml:"cluster-ssl-cert" json:"cluster-ssl-cert"` ClusterSSLKey string `toml:"cluster-ssl-key" json:"cluster-ssl-key"` ClusterVerifyCN []string `toml:"cluster-verify-cn" json:"cluster-verify-cn"` // Used for auth plugin `tidb_session_token`. SessionTokenSigningCert string `toml:"session-token-signing-cert" json:"session-token-signing-cert"` SessionTokenSigningKey string `toml:"session-token-signing-key" json:"session-token-signing-key"` // If set to "plaintext", the spilled files will not be encrypted. SpilledFileEncryptionMethod string `toml:"spilled-file-encryption-method" json:"spilled-file-encryption-method"` // EnableSEM prevents SUPER users from having full access. EnableSEM bool `toml:"enable-sem" json:"enable-sem"` // Allow automatic TLS certificate generation AutoTLS bool `toml:"auto-tls" json:"auto-tls"` MinTLSVersion string `toml:"tls-version" json:"tls-version"` RSAKeySize int `toml:"rsa-key-size" json:"rsa-key-size"` SecureBootstrap bool `toml:"secure-bootstrap" json:"secure-bootstrap"` // The path of the JWKS for tidb_auth_token authentication AuthTokenJWKS string `toml:"auth-token-jwks" json:"auth-token-jwks"` // The refresh time interval of JWKS AuthTokenRefreshInterval string `toml:"auth-token-refresh-interval" json:"auth-token-refresh-interval"` // Disconnect directly when the password is expired DisconnectOnExpiredPassword bool `toml:"disconnect-on-expired-password" json:"disconnect-on-expired-password"` }
Security is the security section of the config.
func (*Security) ClusterSecurity ¶
ClusterSecurity returns Security info for cluster
type Status ¶
type Status struct { StatusHost string `toml:"status-host" json:"status-host"` MetricsAddr string `toml:"metrics-addr" json:"metrics-addr"` StatusPort uint `toml:"status-port" json:"status-port"` MetricsInterval uint `toml:"metrics-interval" json:"metrics-interval"` ReportStatus bool `toml:"report-status" json:"report-status"` RecordQPSbyDB bool `toml:"record-db-qps" json:"record-db-qps"` RecordDBLabel bool `toml:"record-db-label" json:"record-db-label"` // After a duration of this time in seconds if the server doesn't see any activity it pings // the client to see if the transport is still alive. GRPCKeepAliveTime uint `toml:"grpc-keepalive-time" json:"grpc-keepalive-time"` // After having pinged for keepalive check, the server waits for a duration of timeout in seconds // and if no activity is seen even after that the connection is closed. GRPCKeepAliveTimeout uint `toml:"grpc-keepalive-timeout" json:"grpc-keepalive-timeout"` // The number of max concurrent streams/requests on a client connection. GRPCConcurrentStreams uint `toml:"grpc-concurrent-streams" json:"grpc-concurrent-streams"` // Sets window size for stream. The default value is 2MB. GRPCInitialWindowSize int `toml:"grpc-initial-window-size" json:"grpc-initial-window-size"` // Set maximum message length in bytes that gRPC can send. `-1` means unlimited. The default value is 10MB. GRPCMaxSendMsgSize int `toml:"grpc-max-send-msg-size" json:"grpc-max-send-msg-size"` }
Status is the status section of the config.
type StoreType ¶
type StoreType string
StoreType is the type of storage. TODO maybe put it inside pkg/store, but it introduces a cycle import.
const ( // StoreTypeTiKV is TiKV type. the underlying storage engines might be one or // multiple of TiKV/TiFlash/TiDB, see kv.StoreType for more details. StoreTypeTiKV StoreType = "tikv" // StoreTypeUniStore is UniStore type which we implemented using badger, for test only. StoreTypeUniStore StoreType = "unistore" // StoreTypeMockTiKV is MockTiKV type which we implemented using goleveldb, for test only. StoreTypeMockTiKV StoreType = "mocktikv" )
func StoreTypeList ¶
func StoreTypeList() []StoreType
StoreTypeList returns all valid storage types.
type TopSQL ¶
type TopSQL struct { // The TopSQL's data receiver address. ReceiverAddress string `toml:"receiver-address" json:"receiver-address"` }
TopSQL is the config for TopSQL.
type TrxSummary ¶
type TrxSummary struct { // how many transaction summary in `transaction_summary` each TiDB node should keep. TransactionSummaryCapacity uint `toml:"transaction-summary-capacity" json:"transaction-summary-capacity"` // how long a transaction should be executed to make it be recorded in `transaction_id_digest`. TransactionIDDigestMinDuration uint `toml:"transaction-id-digest-min-duration" json:"transaction-id-digest-min-duration"` }
TrxSummary is the config for transaction summary collecting.
func DefaultTrxSummary ¶
func DefaultTrxSummary() TrxSummary
DefaultTrxSummary returns the default configuration for TrxSummary collector
func (*TrxSummary) Valid ¶
func (config *TrxSummary) Valid() error
Valid Validatse TrxSummary configs