config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OOMActionCancel = "cancel"
	OOMActionLog    = "log"
)

The following constants represents the valid action configurations for OOMAction. NOTE: Althrough the values is case insensitiv, 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.

View Source
const (
	MaxLogFileSize = 4096 // MB
)

Config number limitations

Variables

View Source
var (
	ValidStorage = map[string]bool{
		"mocktikv": true,
		"tikv":     true,
	}
	// checkTableBeforeDrop enable to execute `admin check table` before `drop table`.
	CheckTableBeforeDrop = false
)

Valid config maps

Functions

This section is empty.

Types

type Binlog

type Binlog struct {
	BinlogSocket string `toml:"binlog-socket" json:"binlog-socket"`
	WriteTimeout string `toml:"write-timeout" json:"write-timeout"`
	// If IgnoreError is true, when writing binlog meets error, TiDB would
	// ignore the error.
	IgnoreError bool `toml:"ignore-error" json:"ignore-error"`
}

Binlog is the config for binlog.

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"`
	Store            string          `toml:"store" json:"store"`
	Path             string          `toml:"path" json:"path"`
	Socket           string          `toml:"socket" json:"socket"`
	Lease            string          `toml:"lease" json:"lease"`
	RunDDL           bool            `toml:"run-ddl" json:"run-ddl"`
	SplitTable       bool            `toml:"split-table" json:"split-table"`
	TokenLimit       uint            `toml:"token-limit" json:"token-limit"`
	OOMAction        string          `toml:"oom-action" json:"oom-action"`
	MemQuotaQuery    int64           `toml:"mem-quota-query" json:"mem-quota-query"`
	EnableStreaming  bool            `toml:"enable-streaming" json:"enable-streaming"`
	TxnLocalLatches  TxnLocalLatches `toml:"txn-local-latches" json:"txn-local-latches"`
	// Set sys variable lower-case-table-names, ref: https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html.
	// TODO: We actually only support mode 2, which keeps the original case, but the comparison is case-insensitive.
	LowerCaseTableNames int `toml:"lower-case-table-names" json:"lower-case-table-names"`

	Log                 Log               `toml:"log" json:"log"`
	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"`
	ProxyProtocol       ProxyProtocol     `toml:"proxy-protocol" json:"proxy-protocol"`
	TiKVClient          TiKVClient        `toml:"tikv-client" json:"tikv-client"`
	Binlog              Binlog            `toml:"binlog" json:"binlog"`
	Inc                 Inc               `toml:"inc" json:"inc"`
	Osc                 Osc               `toml:"osc" json:"osc"`
	Ghost               Ghost             `toml:"ghost" json:"ghost"`
	IncLevel            IncLevel          `toml:"inc_level" json:"inc_level"`
	CompatibleKillQuery bool              `toml:"compatible-kill-query" json:"compatible-kill-query"`

	// 是否跳过用户权限校验
	SkipGrantTable bool `toml:"skip_grant_table" json:"skip_grant_table"`

	// 忽略终端连接断开信号
	IgnoreSighup bool `toml:"ignore_sighup" json:"ignore_sighup"`
}

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) Load

func (c *Config) Load(confFile string) error

Load loads config options from a toml file.

type Ghost

type Ghost struct {

	// 阿里云数据库
	GhostAliyunRds bool `toml:"ghost_aliyun_rds"`
	// 允许gh-ost运行在双主复制架构中,一般与-assume-master-host参数一起使用。
	GhostAllowMasterMaster bool `toml:"ghost_allow_master_master"`
	// 允许gh-ost在数据迁移(migrate)依赖的唯一键可以为NULL,默认为不允许为NULL的唯一键。如果数据迁移(migrate)依赖的唯一键允许NULL值,则可能造成数据不正确,请谨慎使用。
	GhostAllowNullableUniqueKey bool `toml:"ghost_allow_nullable_unique_key"`
	// 允许gh-ost直接运行在主库上。默认gh-ost连接的从库。
	GhostAllowOnMaster bool `toml:"ghost_allow_on_master"`

	// 如果你修改一个列的名字(如change column),gh-ost将会识别到并且需要提供重命名列名的原因,默认情况下gh-ost是不继续执行的,除非提供-approve-renamed-columns ALTER。
	// ALTER
	GhostApproveRenamedColumns bool `toml:"ghost_approve_renamed_columns"`
	// 为gh-ost指定一个主库,格式为"ip:port"或者"hostname:port"。默认推荐gh-ost连接从库。
	GhostAssumeMasterHost string `toml:"ghost_assume_master_host"`
	// 确认gh-ost连接的数据库实例的binlog_format=ROW的情况下,可以指定-assume-rbr,
	// 这样可以禁止从库上运行stop slave,start slave,执行gh-ost用户也不需要SUPER权限。
	GhostAssumeRbr bool `toml:"ghost_assume_rbr"`

	// 该参数如果为True(默认值),则进行row-copy之后,估算统计行数(使用explain select count(*)方式),
	// 并调整ETA时间,否则,gh-ost首先预估统计行数,然后开始row-copy。
	GhostConcurrentRowcount bool `toml:"ghost_concurrent_rowcount"`

	// 当值为0时,当达到-critical-load,gh-ost立即退出。当值不为0时,当达到-critical-load,
	// gh-ost会在-critical-load-interval-millis秒数后,再次进行检查,再次检查依旧达到-critical-load,gh-ost将会退出。
	GhostCriticalLoadIntervalMillis   int64 `toml:"ghost_critical_load_interval_millis"`
	GhostCriticalLoadHibernateSeconds int64 `toml:"ghost_critical_load_hibernate_seconds"`

	// 选择cut-over类型:atomic/two-step,atomic(默认)类型的cut-over是github的算法,two-step采用的是facebook-OSC的算法。
	GhostCutOver string `toml:"ghost_cut_over"`

	GhostCutOverExponentialBackoff bool `toml:"ghost_cut_over_exponential_backoff"`
	// 在每次迭代中处理的行数量(允许范围:100-100000),默认值为1000。
	GhostChunkSize int64 `toml:"ghost_chunk_size"`

	// gh-ost在cut-over阶段最大的锁等待时间,当锁超时时,gh-ost的cut-over将重试。(默认值:3)
	GhostCutOverLockTimeoutSeconds int64 `toml:"ghost_cut_over_lock_timeout_seconds"`

	// 很危险的参数,慎用!
	// 该参数针对一个有外键的表,在gh-ost创建ghost表时,并不会为ghost表创建外键。该参数很适合用于删除外键,除此之外,请谨慎使用。
	GhostDiscardForeignKeys bool `toml:"ghost_discard_foreign_keys"`

	// 各种操作在panick前重试次数。(默认为60)
	GhostDefaultRetries int64 `toml:"ghost_default_retries"`

	GhostDmlBatchSize int64 `toml:"ghost_dml_batch_size"`

	// 准确统计表行数(使用select count(*)的方式),得到更准确的预估时间。
	GhostExactRowcount bool `toml:"ghost_exact_rowcount"`

	GhostExponentialBackoffMaxInterval int64 `toml:"ghost_exponential_backoff_max_interval"`
	// When true, the 'unpostpone|cut-over' interactive command must name the migrated table。
	GhostForceTableNames   string `toml:"ghost_force_table_names"`
	GhostForceNamedCutOver bool   `toml:"ghost_force_named_cut_over"`
	GhostGcp               bool   `toml:"ghost_gcp"`

	// gh-ost心跳频率值,默认为500。
	GhostHeartbeatIntervalMillis int64 `toml:"ghost_heartbeat_interval_millis"`

	// gh-ost操作之前,检查并删除已经存在的ghost表。该参数不建议使用,请手动处理原来存在的ghost表。默认不启用该参数,gh-ost直接退出操作。
	GhostInitiallyDropGhostTable bool `toml:"ghost_initially_drop_ghost_table"`

	// gh-ost操作之前,检查并删除已经存在的旧表。该参数不建议使用,请手动处理原来存在的ghost表。默认不启用该参数,gh-ost直接退出操作。
	GhostInitiallyDropOldTable bool `toml:"ghost_initially_drop_old_table"`

	// gh-ost强制删除已经存在的socket文件。该参数不建议使用,可能会删除一个正在运行的gh-ost程序,导致DDL失败。
	GhostInitiallyDropSocketFile bool `toml:"ghost_initially_drop_socket_file"`

	// 主从复制最大延迟时间,当主从复制延迟时间超过该值后,gh-ost将采取节流(throttle)措施,默认值:1500s。
	GhostMaxLagMillis int64 `toml:"ghost_max_lag_millis"`

	GhostNiceRatio float64 `toml:"ghost_nice_ratio"`

	// 开启标志
	GhostOn bool `toml:"ghost_on"`
	// gh-ost操作结束后,删除旧表,默认状态是不删除旧表,会存在_tablename_del表。
	GhostOkToDropTable bool `toml:"ghost_ok_to_drop_table"`
	// 当这个文件存在的时候,gh-ost的cut-over阶段将会被推迟,直到该文件被删除。
	GhostPostponeCutOverFlagFile string `toml:"ghost_postpone_cut_over_flag_file"`
	// GhostPanicFlagFile           string `toml:"ghost_panic_flag_file"`
	// GhostReplicaServerID      bool `toml:"ghost_replica_server_id"`
	GhostSkipForeignKeyChecks bool `toml:"ghost_skip_foreign_key_checks"`

	// 	列出所有需要被检查主从复制延迟的从库。
	// e.g:
	// -throttle-control-replica=192.16.12.22:3306,192.16.12.23:3307,192.16.13.12:3308
	GhostThrottleControlReplicas    string `toml:"ghost_throttle_control_replicas"`
	GhostThrottleHTTP               string `toml:"ghost_throttle_http"`
	GhostTimestampOldTable          bool   `toml:"ghost_timestamp_old_table"`
	GhostThrottleQuery              string `toml:"ghost_throttle_query"`
	GhostThrottleFlagFile           string `toml:"ghost_throttle_flag_file"`
	GhostThrottleAdditionalFlagFile string `toml:"ghost_throttle_additional_flag_file"`

	// 告诉gh-ost你正在运行的是一个tungsten-replication拓扑结构。
	GhostTungsten            bool   `toml:"ghost_tungsten"`
	GhostReplicationLagQuery string `toml:"ghost_replication_lag_query"`

	// gh-ost所在目录,当设置该参数时,则启用二进制gh-ost
	GhostBinDir string `toml:"ghost_bin_dir" json:"ghost_bin_dir"`
}

GhOst online schema change 工具参数配置

type Inc

type Inc struct {
	BackupHost     string `toml:"backup_host" json:"backup_host"` // 远程备份库信息
	BackupPassword string `toml:"backup_password" json:"backup_password"`
	BackupPort     uint   `toml:"backup_port" json:"backup_port"`
	BackupUser     string `toml:"backup_user" json:"backup_user"`

	CheckAutoIncrementDataType  bool `toml:"check_autoincrement_datatype" json:"check_autoincrement_datatype"`
	CheckAutoIncrementInitValue bool `toml:"check_autoincrement_init_value" json:"check_autoincrement_init_value"`
	CheckAutoIncrementName      bool `toml:"check_autoincrement_name" json:"check_autoincrement_name"`
	CheckColumnComment          bool `toml:"check_column_comment" json:"check_column_comment"`
	CheckColumnDefaultValue     bool `toml:"check_column_default_value" json:"check_column_default_value"`
	// 检查列顺序变更 #40
	CheckColumnPositionChange bool `toml:"check_column_position_change" json:"check_column_position_change"`
	// 检查列类型变更(允许长度变更,类型变更时警告)
	CheckColumnTypeChange       bool `toml:"check_column_type_change" json:"check_column_type_change"`
	CheckDMLLimit               bool `toml:"check_dml_limit" json:"check_dml_limit"`
	CheckDMLOrderBy             bool `toml:"check_dml_orderby" json:"check_dml_orderby"`
	CheckDMLWhere               bool `toml:"check_dml_where" json:"check_dml_where"`
	CheckIdentifier             bool `toml:"check_identifier" json:"check_identifier"`
	CheckImplicitTypeConversion bool `toml:"check_implicit_type_conversion"` // 检查where条件中的隐式类型转换
	CheckIndexPrefix            bool `toml:"check_index_prefix" json:"check_index_prefix"`
	CheckInsertField            bool `toml:"check_insert_field" json:"check_insert_field"`
	CheckPrimaryKey             bool `toml:"check_primary_key" json:"check_primary_key"`
	CheckTableComment           bool `toml:"check_table_comment" json:"check_table_comment"`
	CheckTimestampDefault       bool `toml:"check_timestamp_default" json:"check_timestamp_default"`
	CheckTimestampCount         bool `toml:"check_timestamp_count" json:"check_timestamp_count"`

	EnableTimeStampType  bool `toml:"enable_timestamp_type" json:"enable_timestamp_type"`
	EnableZeroDate       bool `toml:"enable_zero_date" json:"enable_zero_date"`
	CheckDatetimeDefault bool `toml:"check_datetime_default" json:"check_datetime_default"`
	CheckDatetimeCount   bool `toml:"check_datetime_count" json:"check_datetime_count"`

	// 将 float/double 转成 decimal, 默认为 false
	CheckFloatDouble bool `toml:"check_float_double" json:"check_float_double"`

	CheckIdentifierUpper bool `toml:"check_identifier_upper" json:"check_identifier_upper"`
	CheckIdentifierLower bool `toml:"check_identifier_lower" json:"check_identifier_lower"`
	// 数据库是否只读的判断. 默认为true
	CheckReadOnly bool `toml:"check_read_only" json:"check_read_only"`

	// 连接服务器的默认字符集,默认值为utf8mb4
	DefaultCharset string `toml:"default_charset" json:"default_charset"`
	// 禁用数据库类型,多个时以逗号分隔.该参数优先级低于enable_blob_type/enable_enum_set_bit等参数
	DisableTypes        string `toml:"disable_types" json:"disable_types"`
	EnableAlterDatabase bool   `toml:"enable_alter_database" json:"enable_alter_database"`
	// 允许执行任意语法类型.该设置有安全要求,仅支持配置文件方式设置
	EnableAnyStatement          bool `toml:"enable_any_statement" json:"enable_any_statement"`
	EnableAutoIncrementUnsigned bool `toml:"enable_autoincrement_unsigned" json:"enable_autoincrement_unsigned"`
	// 允许blob,text,json列设置为NOT NULL
	EnableBlobNotNull   bool `toml:"enable_blob_not_null" json:"enable_blob_not_null"`
	EnableBlobType      bool `toml:"enable_blob_type" json:"enable_blob_type"`
	EnableChangeColumn  bool `toml:"enable_change_column" json:"enable_change_column"` // 允许change column操作
	EnableColumnCharset bool `toml:"enable_column_charset" json:"enable_column_charset"`
	EnableDropDatabase  bool `toml:"enable_drop_database" json:"enable_drop_database"`
	EnableDropTable     bool `toml:"enable_drop_table" json:"enable_drop_table"` // 允许删除表
	EnableEnumSetBit    bool `toml:"enable_enum_set_bit" json:"enable_enum_set_bit"`

	// DML指纹功能,开启后,在审核时,类似DML将直接复用审核结果,可大幅优化审核效率
	EnableFingerprint      bool `toml:"enable_fingerprint" json:"enable_fingerprint"`
	EnableForeignKey       bool `toml:"enable_foreign_key" json:"enable_foreign_key"`
	EnableIdentiferKeyword bool `toml:"enable_identifer_keyword" json:"enable_identifer_keyword"`
	EnableJsonType         bool `toml:"enable_json_type" json:"enable_json_type"`
	EnableUseView          bool `toml:"enable_use_view" json:"enable_use_view"`
	// 是否启用自定义审核级别设置
	// EnableLevel bool `toml:"enable_level" json:"enable_level"`
	// 是否启用最小化回滚SQL设置,当开启时,update语句中未变更的值不再记录到回滚语句中
	EnableMinimalRollback bool `toml:"enable_minimal_rollback" json:"enable_minimal_rollback"`
	// 是否允许指定存储引擎
	EnableSetEngine        bool `toml:"enable_set_engine" json:"enable_set_engine"`
	EnableNullable         bool `toml:"enable_nullable" json:"enable_nullable"`               // 允许空列
	EnableNullIndexName    bool `toml:"enable_null_index_name" json:"enable_null_index_name"` //是否允许不指定索引名
	EnableOrderByRand      bool `toml:"enable_orderby_rand" json:"enable_orderby_rand"`
	EnablePartitionTable   bool `toml:"enable_partition_table" json:"enable_partition_table"`
	EnablePKColumnsOnlyInt bool `toml:"enable_pk_columns_only_int" json:"enable_pk_columns_only_int"`
	EnableSelectStar       bool `toml:"enable_select_star" json:"enable_select_star"`

	// 是否允许设置字符集和排序规则
	EnableSetCharset   bool `toml:"enable_set_charset" json:"enable_set_charset"`
	EnableSetCollation bool `toml:"enable_set_collation" json:"enable_set_collation"`
	// 开启sql统计
	EnableSqlStatistic bool `toml:"enable_sql_statistic" json:"enable_sql_statistic"`

	// explain判断受影响行数时使用的规则, 默认值"first"
	// 可选值: "first", "max"
	// 		"first": 	使用第一行的explain结果作为受影响行数
	// 		"max": 		使用explain结果中的最大值作为受影响行数
	ExplainRule string `toml:"explain_rule" json:"explain_rule"`

	// sql_mode, 默认值""
	// 可选值: "", "STRICT_TRANS_TABLES", "STRICT_ALL_TABLES", "TRADITIONAL"
	//      "":                         默认使用目标 MySQL 实例 sql_mode
	//      "STRICT_TRANS_TABLES":      为事务性存储引擎以及可能的情况下为非事务性存储引擎启用严格的SQL模式
	//      "STRICT_ALL_TABLES":        为所有存储引擎启用严格的SQL模式
	//      "TRADITIONAL":              严格的SQL组合模式, 相当于STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER,和 NO_ENGINE_SUBSTITUTION
	SqlMode string `toml:"sql_mode" json:"sql_mode"`

	// 全量日志
	GeneralLog bool `toml:"general_log" json:"general_log"`
	// 使用十六进制表示法转储二进制列
	// 受影响的数据类型为BINARY,VARBINARY,BLOB类型
	HexBlob bool `toml:"hex_blob" json:"hex_blob"`

	// 表名/索引名前缀,为空时不作限制
	IndexPrefix     string `toml:"index_prefix" json:"index_prefix"`
	UniqIndexPrefix string `toml:"uniq_index_prefix" json:"uniq_index_prefix"`
	TablePrefix     string `toml:"table_prefix" json:"table_prefix"`

	Lang string `toml:"lang" json:"lang"`
	// 连接服务器允许的最大包大小,以字节为单位 默认值为4194304(即4MB)
	MaxAllowedPacket uint `toml:"max_allowed_packet" json:"max_allowed_packet"`
	MaxCharLength    uint `toml:"max_char_length" json:"max_char_length"`
	// 单表的列数上限
	MaxColumnCount uint `toml:"max_column_count" json:"max_column_count"`
	// DDL操作最大允许的受影响行数. 默认值0,即不限制
	MaxDDLAffectRows uint `toml:"max_ddl_affect_rows" json:"max_ddl_affect_rows"`

	// 一次最多写入的行数, 仅判断insert values语法
	MaxInsertRows uint `toml:"max_insert_rows" json:"max_insert_rows"`

	MaxKeys       uint `toml:"max_keys" json:"max_keys"`
	MaxKeyParts   uint `toml:"max_key_parts" json:"max_key_parts"`
	MaxUpdateRows uint `toml:"max_update_rows" json:"max_update_rows"`
	// varchar类型的最大长度,当超出时添加警告
	MaxVarcharLength   uint `toml:"max_varchar_length" json:"max_varchar_length"`
	MaxPrimaryKeyParts uint `toml:"max_primary_key_parts" json:"max_primary_key_parts"` // 主键最多允许有几列组合
	MergeAlterTable    bool `toml:"merge_alter_table" json:"merge_alter_table"`

	// 建表必须创建的列. 可指定多个列,以逗号分隔.列类型可选. 格式: 列名 [列类型,可选],...
	MustHaveColumns string `toml:"must_have_columns" json:"must_have_columns"`
	// 如果表包含以下列,列必须有索引。可指定多个列,以逗号分隔.列类型可选.   格式: 列名 [列类型,可选],...
	ColumnsMustHaveIndex string `toml:"columns_must_have_index" json:"columns_must_have_index"`

	// 是否跳过用户权限校验
	SkipGrantTable bool `toml:"skip_grant_table" json:"skip_grant_table"`
	// 要跳过的sql语句, 多个时以分号分隔
	SkipSqls string `toml:"skip_sqls" json:"skip_sqls"`

	// alter table子句忽略OSC工具.
	// 格式为drop index,add column等,配置要跳过的子句格式,多个时以逗号分隔
	IgnoreOscAlterStmt string `toml:"ignore_osc_alter_stmt" json:"ignore_osc_alter_stmt"`

	// 安全更新是否开启.
	// -1 表示不做操作,基于远端数据库 [默认值]
	// 0  表示关闭安全更新
	// 1  表示开启安全更新
	SqlSafeUpdates int `toml:"sql_safe_updates" json:"sql_safe_updates"`

	// 设置执行SQL时,会话变量
	// 0 表示不做操作,基于远端数据库【默认值】
	// > 0 值表示,会话在执行SQL 时获取锁超时的时间
	LockWaitTimeout int `toml:"lock_wait_timeout" json:"lock_wait_timeout"`

	// 支持的字符集
	SupportCharset string `toml:"support_charset" json:"support_charset"`

	// 支持的排序规则
	SupportCollation string `toml:"support_collation" json:"support_collation"`

	// 支持的存储引擎,多个时以分号分隔
	SupportEngine string `toml:"support_engine" json:"support_engine"`
	// 远端数据库等待超时时间, 单位:秒
	WaitTimeout int `toml:"wait_timeout" json:"wait_timeout"`

	// 远端数据库最大执行时间, 单位:秒
	MaxExecutionTime int `toml:"max_execution_time" json:"max_execution_time"`
	// 版本信息
	Version string `toml:"version" json:"version"`
}

Inc is the inception section of the config.

type IncLevel added in v1.0.1

type IncLevel struct {
	ErAlterTableOnce                  uint8 `toml:"er_alter_table_once"`
	ErAutoIncrIdWarning               uint8 `toml:"er_auto_incr_id_warning"`
	ErAutoincUnsigned                 uint8 `toml:"er_autoinc_unsigned"`
	ErBadFieldError                   uint8 `toml:"er_bad_field_error"`
	ErBadNullError                    uint8 `toml:"er_bad_null_error"`
	ErBinlogCorrupted                 uint8 `toml:"er_binlog_corrupted"`
	ErBinlogFormatStatement           uint8 `toml:"er_binlog_format_statement"`
	ErBlobCantHaveDefault             uint8 `toml:"er_blob_cant_have_default"`
	ErBlobUsedAsKey                   uint8 `toml:"er_blob_used_as_key"`
	ErCantChangeColumn                uint8 `toml:"er_cant_change_column"`
	ErCantChangeColumnPosition        uint8 `toml:"er_cant_change_column_position"`
	ErCantDropDatabase                uint8 `toml:"er_cant_drop_database"`
	ErCantDropFieldOrKey              uint8 `toml:"er_cant_drop_field_or_key"`
	ErCantDropTable                   uint8 `toml:"er_cant_drop_table"`
	ErCantRemoveAllFields             uint8 `toml:"er_cant_remove_all_fields"`
	ErCantSetCharset                  uint8 `toml:"er_cant_set_charset"`
	ErCantSetCollation                uint8 `toml:"er_cant_set_collation"`
	ErCantSetEngine                   uint8 `toml:"er_cant_set_engine"`
	ErChangeColumnType                uint8 `toml:"er_change_column_type"`
	ErChangeTooMuchRows               uint8 `toml:"er_change_too_much_rows"`
	ErCharToVarcharLen                uint8 `toml:"er_char_to_varchar_len"`
	ErCharsetNotSupport               uint8 `toml:"er_charset_not_support"`
	ErCharsetOnColumn                 uint8 `toml:"er_charset_on_column"`
	ErCollationCharsetMismatch        uint8 `toml:"er_collation_charset_mismatch"`
	ErCollationNotSupport             uint8 `toml:"er_collation_not_support"`
	ErColumnExisted                   uint8 `toml:"er_column_existed"`
	ErColumnHaveNoComment             uint8 `toml:"er_column_have_no_comment"`
	ErColumnNotExisted                uint8 `toml:"er_column_not_existed"`
	ErColumnsMustHaveIndex            uint8 `toml:"er_columns_must_have_index"`
	ErColumnsMustHaveIndexTypeErr     uint8 `toml:"er_columns_must_have_index_type_err"`
	ErConCountError                   uint8 `toml:"er_con_count_error"`
	ErConflictingDeclarations         uint8 `toml:"er_conflicting_declarations"`
	ErDataTooLong                     uint8 `toml:"er_data_too_long"`
	ErDbNotExistedError               uint8 `toml:"er_db_not_existed_error"`
	ErDdlDmlCoexist                   uint8 `toml:"er_ddl_dml_coexist"`
	ErDupFieldname                    uint8 `toml:"er_dup_fieldname"`
	ErDupIndex                        uint8 `toml:"er_dup_index"`
	ErDupKeyname                      uint8 `toml:"er_dup_keyname"`
	ErEndWithCommit                   uint8 `toml:"er_end_with_commit"`
	ErEndWithSemicolon                uint8 `toml:"er_end_with_semicolon"`
	ErEngineNotSupport                uint8 `toml:"er_engine_not_support"`
	ErErrorExistBefore                uint8 `toml:"er_error_exist_before"`
	ErFieldNotInGroupBy               uint8 `toml:"er_field_not_in_group_by"`
	ErFieldSpecifiedTwice             uint8 `toml:"er_field_specified_twice"`
	ErFloatDoubleToDecimal            uint8 `toml:"er_float_double_to_decimal"`
	ErForcingClose                    uint8 `toml:"er_forcing_close"`
	ErForeignKey                      uint8 `toml:"er_foreign_key"`
	ErHaveBegin                       uint8 `toml:"er_have_begin"`
	ErHostname                        uint8 `toml:"er_hostname"`
	ErIdIsUper                        uint8 `toml:"er_id_is_uper"`
	ErIdentUseKeyword                 uint8 `toml:"er_ident_use_keyword"`
	ErIdentifierLower                 uint8 `toml:"er_identifier_lower"`
	ErIdentifierUpper                 uint8 `toml:"er_identifier_upper"`
	ErImplicitTypeConversion          uint8 `toml:"er_implicit_type_conversion"`
	ErIncInitErr                      uint8 `toml:"er_inc_init_err"`
	ErInceptionEmptyQuery             uint8 `toml:"er_inception_empty_query"`
	ErIncorrectDatetimeValue          uint8 `toml:"er_incorrect_datetime_value"`
	ErIncorrectGlobalLocalVar         uint8 `toml:"er_incorrect_global_local_var"`
	ErIndexNameIdxPrefix              uint8 `toml:"er_index_name_idx_prefix"`
	ErIndexNameUniqPrefix             uint8 `toml:"er_index_name_uniq_prefix"`
	ErIndexUseAlterTable              uint8 `toml:"er_index_use_alter_table"`
	ErInsertTooMuchRows               uint8 `toml:"er_insert_too_much_rows"`
	ErInvalidBackupHostInfo           uint8 `toml:"er_invalid_backup_host_info"`
	ErInvalidCommand                  uint8 `toml:"er_invalid_command"`
	ErInvalidDataType                 uint8 `toml:"er_invalid_data_type"`
	ErInvalidDefault                  uint8 `toml:"er_invalid_default"`
	ErInvalidGroupFuncUse             uint8 `toml:"er_invalid_group_func_use"`
	ErInvalidIdent                    uint8 `toml:"er_invalid_ident"`
	ErInvalidOnUpdate                 uint8 `toml:"er_invalid_on_update"`
	ErJoinNoOnCondition               uint8 `toml:"er_join_no_on_condition"`
	ErJsonTypeSupport                 uint8 `toml:"er_json_type_support"`
	ErKeyColumnDoesNotExits           uint8 `toml:"er_key_column_does_not_exits"`
	ErMariadbRollbackWarn             uint8 `toml:"er_mariadb_rollback_warn"`
	ErMaxColumnCount                  uint8 `toml:"er_max_column_count"`
	ErMaxVarcharLength                uint8 `toml:"er_max_varchar_length"`
	ErMixOfGroupFuncAndFields         uint8 `toml:"er_mix_of_group_func_and_fields"`
	ErMultiplePriKey                  uint8 `toml:"er_multiple_pri_key"`
	ErMustAtLeastOneColumn            uint8 `toml:"er_must_at_least_one_column"`
	ErMustHaveColumns                 uint8 `toml:"er_must_have_columns"`
	ErNetPacketsOutOfOrder            uint8 `toml:"er_net_packets_out_of_order"`
	ErNetReadError                    uint8 `toml:"er_net_read_error"`
	ErNetReadInterrupted              uint8 `toml:"er_net_read_interrupted"`
	ErNetworkReadEventChecksumFailure uint8 `toml:"er_network_read_event_checksum_failure"`
	ErNoDbError                       uint8 `toml:"er_no_db_error"`
	ErNoWhereCondition                uint8 `toml:"er_no_where_condition"`
	ErNonUniqError                    uint8 `toml:"er_non_uniq_error"`
	ErNonUniqTable                    uint8 `toml:"er_non_uniq_table"`
	ErNormalShutdown                  uint8 `toml:"er_normal_shutdown"`
	ErNotAllowedNullable              uint8 `toml:"er_not_allowed_nullable"`
	ErNotFoundMasterStatus            uint8 `toml:"er_not_found_master_status"`
	ErNotFoundTableInfo               uint8 `toml:"er_not_found_table_info"`
	ErNotSupportedAlterOption         uint8 `toml:"er_not_supported_alter_option"`
	ErNotSupportedItemType            uint8 `toml:"er_not_supported_item_type"`
	ErNotSupportedKeyType             uint8 `toml:"er_not_supported_key_type"`
	ErNotSupportedYet                 uint8 `toml:"er_not_supported_yet"`
	ErNotValidPassword                uint8 `toml:"er_not_valid_password"`
	ErOrderyByRand                    uint8 `toml:"er_ordery_by_rand"`
	ErOscKillFailed                   uint8 `toml:"er_osc_kill_failed"`
	ErOutofmemory                     uint8 `toml:"er_outofmemory"`
	ErParseError                      uint8 `toml:"er_parse_error"`
	ErPartitionNotAllowed             uint8 `toml:"er_partition_not_allowed"`
	ErPartitionNotExisted             uint8 `toml:"er_partition_not_existed"`
	ErPkColsNotInt                    uint8 `toml:"er_pk_cols_not_int"`
	ErPkTooManyParts                  uint8 `toml:"er_pk_too_many_parts"`
	ErPrimaryCantHaveNull             uint8 `toml:"er_primary_cant_have_null"`
	ErRemoteExeError                  uint8 `toml:"er_remote_exe_error"`
	ErRemovedSpaces                   uint8 `toml:"er_removed_spaces"`
	ErRepeatConstDefinition           uint8 `toml:"er_repeat_const_definition"`
	ErSameNamePartition               uint8 `toml:"er_same_name_partition"`
	ErSelectOnlyStar                  uint8 `toml:"er_select_only_star"`
	ErSetDataTypeIntBigint            uint8 `toml:"er_set_data_type_int_bigint"`
	ErShutdownComplete                uint8 `toml:"er_shutdown_complete"`
	ErSlaveCorruptEvent               uint8 `toml:"er_slave_corrupt_event"`
	ErSlaveRelayLogWriteFailure       uint8 `toml:"er_slave_relay_log_write_failure"`
	ErSqlInvalidOpType                uint8 `toml:"er_sql_invalid_op_type"`
	ErSqlInvalidSource                uint8 `toml:"er_sql_invalid_source"`
	ErSqlNoOpType                     uint8 `toml:"er_sql_no_op_type"`
	ErSqlNoSource                     uint8 `toml:"er_sql_no_source"`
	ErStartAsBegin                    uint8 `toml:"er_start_as_begin"`
	ErSyntaxError                     uint8 `toml:"er_syntax_error"`
	ErTableCantHandleAutoIncrement    uint8 `toml:"er_table_cant_handle_auto_increment"`
	ErTableCharsetMustNull            uint8 `toml:"er_table_charset_must_null"`
	ErTableCharsetMustUtf8            uint8 `toml:"er_table_charset_must_utf8"`
	ErTableCollationNotSupport        uint8 `toml:"er_table_collation_not_support"`
	ErTableExistsError                uint8 `toml:"er_table_exists_error"`
	ErTableMustHaveComment            uint8 `toml:"er_table_must_have_comment"`
	ErTableMustHavePk                 uint8 `toml:"er_table_must_have_pk"`
	ErTableNotExistedError            uint8 `toml:"er_table_not_existed_error"`
	ErTablePrefix                     uint8 `toml:"er_table_prefix"`
	ErTempTableTmpPrefix              uint8 `toml:"er_temp_table_tmp_prefix"`
	ErTextNotNullableError            uint8 `toml:"er_text_not_nullable_error"`
	ErTimestampDefault                uint8 `toml:"er_timestamp_default"`
	ErTooLongBakdbName                uint8 `toml:"er_too_long_bakdb_name"`
	ErTooLongIdent                    uint8 `toml:"er_too_long_ident"`
	ErTooLongIndexComment             uint8 `toml:"er_too_long_index_comment"`
	ErTooLongKey                      uint8 `toml:"er_too_long_key"`
	ErTooManyKeyParts                 uint8 `toml:"er_too_many_key_parts"`
	ErTooManyKeys                     uint8 `toml:"er_too_many_keys"`
	ErTooMuchAutoTimestampCols        uint8 `toml:"er_too_much_auto_timestamp_cols"`
	ErTruncatedWrongValue             uint8 `toml:"er_truncated_wrong_value"`
	ErUdpateTooMuchRows               uint8 `toml:"er_udpate_too_much_rows"`
	ErUnknownCharacterSet             uint8 `toml:"er_unknown_character_set"`
	ErUnknownCharset                  uint8 `toml:"er_unknown_charset"`
	ErUnknownCollation                uint8 `toml:"er_unknown_collation"`
	ErUnknownSystemVariable           uint8 `toml:"er_unknown_system_variable"`
	ErUnknownTable                    uint8 `toml:"er_unknown_table"`
	ErUseEnum                         uint8 `toml:"er_use_enum"`
	ErUseIndexVisibility              uint8 `toml:"er_use_index_visibility"`
	ErUseTextOrBlob                   uint8 `toml:"er_use_text_or_blob"`
	ErUseValueExpr                    uint8 `toml:"er_use_value_expr"`
	ErUsername                        uint8 `toml:"er_username"`
	ErVarcharToTextLen                uint8 `toml:"er_varchar_to_text_len"`
	ErViewSelectClause                uint8 `toml:"er_view_select_clause"`
	ErViewSupport                     uint8 `toml:"er_view_support"`
	ErWithDefaultAddColumn            uint8 `toml:"er_with_default_add_column"`
	ErWithInsertField                 uint8 `toml:"er_with_insert_field"`
	ErWithInsertValues                uint8 `toml:"er_with_insert_values"`
	ErWithLimitCondition              uint8 `toml:"er_with_limit_condition"`
	ErWithOrderbyCondition            uint8 `toml:"er_with_orderby_condition"`
	ErWrongAndExpr                    uint8 `toml:"er_wrong_and_expr"`
	ErWrongArguments                  uint8 `toml:"er_wrong_arguments"`
	ErWrongAutoKey                    uint8 `toml:"er_wrong_auto_key"`
	ErWrongColumnName                 uint8 `toml:"er_wrong_column_name"`
	ErWrongDbName                     uint8 `toml:"er_wrong_db_name"`
	ErWrongKeyColumn                  uint8 `toml:"er_wrong_key_column"`
	ErWrongNameForIndex               uint8 `toml:"er_wrong_name_for_index"`
	ErWrongStringLength               uint8 `toml:"er_wrong_string_length"`
	ErWrongSubKey                     uint8 `toml:"er_wrong_sub_key"`
	ErWrongTableName                  uint8 `toml:"er_wrong_table_name"`
	ErWrongUsage                      uint8 `toml:"er_wrong_usage"`
	ErWrongValueCountOnRow            uint8 `toml:"er_wrong_value_count_on_row"`
	ErWrongValueForVar                uint8 `toml:"er_wrong_value_for_var"`
}

type Log

type Log struct {
	// Log level.
	Level string `toml:"level" json:"level"`
	// Log format. one of json, text, or console.
	Format string `toml:"format" json:"format"`
	// Disable automatic timestamps in output.
	DisableTimestamp bool `toml:"disable-timestamp" json:"disable-timestamp"`
	// File log config.
	File logutil.FileLogConfig `toml:"file" json:"file"`

	ExpensiveThreshold uint `toml:"expensive-threshold" json:"expensive-threshold"`
	QueryLogMaxLen     uint `toml:"query-log-max-len" json:"query-log-max-len"`
}

Log is the log section of config.

func (*Log) ToLogConfig

func (l *Log) ToLogConfig() *logutil.LogConfig

ToLogConfig converts *Log to *logutil.LogConfig.

type Osc

type Osc struct {

	// 用来设置在arkit返回结果集中,对于原来OSC在执行过程的标准输出信息是不是要打印到结果集对应的错误信息列中,
	// 如果设置为1,就不打印,如果设置为0,就打印。而如果出现了错误,则都会打印。默认值:OFF
	OscPrintNone bool `toml:"osc_print_none" json:"osc_print_none"`

	// 对应参数pt-online-schema-change中的参数--print。默认值:OFF
	OscPrintSql bool `toml:"osc_print_sql" json:"osc_print_sql"`

	// 全局的OSC开关,默认是打开的,如果想要关闭则设置为OFF,这样就会直接修改。默认值:OFF
	OscOn bool `toml:"osc_on" json:"osc_on"`

	// 这个参数实际上是一个OSC开关,如果设置为0,则全部ALTER语句都使用OSC方式,
	// 如果设置为非0,则当这个表占用空间大小大于这个值时才使用OSC方式。
	// 单位为M,这个表大小的计算方式是通过语句
	// select (DATA_LENGTH + INDEX_LENGTH)/1024/1024 from information_schema.tables
	// where table_schema = 'dbname' and table_name = 'tablename' 来实现的。默认值:16
	// [0-1048576]
	OscMinTableSize uint `toml:"osc_min_table_size" json:"osc_min_table_size"`

	// 对应参数pt-online-schema-change中的参数alter-foreign-keys-method,具体意义可以参考OSC官方手册。默认值:none
	// [auto | none | rebuild_constraints | drop_swap]
	OscAlterForeignKeysMethod string `toml:"osc_alter_foreign_keys_method" json:"osc_alter_foreign_keys_method"`

	// 对应参数pt-online-schema-change中的参数recursion_method,具体意义可以参考OSC官方手册。默认值:processlist
	// [processlist | hosts | none]
	OscRecursionMethod string `toml:"osc_recursion_method" json:"osc_recursion_method"`

	// 对应参数pt-online-schema-change中的参数--max-lag。默认值:3
	OscMaxLag int `toml:"osc_max_lag" json:"osc_max_lag"`

	// 类似--max-lag,检查集群暂停流量控制所花费的平均时间(仅适用于PXC 5.6及以上版本)
	OscMaxFlowCtl int `toml:"osc_max_flow_ctl" json:"osc_max_flow_ctl"`

	// 对应参数pt-online-schema-change中的参数--[no]check-alter。默认值:ON
	OscCheckAlter bool `toml:"osc_check_alter" json:"osc_check_alter"`

	// 对应参数pt-online-schema-change中的参数 --sleep 默认值:0.0
	OscSleep float32 `toml:"osc_sleep" json:"osc_sleep"`

	// 对应参数pt-online-schema-change中的参数 --set-vars lock_wait_timeout=60s
	OscLockWaitTimeout int `toml:"osc_lock_wait_timeout" json:"osc_lock_wait_timeout"`

	// 对应参数pt-online-schema-change中的参数--[no]check-replication-filters。默认值:ON
	OscCheckReplicationFilters bool `toml:"osc_check_replication_filters" json:"osc_check_replication_filters"`
	// 是否检查唯一索引,默认检查,如果是,则禁止
	OscCheckUniqueKeyChange bool `toml:"osc_check_unique_key_change" json:"osc_check_unique_key_change"`

	// 对应参数pt-online-schema-change中的参数--[no]drop-old-table。默认值:ON
	OscDropOldTable bool `toml:"osc_drop_old_table" json:"osc_drop_old_table"`

	// 对应参数pt-online-schema-change中的参数--[no]drop-new-table。默认值:ON
	OscDropNewTable bool `toml:"osc_drop_new_table" json:"osc_drop_new_table"`

	// 对应参数pt-online-schema-change中的参数--max-load中的thread_running部分。默认值:80
	OscMaxThreadRunning int `toml:"osc_max_thread_running" json:"osc_max_thread_running"`

	// 对应参数pt-online-schema-change中的参数--max-load中的thread_connected部分。默认值:1000
	OscMaxThreadConnected int `toml:"osc_max_thread_connected" json:"osc_max_thread_connected"`

	// 对应参数pt-online-schema-change中的参数--critical-load中的thread_running部分。默认值:80
	OscCriticalThreadRunning int `toml:"osc_critical_thread_running" json:"osc_critical_thread_running"`

	// 对应参数pt-online-schema-change中的参数--critical-load中的thread_connected部分。默认值:1000
	OscCriticalThreadConnected int `toml:"osc_critical_thread_connected" json:"osc_critical_thread_connected"`

	// 对应参数pt-online-schema-change中的参数--chunk-time。默认值:1
	OscChunkTime float32 `toml:"osc_chunk_time" json:"osc_chunk_time"`

	// 对应参数pt-online-schema-change中的参数--chunk-size-limit。默认值:4
	OscChunkSizeLimit int `toml:"osc_chunk_size_limit" json:"osc_chunk_size_limit"`

	// 对应参数pt-online-schema-change中的参数--chunk-size。默认值:1000
	OscChunkSize int `toml:"osc_chunk_size" json:"osc_chunk_size"`

	// 对应参数pt-online-schema-change中的参数--check-interval,意义是Sleep time between checks for --max-lag。默认值:5
	OscCheckInterval int `toml:"osc_check_interval" json:"osc_check_interval"`

	OscBinDir string `toml:"osc_bin_dir" json:"osc_bin_dir"`
}

Osc online schema change 工具参数配置

type Performance

type Performance struct {
	MaxProcs            uint    `toml:"max-procs" json:"max-procs"`
	TCPKeepAlive        bool    `toml:"tcp-keep-alive" json:"tcp-keep-alive"`
	CrossJoin           bool    `toml:"cross-join" json:"cross-join"`
	StatsLease          string  `toml:"stats-lease" json:"stats-lease"`
	RunAutoAnalyze      bool    `toml:"run-auto-analyze" json:"run-auto-analyze"`
	StmtCountLimit      uint    `toml:"stmt-count-limit" json:"stmt-count-limit"`
	FeedbackProbability float64 `toml:"feedback-probability" json:"feedback-probability"`
	QueryFeedbackLimit  uint    `toml:"query-feedback-limit" json:"query-feedback-limit"`
	PseudoEstimateRatio float64 `toml:"pseudo-estimate-ratio" json:"pseudo-estimate-ratio"`
	ForcePriority       string  `toml:"force-priority" json:"force-priority"`
}

Performance is the performance section of the config.

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"`
}

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"`
}

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"`
}

Security is the security section of the config.

func (*Security) ToTLSConfig

func (s *Security) ToTLSConfig() (*tls.Config, error)

ToTLSConfig generates tls's config based on security section of the config.

type Status

type Status struct {
	ReportStatus bool `toml:"report-status" json:"report-status"`
	StatusPort   uint `toml:"status-port" json:"status-port"`
}

Status is the status section of the config.

type TiKVClient

type TiKVClient struct {
	// GrpcConnectionCount is the max gRPC connections that will be established
	// with each tikv-server.
	GrpcConnectionCount uint `toml:"grpc-connection-count" json:"grpc-connection-count"`
	// After a duration of this time in seconds if the client doesn't see any activity it pings
	// the server 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 client 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"`
	// CommitTimeout is the max time which command 'commit' will wait.
	CommitTimeout string `toml:"commit-timeout" json:"commit-timeout"`
}

TiKVClient is the config for tikv client.

type TxnLocalLatches

type TxnLocalLatches struct {
	Enabled  bool `toml:"enabled" json:"enabled"`
	Capacity uint `toml:"capacity" json:"capacity"`
}

TxnLocalLatches is the TxnLocalLatches section of the config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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