diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..1db62f3da --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +# Copyright 2021 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include Makefile.common + +.PHONY: server + +default: server buildsucc + +CURDIR := $(shell pwd) +path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))):$(PWD)/tools/bin +export PATH := $(path_to_add):$(PATH) + +GO := GO111MODULE=on go +GOBUILD := $(GO) build $(BUILD_FLAG) -tags codes + +RACE_FLAG = +ifeq ("$(WITH_RACE)", "1") + RACE_FLAG = -race + GOBUILD = GOPATH=$(GOPATH) $(GO) build +endif + +buildsucc: + @echo Build TinySQL Server successfully! + +server: + CGO_ENABLED=1 $(GOBUILD) $(RACE_FLAG) -o bin/tinysql-server tinysql-server/main.go + +fmt: + @echo "gofmt (simplify)" + @gofmt -s -l -w $(FILES) 2>&1 | $(FAIL_ON_STDOUT) + diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 000000000..cedc39972 --- /dev/null +++ b/Makefile.common @@ -0,0 +1,67 @@ +# Copyright 2021 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +PROJECT=tinysql +GOPATH ?= $(shell go env GOPATH) +P=8 + +# Ensure GOPATH is set before running build process. +ifeq "$(GOPATH)" "" + $(error Please set the environment variable GOPATH before running `make`) +endif +FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }' + +CURDIR := $(shell pwd) +path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))):$(PWD)/tools/bin +export PATH := $(path_to_add):$(PATH) + +GO := GO111MODULE=on go +GOBUILD := $(GO) build $(BUILD_FLAG) -tags codes +GOBUILDCOVERAGE := GOPATH=$(GOPATH) cd tinysql-server; $(GO) test -coverpkg="../..." -c . +GOTEST := $(GO) test -p $(P) +OVERALLS := GO111MODULE=on overalls +STATICCHECK := GO111MODULE=on staticcheck + +ARCH := "`uname -s`" +LINUX := "Linux" +MAC := "Darwin" +PACKAGE_LIST := go list ./... +PACKAGES ?= $$($(PACKAGE_LIST)) +PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|$(PROJECT)/||' +FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go") +UNCONVERT_PACKAGES_LIST := go list ./...| grep -vE "lightning\/checkpoints|lightning\/manual|lightning\/common" +UNCONVERT_PACKAGES := $$($(UNCONVERT_PACKAGES_LIST)) + +FAILPOINT_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl enable) +FAILPOINT_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable) + +CHECK_LDFLAGS += $(LDFLAGS) ${TEST_LDFLAGS} + +TARGET = "" + +# VB = Vector Benchmark +VB_FILE = +VB_FUNC = + +RACE_FLAG = +ifeq ("$(WITH_RACE)", "1") + RACE_FLAG = -race + GOBUILD = GOPATH=$(GOPATH) $(GO) build +endif + +CHECK_FLAG = +ifeq ("$(WITH_CHECK)", "1") + CHECK_FLAG = $(TEST_LDFLAGS) +endif diff --git a/config/config.go b/config/config.go new file mode 100644 index 000000000..baadf6129 --- /dev/null +++ b/config/config.go @@ -0,0 +1,1053 @@ +// Copyright 2017 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "os" + "os/user" + "path/filepath" + "strings" + "sync/atomic" + "time" + + "github.com/BurntSushi/toml" + "github.com/pingcap/errors" + zaplog "github.com/pingcap/log" + log "github.com/sirupsen/logrus" + "tinysql/util/logutil" + //"github.com/pingcap/tidb/util/versioninfo" + tikvcfg "github.com/tikv/client-go/v2/config" + tracing "github.com/uber/jaeger-client-go/config" + "go.uber.org/zap" +) + +// Config number limitations +const ( + MaxLogFileSize = 4096 // MB + // DefTxnEntrySizeLimit is the default value of TxnEntrySizeLimit. + DefTxnEntrySizeLimit = 6 * 1024 * 1024 + // DefTxnTotalSizeLimit is the default value of TxnTxnTotalSizeLimit. + DefTxnTotalSizeLimit = 100 * 1024 * 1024 + // 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 +) + +// Valid config maps +var ( + ValidStorage = map[string]bool{ + "mocktikv": true, + "tikv": true, + "unistore": true, + } + // CheckTableBeforeDrop enable to execute `admin check table` before `drop table`. + CheckTableBeforeDrop = false + // checkBeforeDropLDFlag is a go build flag. + checkBeforeDropLDFlag = "None" + // tempStorageDirName is the default temporary storage dir name by base64 encoding a string `port/statusPort` + tempStorageDirName = encodeDefTempStorageDir(os.TempDir(), DefHost, DefStatusHost, DefPort, DefStatusPort) +) + +// Config contains configuration options. +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 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"` + OOMUseTmpStorage bool `toml:"oom-use-tmp-storage" json:"oom-use-tmp-storage"` + TempStoragePath string `toml:"tmp-storage-path" json:"tmp-storage-path"` + OOMAction string `toml:"oom-action" json:"oom-action"` + MemQuotaQuery int64 `toml:"mem-quota-query" json:"mem-quota-query"` + // TempStorageQuota describe the temporary storage Quota during query exector when OOMUseTmpStorage 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 + // Deprecated + EnableStreaming bool `toml:"-" json:"-"` + EnableBatchDML bool `toml:"enable-batch-dml" json:"enable-batch-dml"` + TxnLocalLatches tikvcfg.TxnLocalLatches `toml:"-" json:"-"` + // 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"` + ServerVersion string `toml:"server-version" json:"server-version"` + 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"` + 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"` + Binlog Binlog `toml:"binlog" json:"binlog"` + CompatibleKillQuery bool `toml:"compatible-kill-query" json:"compatible-kill-query"` + Plugin Plugin `toml:"plugin" json:"plugin"` + PessimisticTxn PessimisticTxn `toml:"pessimistic-txn" json:"pessimistic-txn"` + CheckMb4ValueInUTF8 bool `toml:"check-mb4-value-in-utf8" json:"check-mb4-value-in-utf8"` + 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"` + StmtSummary StmtSummary `toml:"stmt-summary" json:"stmt-summary"` + // 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"` + // MaxServerConnections is the maximum permitted number of simultaneous client connections. + MaxServerConnections uint32 `toml:"max-server-connections" json:"max-server-connections"` + // 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"` + // EnableCollectExecutionInfo enables the TiDB to collect execution info. + EnableCollectExecutionInfo bool `toml:"enable-collect-execution-info" json:"enable-collect-execution-info"` + // 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. + 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 enables creating global index. + 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"` +} + +// 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. +func (c *Config) UpdateTempStoragePath() { + if c.TempStoragePath == tempStorageDirName { + c.TempStoragePath = encodeDefTempStorageDir(os.TempDir(), c.Host, c.Status.StatusHost, c.Port, c.Status.StatusPort) + } else { + c.TempStoragePath = encodeDefTempStorageDir(c.TempStoragePath, c.Host, c.Status.StatusHost, c.Port, c.Status.StatusPort) + } +} + +func (c *Config) getTiKVConfig() *tikvcfg.Config { + return &tikvcfg.Config{ + CommitterConcurrency: c.Performance.CommitterConcurrency, + MaxTxnTTL: c.Performance.MaxTxnTTL, + TiKVClient: c.TiKVClient, + Security: c.Security.ClusterSecurity(), + PDClient: c.PDClient, + PessimisticTxn: tikvcfg.PessimisticTxn{MaxRetryCount: c.PessimisticTxn.MaxRetryCount}, + TxnLocalLatches: c.TxnLocalLatches, + StoresRefreshInterval: c.StoresRefreshInterval, + OpenTracingEnable: c.OpenTracing.Enable, + Path: c.Path, + EnableForwarding: c.EnableForwarding, + TxnScope: c.Labels["zone"], + } +} + +func encodeDefTempStorageDir(tempDir string, host, statusHost string, port, statusPort uint) string { + dirName := base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("%v:%v/%v:%v", host, port, statusHost, statusPort))) + var osUID string + currentUser, err := user.Current() + if err != nil { + osUID = "" + } else { + osUID = currentUser.Uid + } + return filepath.Join(tempDir, osUID+"_tidb", dirName, "tmp-storage") +} + +// nullableBool defaults unset bool options to unset instead of false, which enables us to know if the user has set 2 +// conflict options at the same time. +type nullableBool struct { + IsValid bool + IsTrue bool +} + +var ( + nbUnset = nullableBool{false, false} + nbFalse = nullableBool{true, false} + nbTrue = nullableBool{true, true} +) + +func (b *nullableBool) toBool() bool { + return b.IsValid && b.IsTrue +} + +func (b nullableBool) MarshalJSON() ([]byte, error) { + switch b { + case nbTrue: + return json.Marshal(true) + case nbFalse: + return json.Marshal(false) + default: + return json.Marshal(nil) + } +} + +func (b *nullableBool) UnmarshalText(text []byte) error { + str := string(text) + switch str { + case "", "null": + *b = nbUnset + return nil + case "true": + *b = nbTrue + case "false": + *b = nbFalse + default: + *b = nbUnset + return errors.New("Invalid value for bool type: " + str) + } + return nil +} + +func (b nullableBool) MarshalText() ([]byte, error) { + if !b.IsValid { + return []byte(""), nil + } + if b.IsTrue { + return []byte("true"), nil + } + return []byte("false"), nil +} + +func (b *nullableBool) UnmarshalJSON(data []byte) error { + var err error + var v interface{} + if err = json.Unmarshal(data, &v); err != nil { + return err + } + switch raw := v.(type) { + case bool: + *b = nullableBool{true, raw} + default: + *b = nbUnset + } + return err +} + +// Log is the log section of config. +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"` + + EnableSlowLog bool `toml:"enable-slow-log" json:"enable-slow-log"` + SlowQueryFile string `toml:"slow-query-file" json:"slow-query-file"` + SlowThreshold uint64 `toml:"slow-threshold" json:"slow-threshold"` + ExpensiveThreshold uint `toml:"expensive-threshold" json:"expensive-threshold"` + QueryLogMaxLen uint64 `toml:"query-log-max-len" json:"query-log-max-len"` + RecordPlanInSlowLog uint32 `toml:"record-plan-in-slow-log" json:"record-plan-in-slow-log"` +} + +func (l *Log) getDisableTimestamp() bool { + if l.EnableTimestamp == nbUnset && l.DisableTimestamp == nbUnset { + return false + } + if l.EnableTimestamp == nbUnset { + return l.DisableTimestamp.toBool() + } + return !l.EnableTimestamp.toBool() +} + +func (l *Log) getDisableErrorStack() bool { + if l.EnableErrorStack == nbUnset && l.DisableErrorStack == nbUnset { + return true + } + if l.EnableErrorStack == nbUnset { + return l.DisableErrorStack.toBool() + } + return !l.EnableErrorStack.toBool() +} + +// 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 ( + SpilledFileEncryptionMethodPlaintext = "plaintext" + SpilledFileEncryptionMethodAES128CTR = "aes128-ctr" +) + +// Security is the security section of the config. +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"` + RequireSecureTransport bool `toml:"require-secure-transport" json:"require-secure-transport"` + 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"` + // 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"` +} + +// 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. +type ErrConfigValidationFailed struct { + confFile string + UndecodedItems []string +} + +func (e *ErrConfigValidationFailed) Error() string { + return fmt.Sprintf("config file %s contained invalid configuration options: %s; check "+ + "TiDB manual to make sure this option has not been deprecated and removed from your TiDB "+ + "version if the option does not appear to be a typo", e.confFile, strings.Join( + e.UndecodedItems, ", ")) +} + +// ClusterSecurity returns Security info for cluster +func (s *Security) ClusterSecurity() tikvcfg.Security { + return tikvcfg.NewSecurity(s.ClusterSSLCA, s.ClusterSSLCert, s.ClusterSSLKey, s.ClusterVerifyCN) +} + +// Status is the status section of the config. +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"` +} + +// Performance is the performance section of the config. +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"` + MemoryUsageAlarmRatio float64 `toml:"memory-usage-alarm-ratio" json:"memory-usage-alarm-ratio"` + StatsLease string `toml:"stats-lease" json:"stats-lease"` + 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"` + 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"` + RunAutoAnalyze bool `toml:"run-auto-analyze" json:"run-auto-analyze"` + DistinctAggPushDown bool `toml:"distinct-agg-push-down" json:"distinct-agg-push-down"` + CommitterConcurrency int `toml:"committer-concurrency" json:"committer-concurrency"` + MaxTxnTTL uint64 `toml:"max-txn-ttl" json:"max-txn-ttl"` + MemProfileInterval string `toml:"mem-profile-interval" json:"mem-profile-interval"` + IndexUsageSyncLease string `toml:"index-usage-sync-lease" json:"index-usage-sync-lease"` + GOGC int `toml:"gogc" json:"gogc"` + EnforceMPP bool `toml:"enforce-mpp" json:"enforce-mpp"` +} + +// PlanCache is the PlanCache section of the config. +type PlanCache struct { + Enabled bool `toml:"enabled" json:"enabled"` + Capacity uint `toml:"capacity" json:"capacity"` + Shards uint `toml:"shards" json:"shards"` +} + +// PreparedPlanCache is the PreparedPlanCache section of the config. +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"` +} + +// OpenTracing is the opentracing section of the config. +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"` +} + +// OpenTracingSampler is the config for opentracing sampler. +// See https://godoc.org/github.com/uber/jaeger-client-go/config#SamplerConfig +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"` +} + +// OpenTracingReporter is the config for opentracing reporter. +// See https://godoc.org/github.com/uber/jaeger-client-go/config#ReporterConfig +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"` +} + +// ProxyProtocol is the PROXY protocol section of the config. +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"` +} + +// Binlog is the config for binlog. +type Binlog struct { + Enable bool `toml:"enable" json:"enable"` + // If IgnoreError is true, when writing binlog meets error, TiDB would + // ignore the error. + IgnoreError bool `toml:"ignore-error" json:"ignore-error"` + WriteTimeout string `toml:"write-timeout" json:"write-timeout"` + // Use socket file to write binlog, for compatible with kafka version tidb-binlog. + BinlogSocket string `toml:"binlog-socket" json:"binlog-socket"` + // The strategy for sending binlog to pump, value can be "range" or "hash" now. + Strategy string `toml:"strategy" json:"strategy"` +} + +// PessimisticTxn is the config for pessimistic transaction. +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"` +} + +// DefaultPessimisticTxn returns the default configuration for PessimisticTxn +func DefaultPessimisticTxn() PessimisticTxn { + return PessimisticTxn{ + MaxRetryCount: 256, + DeadlockHistoryCapacity: 10, + DeadlockHistoryCollectRetryable: false, + } +} + +// Plugin is the config for plugin +type Plugin struct { + Dir string `toml:"dir" json:"dir"` + Load string `toml:"load" json:"load"` +} + +// StmtSummary is the config for statement summary. +type StmtSummary struct { + // Enable statement summary or not. + Enable bool `toml:"enable" json:"enable"` + // Enable summary internal query. + EnableInternalQuery bool `toml:"enable-internal-query" json:"enable-internal-query"` + // The maximum number of statements kept in memory. + MaxStmtCount uint `toml:"max-stmt-count" json:"max-stmt-count"` + // The maximum length of displayed normalized SQL and sample SQL. + MaxSQLLength uint `toml:"max-sql-length" json:"max-sql-length"` + // The refresh interval of statement summary. + RefreshInterval int `toml:"refresh-interval" json:"refresh-interval"` + // The maximum history size of statement summary. + HistorySize int `toml:"history-size" json:"history-size"` +} + +// IsolationRead is the config for isolation read. +type IsolationRead struct { + // Engines filters tidb-server access paths by engine type. + Engines []string `toml:"engines" json:"engines"` +} + +// 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 Experimental struct { + // Whether enable global kill. + EnableGlobalKill bool `toml:"enable-global-kill" json:"-"` + // Whether enable charset feature. + EnableNewCharset bool `toml:"enable-new-charset" json:"-"` +} + +var defTiKVCfg = tikvcfg.DefaultConfig() +var defaultConf = Config{ + Host: DefHost, + AdvertiseAddress: "", + Port: DefPort, + Cors: "", + Store: "unistore", + Path: "/tmp/tidb", + RunDDL: true, + SplitTable: true, + Lease: "45s", + TokenLimit: 1000, + OOMUseTmpStorage: true, + TempStorageQuota: -1, + TempStoragePath: tempStorageDirName, + OOMAction: OOMActionCancel, + MemQuotaQuery: 1 << 30, + EnableStreaming: false, + EnableBatchDML: false, + CheckMb4ValueInUTF8: true, + MaxIndexLength: 3072, + IndexLimit: 64, + TableColumnCountLimit: 1017, + AlterPrimaryKey: false, + TreatOldVersionUTF8AsUTF8MB4: true, + EnableTableLock: false, + DelayCleanTableLock: 0, + SplitRegionMaxNum: 1000, + RepairMode: false, + RepairTableList: []string{}, + MaxServerConnections: 0, + TxnLocalLatches: defTiKVCfg.TxnLocalLatches, + LowerCaseTableNames: 2, + GracefulWaitBeforeShutdown: 0, + ServerVersion: "", + Log: Log{ + Level: "info", + Format: "text", + File: logutil.NewFileLogConfig(logutil.DefaultLogMaxSize), + SlowQueryFile: "tidb-slow.log", + SlowThreshold: logutil.DefaultSlowThreshold, + ExpensiveThreshold: 10000, + DisableErrorStack: nbUnset, + EnableErrorStack: nbUnset, // If both options are nbUnset, getDisableErrorStack() returns true + EnableTimestamp: nbUnset, + DisableTimestamp: nbUnset, // If both options are nbUnset, getDisableTimestamp() returns false + QueryLogMaxLen: logutil.DefaultQueryLogMaxLen, + RecordPlanInSlowLog: logutil.DefaultRecordPlanInSlowLog, + EnableSlowLog: logutil.DefaultTiDBEnableSlowLog, + }, + Status: Status{ + ReportStatus: true, + StatusHost: DefStatusHost, + StatusPort: DefStatusPort, + MetricsInterval: 15, + RecordQPSbyDB: false, + }, + Performance: Performance{ + MaxMemory: 0, + ServerMemoryQuota: 0, + MemoryUsageAlarmRatio: 0.8, + TCPKeepAlive: true, + TCPNoDelay: true, + CrossJoin: true, + StatsLease: "3s", + RunAutoAnalyze: true, + StmtCountLimit: 5000, + FeedbackProbability: 0.0, + QueryFeedbackLimit: 512, + PseudoEstimateRatio: 0.8, + ForcePriority: "NO_PRIORITY", + BindInfoLease: "3s", + TxnEntrySizeLimit: DefTxnEntrySizeLimit, + TxnTotalSizeLimit: DefTxnTotalSizeLimit, + DistinctAggPushDown: false, + CommitterConcurrency: defTiKVCfg.CommitterConcurrency, + MaxTxnTTL: defTiKVCfg.MaxTxnTTL, // 1hour + MemProfileInterval: "1m", + // TODO: set indexUsageSyncLease to 60s. + IndexUsageSyncLease: "0s", + GOGC: 100, + EnforceMPP: false, + }, + ProxyProtocol: ProxyProtocol{ + Networks: "", + HeaderTimeout: 5, + }, + PreparedPlanCache: PreparedPlanCache{ + Enabled: false, + Capacity: 100, + MemoryGuardRatio: 0.1, + }, + OpenTracing: OpenTracing{ + Enable: false, + Sampler: OpenTracingSampler{ + Type: "const", + Param: 1.0, + }, + Reporter: OpenTracingReporter{}, + }, + PDClient: defTiKVCfg.PDClient, + TiKVClient: defTiKVCfg.TiKVClient, + Binlog: Binlog{ + WriteTimeout: "15s", + Strategy: "range", + }, + PessimisticTxn: DefaultPessimisticTxn(), + StmtSummary: StmtSummary{ + Enable: true, + EnableInternalQuery: false, + MaxStmtCount: 3000, + MaxSQLLength: 4096, + RefreshInterval: 1800, + HistorySize: 24, + }, + IsolationRead: IsolationRead{ + Engines: []string{"tikv", "tiflash", "tidb"}, + }, + Experimental: Experimental{ + EnableGlobalKill: false, + EnableNewCharset: false, + }, + EnableCollectExecutionInfo: true, + EnableTelemetry: true, + Labels: make(map[string]string), + EnableGlobalIndex: false, + Security: Security{ + SpilledFileEncryptionMethod: SpilledFileEncryptionMethodPlaintext, + EnableSEM: false, + AutoTLS: true, + RSAKeySize: 4096, + }, + DeprecateIntegerDisplayWidth: false, + EnableEnumLengthLimit: true, + StoresRefreshInterval: defTiKVCfg.StoresRefreshInterval, + EnableForwarding: defTiKVCfg.EnableForwarding, +} + +var ( + globalConf atomic.Value +) + +// NewConfig creates a new config instance with default value. +func NewConfig() *Config { + conf := defaultConf + return &conf +} + +// 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 GetGlobalConfig() *Config { + return globalConf.Load().(*Config) +} + +// StoreGlobalConfig stores a new config to the globalConf. It mostly uses in the test to avoid some data races. +func StoreGlobalConfig(config *Config) { + globalConf.Store(config) + cfg := *config.getTiKVConfig() + tikvcfg.StoreGlobalConfig(&cfg) +} + +var deprecatedConfig = map[string]struct{}{ + "pessimistic-txn.ttl": {}, + "pessimistic-txn.enable": {}, + "log.file.log-rotate": {}, + "log.log-slow-query": {}, + "txn-local-latches": {}, + "txn-local-latches.enabled": {}, + "txn-local-latches.capacity": {}, + "performance.max-memory": {}, + "max-txn-time-use": {}, + "experimental.allow-auto-random": {}, + "enable-redact-log": {}, // use variable tidb_redact_log instead + "tikv-client.copr-cache.enable": {}, + "alter-primary-key": {}, // use NONCLUSTERED keyword instead + "enable-streaming": {}, + "experimental.allow-expression-index": {}, +} + +func isAllDeprecatedConfigItems(items []string) bool { + for _, item := range items { + if _, ok := deprecatedConfig[item]; !ok { + return false + } + } + return true +} + +// IsMemoryQuotaQuerySetByUser indicates whether the config item mem-quota-query +// is set by the user. +var IsMemoryQuotaQuerySetByUser bool + +// IsOOMActionSetByUser indicates whether the config item mem-action is set by +// the user. +var IsOOMActionSetByUser bool + +// 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 InitializeConfig(confPath string, configCheck, configStrict bool, enforceCmdArgs func(*Config)) { + cfg := GetGlobalConfig() + var err error + if confPath != "" { + if err = cfg.Load(confPath); err != nil { + // Unused config item error turns to warnings. + if tmp, ok := err.(*ErrConfigValidationFailed); ok { + // This block is to accommodate an interim situation where strict config checking + // is not the default behavior of TiDB. The warning message must be deferred until + // logging has been set up. After strict config checking is the default behavior, + // This should all be removed. + if (!configCheck && !configStrict) || isAllDeprecatedConfigItems(tmp.UndecodedItems) { + fmt.Fprintln(os.Stderr, err.Error()) + err = nil + } + } + } + + log.Fatalf(errors.ErrorStack(err)) + // terror.MustNil(err) + } else { + // configCheck should have the config file specified. + if configCheck { + fmt.Fprintln(os.Stderr, "config check failed", errors.New("no config file specified for config-check")) + os.Exit(1) + } + } + enforceCmdArgs(cfg) + + if err := cfg.Valid(); err != nil { + if !filepath.IsAbs(confPath) { + if tmp, err := filepath.Abs(confPath); err == nil { + confPath = tmp + } + } + fmt.Fprintln(os.Stderr, "load config file:", confPath) + fmt.Fprintln(os.Stderr, "invalid config", err) + os.Exit(1) + } + if configCheck { + fmt.Println("config check successful") + os.Exit(0) + } + StoreGlobalConfig(cfg) +} + +// Load loads config options from a toml file. +func (c *Config) Load(confFile string) error { + metaData, err := toml.DecodeFile(confFile, c) + if c.TokenLimit == 0 { + c.TokenLimit = 1000 + } + if metaData.IsDefined("mem-quota-query") { + IsMemoryQuotaQuerySetByUser = true + } + if metaData.IsDefined("oom-action") { + IsOOMActionSetByUser = true + } + // If any items in confFile file are not mapped into the Config struct, issue + // an error and stop the server from starting. + undecoded := metaData.Undecoded() + if len(undecoded) > 0 && err == nil { + var undecodedItems []string + for _, item := range undecoded { + undecodedItems = append(undecodedItems, item.String()) + } + err = &ErrConfigValidationFailed{confFile, undecodedItems} + } + + return err +} + +// Valid checks if this config is valid. +func (c *Config) Valid() error { + if c.Log.EnableErrorStack == c.Log.DisableErrorStack && c.Log.EnableErrorStack != nbUnset { + logutil.BgLogger().Warn(fmt.Sprintf("\"enable-error-stack\" (%v) conflicts \"disable-error-stack\" (%v). \"disable-error-stack\" is deprecated, please use \"enable-error-stack\" instead. disable-error-stack is ignored.", c.Log.EnableErrorStack, c.Log.DisableErrorStack)) + // if two options conflict, we will use the value of EnableErrorStack + c.Log.DisableErrorStack = nbUnset + } + if c.Log.EnableTimestamp == c.Log.DisableTimestamp && c.Log.EnableTimestamp != nbUnset { + logutil.BgLogger().Warn(fmt.Sprintf("\"enable-timestamp\" (%v) conflicts \"disable-timestamp\" (%v). \"disable-timestamp\" is deprecated, please use \"enable-timestamp\" instead", c.Log.EnableTimestamp, c.Log.DisableTimestamp)) + // if two options conflict, we will use the value of EnableTimestamp + c.Log.DisableTimestamp = nbUnset + } + if c.Security.SkipGrantTable && !hasRootPrivilege() { + return fmt.Errorf("TiDB run with skip-grant-table need root privilege") + } + if !ValidStorage[c.Store] { + nameList := make([]string, 0, len(ValidStorage)) + for k, v := range ValidStorage { + if v { + nameList = append(nameList, k) + } + } + return fmt.Errorf("invalid store=%s, valid storages=%v", c.Store, nameList) + } + if c.Store == "mocktikv" && !c.RunDDL { + return fmt.Errorf("can't disable DDL on mocktikv") + } + if c.MaxIndexLength < DefMaxIndexLength || c.MaxIndexLength > DefMaxOfMaxIndexLength { + return fmt.Errorf("max-index-length should be [%d, %d]", DefMaxIndexLength, DefMaxOfMaxIndexLength) + } + if c.IndexLimit < DefIndexLimit || c.IndexLimit > DefMaxOfIndexLimit { + return fmt.Errorf("index-limit should be [%d, %d]", DefIndexLimit, DefMaxOfIndexLimit) + } + if c.Log.File.MaxSize > MaxLogFileSize { + return fmt.Errorf("invalid max log file size=%v which is larger than max=%v", c.Log.File.MaxSize, MaxLogFileSize) + } + c.OOMAction = strings.ToLower(c.OOMAction) + if c.OOMAction != OOMActionLog && c.OOMAction != OOMActionCancel { + return fmt.Errorf("unsupported OOMAction %v, TiDB only supports [%v, %v]", c.OOMAction, OOMActionLog, OOMActionCancel) + } + if c.TableColumnCountLimit < DefTableColumnCountLimit || c.TableColumnCountLimit > DefMaxOfTableColumnCountLimit { + return fmt.Errorf("table-column-limit should be [%d, %d]", DefIndexLimit, DefMaxOfTableColumnCountLimit) + } + + // lower_case_table_names is allowed to be 0, 1, 2 + if c.LowerCaseTableNames < 0 || c.LowerCaseTableNames > 2 { + return fmt.Errorf("lower-case-table-names should be 0 or 1 or 2") + } + + // txn-local-latches + if err := c.TxnLocalLatches.Valid(); err != nil { + return err + } + + // For tikvclient. + if err := c.TiKVClient.Valid(); err != nil { + return err + } + + if c.Performance.TxnTotalSizeLimit > 1<<40 { + return fmt.Errorf("txn-total-size-limit should be less than %d", 1<<40) + } + + if c.Performance.MemoryUsageAlarmRatio > 1 || c.Performance.MemoryUsageAlarmRatio < 0 { + return fmt.Errorf("memory-usage-alarm-ratio in [Performance] must be greater than or equal to 0 and less than or equal to 1") + } + + if c.StmtSummary.MaxStmtCount <= 0 { + return fmt.Errorf("max-stmt-count in [stmt-summary] should be greater than 0") + } + if c.StmtSummary.HistorySize < 0 { + return fmt.Errorf("history-size in [stmt-summary] should be greater than or equal to 0") + } + if c.StmtSummary.RefreshInterval <= 0 { + return fmt.Errorf("refresh-interval in [stmt-summary] should be greater than 0") + } + + if c.PreparedPlanCache.Capacity < 1 { + return fmt.Errorf("capacity in [prepared-plan-cache] should be at least 1") + } + if c.PreparedPlanCache.MemoryGuardRatio < 0 || c.PreparedPlanCache.MemoryGuardRatio > 1 { + return fmt.Errorf("memory-guard-ratio in [prepared-plan-cache] must be NOT less than 0 and more than 1") + } + if len(c.IsolationRead.Engines) < 1 { + return fmt.Errorf("the number of [isolation-read]engines for isolation read should be at least 1") + } + for _, engine := range c.IsolationRead.Engines { + if engine != "tidb" && engine != "tikv" && engine != "tiflash" { + return fmt.Errorf("type of [isolation-read]engines can't be %v should be one of tidb or tikv or tiflash", engine) + } + } + + // test security + c.Security.SpilledFileEncryptionMethod = strings.ToLower(c.Security.SpilledFileEncryptionMethod) + switch c.Security.SpilledFileEncryptionMethod { + case SpilledFileEncryptionMethodPlaintext, SpilledFileEncryptionMethodAES128CTR: + default: + return fmt.Errorf("unsupported [security]spilled-file-encryption-method %v, TiDB only supports [%v, %v]", + c.Security.SpilledFileEncryptionMethod, SpilledFileEncryptionMethodPlaintext, SpilledFileEncryptionMethodAES128CTR) + } + + // test log level + l := zap.NewAtomicLevel() + return l.UnmarshalText([]byte(c.Log.Level)) +} + +// UpdateGlobal updates the global config, and provide a restore function that can be used to restore to the original. +func UpdateGlobal(f func(conf *Config)) { + g := GetGlobalConfig() + newConf := *g + f(&newConf) + StoreGlobalConfig(&newConf) +} + +// RestoreFunc gets a function that restore the config to the current value. +func RestoreFunc() (restore func()) { + g := GetGlobalConfig() + return func() { + StoreGlobalConfig(g) + } +} + +func hasRootPrivilege() bool { + return os.Geteuid() == 0 +} + +// TableLockEnabled uses to check whether enabled the table lock feature. +func TableLockEnabled() bool { + return GetGlobalConfig().EnableTableLock +} + +// TableLockDelayClean uses to get the time of delay clean table lock. +var TableLockDelayClean = func() uint64 { + return GetGlobalConfig().DelayCleanTableLock +} + +// ToLogConfig converts *Log to *logutil.LogConfig. +func (l *Log) ToLogConfig() *logutil.LogConfig { + return logutil.NewLogConfig(l.Level, l.Format, l.SlowQueryFile, l.File, l.getDisableTimestamp(), func(config *zaplog.Config) { config.DisableErrorVerbose = l.getDisableErrorStack() }) +} + +// ToTracingConfig converts *OpenTracing to *tracing.Configuration. +func (t *OpenTracing) ToTracingConfig() *tracing.Configuration { + ret := &tracing.Configuration{ + Disabled: !t.Enable, + RPCMetrics: t.RPCMetrics, + Reporter: &tracing.ReporterConfig{}, + Sampler: &tracing.SamplerConfig{}, + } + ret.Reporter.QueueSize = t.Reporter.QueueSize + ret.Reporter.BufferFlushInterval = t.Reporter.BufferFlushInterval + ret.Reporter.LogSpans = t.Reporter.LogSpans + ret.Reporter.LocalAgentHostPort = t.Reporter.LocalAgentHostPort + + ret.Sampler.Type = t.Sampler.Type + ret.Sampler.Param = t.Sampler.Param + ret.Sampler.SamplingServerURL = t.Sampler.SamplingServerURL + ret.Sampler.MaxOperations = t.Sampler.MaxOperations + ret.Sampler.SamplingRefreshInterval = t.Sampler.SamplingRefreshInterval + return ret +} + +func init() { + //initByLDFlags(versioninfo.TiDBEdition, checkBeforeDropLDFlag) +} + +func initByLDFlags(edition, checkBeforeDropLDFlag string) { + // if edition != versioninfo.CommunityEdition { + // defaultConf.EnableTelemetry = false + // } + conf := defaultConf + StoreGlobalConfig(&conf) + if checkBeforeDropLDFlag == "1" { + CheckTableBeforeDrop = true + } +} + +// The following constants represents the valid action configurations for OOMAction. +// 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 ( + OOMActionCancel = "cancel" + OOMActionLog = "log" +) + +// hideConfig is used to filter a single line of config for hiding. +var hideConfig = []string{ + "index-usage-sync-lease", +} + +// HideConfig is used to filter the configs that needs to be hidden. +func HideConfig(s string) string { + configs := strings.Split(s, "\n") + hideMap := make([]bool, len(configs)) + for i, c := range configs { + for _, hc := range hideConfig { + if strings.Contains(c, hc) { + hideMap[i] = true + break + } + } + } + var buf bytes.Buffer + for i, c := range configs { + if hideMap[i] { + continue + } + if i != 0 { + buf.WriteString("\n") + } + buf.WriteString(c) + } + return buf.String() +} + +// ContainHiddenConfig checks whether it contains the configuration that needs to be hidden. +func ContainHiddenConfig(s string) bool { + s = strings.ToLower(s) + for _, hc := range hideConfig { + if strings.Contains(s, hc) { + return true + } + } + return false +} diff --git a/config/config.toml.example b/config/config.toml.example new file mode 100644 index 000000000..7b8251d9a --- /dev/null +++ b/config/config.toml.example @@ -0,0 +1,490 @@ +# TiDB Configuration. + +# TiDB server host. +host = "0.0.0.0" + +# tidb server advertise IP. +advertise-address = "" + +# TiDB server port. +port = 4000 + +# Registered store name, [tikv, mocktikv, unistore] +store = "unistore" + +# TiDB storage path. +path = "/tmp/tidb" + +# The socket file to use for connection. +socket = "" + +# Run ddl worker on this tidb-server. +run-ddl = true + +# Schema lease duration, very dangerous to change only if you know what you do. +lease = "45s" + +# When create table, split a separated region for it. It is recommended to +# turn off this option if there will be a large number of tables created. +split-table = true + +# The limit of concurrent executed sessions. +token-limit = 1000 + +# The maximum memory available for a single SQL statement. Default: 1GB +mem-quota-query = 1073741824 + +# Controls whether to enable the temporary storage for some operators when a single SQL statement exceeds the memory quota specified by mem-quota-query. +oom-use-tmp-storage = true + +# Specifies the temporary storage path for some operators when a single SQL statement exceeds the memory quota specified by mem-quota-query. +# It defaults to a generated directory in `/_tidb/` if it is unset. +# It only takes effect when `oom-use-tmp-storage` is `true`. +# tmp-storage-path = "/tmp/_tidb/MC4wLjAuMDo0MDAwLzAuMC4wLjA6MTAwODA=/tmp-storage" + +# Specifies the maximum use of temporary storage (bytes) for all active queries when `oom-use-tmp-storage` is enabled. +# If the `tmp-storage-quota` exceeds the capacity of the temporary storage directory, tidb-server would return an error and exit. +# The default value of tmp-storage-quota is under 0 which means tidb-server wouldn't check the capacity. +tmp-storage-quota = -1 + +# Specifies what operation TiDB performs when a single SQL statement exceeds the memory quota specified by mem-quota-query and cannot be spilled over to disk. +# Valid options: ["log", "cancel"] +oom-action = "cancel" + +# Enable batch commit for the DMLs. +enable-batch-dml = false + +# Set system variable 'lower_case_table_names' +lower-case-table-names = 2 + +# Make "kill query" behavior compatible with MySQL. It's not recommend to +# turn on this option when TiDB server is behind a proxy. +compatible-kill-query = false + +# Make SIGTERM wait N seconds before starting the shutdown procedure. This is designed for when TiDB is behind a proxy/load balancer. +# The health check will fail immediately but the server will not start shutting down until the time has elapsed. +graceful-wait-before-shutdown = 0 + +# check mb4 value in utf8 is used to control whether to check the mb4 characters when the charset is utf8. +check-mb4-value-in-utf8 = true + +# treat-old-version-utf8-as-utf8mb4 use for upgrade compatibility. Set to true will treat old version table/column UTF8 charset as UTF8MB4. +treat-old-version-utf8-as-utf8mb4 = true + +# max-index-length is used to deal with compatibility issues from v3.0.7 and previous version upgrades. It can only be in [3072, 3072*4]. +max-index-length = 3072 + +# index-limit is used to deal with compatibility issues. It can only be in [64, 64*8]. +index-limit = 64 + +# enable-table-lock is used to control table lock feature. Default is false, indicate the table lock feature is disabled. +enable-table-lock = false + +# delay-clean-table-lock is used to control the time (Milliseconds) of delay before unlock the table in the abnormal situation. +delay-clean-table-lock = 0 + +# Maximum number of the splitting region, which is used by the split region statement. +split-region-max-num = 1000 + +# alter-primary-key is used to control whether the primary keys are clustered. +# Note that this config is deprecated. Only valid when @@global.tidb_enable_clustered_index = 'int_only'. +# Default is false, only the integer primary keys are clustered. +# If it is true, all types of primary keys are nonclustered. +alter-primary-key = false + +# server-version is used to change the version string of TiDB in the following scenarios: +# 1. the server version returned by builtin-function `VERSION()`. +# 2. the server version filled in handshake packets of MySQL Connection Protocol, see https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake for more details. +# if server-version = "", the default value(original TiDB version string) is used. +server-version = "" + +# repair mode is used to repair the broken table meta in TiKV in extreme cases. +repair-mode = false + +# Repair table list is used to list the tables in repair mode with the format like ["db.table",]. +# In repair mode, repairing table which is not in repair list will get wrong database or wrong table error. +repair-table-list = [] + +# The maximum permitted number of simultaneous client connections. When the value is 0, the number of connections is unlimited. +max-server-connections = 0 + +# Whether new collations are enabled, as indicated by its name, this configuration entry take effect ONLY when a TiDB cluster bootstraps for the first time. +new_collations_enabled_on_first_bootstrap = false + +# Don't register information of this TiDB to etcd, so this instance of TiDB won't appear in the services like dashboard. +# This option is useful when you want to embed TiDB into your service(i.e. use TiDB as a library). +# *If you want to start a TiDB service, NEVER enable this.* +skip-register-to-dashboard = false + +# When enabled, usage data (for example, instance versions) will be reported to PingCAP periodically for user experience analytics. +# If this config is set to `false` on all TiDB servers, telemetry will be always disabled regardless of the value of the global variable `tidb_enable_telemetry`. +# See PingCAP privacy policy for details: https://pingcap.com/en/privacy-policy/ +enable-telemetry = true + +# deprecate-integer-display-length is used to be compatible with MySQL 8.0 in which the integer declared with display length will be returned with +# a warning like `Integer display width is deprecated and will be removed in a future release`. +deprecate-integer-display-length = false + +# enable-enum-length-limit is used to deal with compatibility issues. When true, 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. +enable-enum-length-limit = true + +[log] +# Log level: debug, info, warn, error, fatal. +level = "info" + +# Log format, one of json or text. +format = "text" + +# Enable automatic timestamps in log output, if not set, it will be defaulted to true. +# enable-timestamp = true + +# Enable annotating logs with the full stack error message, if not set, it will be defaulted to false. +# enable-error-stack = false + +# Whether to enable slow query log. +enable-slow-log = true + +# Stores slow query log into separated files. +slow-query-file = "tidb-slow.log" + +# Queries with execution time greater than this value will be logged. (Milliseconds) +slow-threshold = 300 + +# record-plan-in-slow-log is used to enable record query plan in slow log. +# 0 is disable. 1 is enable. +record-plan-in-slow-log = 1 + +# Queries with internal result greater than this value will be logged. +expensive-threshold = 10000 + +# Maximum query length recorded in log. +query-log-max-len = 4096 + +# File logging. +[log.file] +# Log file name. +filename = "" + +# Max log file size in MB (upper limit to 4096MB). +max-size = 300 + +# Max log file keep days. No clean up by default. +max-days = 0 + +# Maximum number of old log files to retain. No clean up by default. +max-backups = 0 + +[security] +# Path of file that contains list of trusted SSL CAs for connection with mysql client. +ssl-ca = "" + +# Path of file that contains X509 certificate in PEM format for connection with mysql client. +ssl-cert = "" + +# Path of file that contains X509 key in PEM format for connection with mysql client. +ssl-key = "" + +# Path of file that contains list of trusted SSL CAs for connection with cluster components. +cluster-ssl-ca = "" + +# Path of file that contains X509 certificate in PEM format for connection with cluster components. +cluster-ssl-cert = "" + +# Path of file that contains X509 key in PEM format for connection with cluster components. +cluster-ssl-key = "" + +# Configurations of the encryption method to use for encrypting the spilled data files. +# Possible values are "plaintext", "aes128-ctr", if not set, it will be "plaintext" by default. +# "plaintext" means encryption is disabled. +spilled-file-encryption-method = "plaintext" + +# Security Enhanced Mode (SEM) restricts the "SUPER" privilege and requires fine-grained privileges instead. +enable-sem = false + +# Automatic creation of TLS certificates +auto-tls = true + +# Minium TLS version to use, e.g. "TLSv1.2" +tls-version = "" + +# The RSA Key size for automatic generated RSA keys +rsa-key-size = 4096 + +[status] +# If enable status report HTTP service. +report-status = true + +# TiDB status host. +status-host = "0.0.0.0" + +## status-host is the HTTP address for reporting the internal status of a TiDB server, for example: +## API for prometheus: http://${status-host}:${status_port}/metrics +## API for pprof: http://${status-host}:${status_port}/debug/pprof +# TiDB status port. +status-port = 10080 + +# Prometheus pushgateway address, leaves it empty will disable push to pushgateway. +metrics-addr = "" + +# Prometheus client push interval in second, set \"0\" to disable push to pushgateway. +metrics-interval = 15 + +# Record statements qps by database name if it is enabled. +record-db-qps = false + +[performance] +# Max CPUs to use, 0 use number of CPUs in the machine. +max-procs = 0 + +# Memory size quota for tidb server, 0 means unlimited +server-memory-quota = 0 + +# The alarm threshold when memory usage of the tidb-server exceeds. The valid value range is greater than or equal to 0 +# and less than or equal to 1. The default value is 0.8. +# If this configuration is set to 0 or 1, it'll disable the alarm. +# Otherwise, related information will be recorded in the directory `tmp-storage-path/record`. +# Note: If the configuration `server-memory-quota` is set and larger than 0, the alarm threshold will be +# `memory-usage-alarm-ratio * server-memory-quota`; otherwise, it'll be `memory-usage-alarm-ratio * system memory size`. +memory-usage-alarm-ratio = 0.8 + +# StmtCountLimit limits the max count of statement inside a transaction. +stmt-count-limit = 5000 + +# Set keep alive option for tcp connection. +tcp-keep-alive = true + +# Whether support cartesian product. +cross-join = true + +# Stats lease duration, which influences the time of analyze and stats load. +stats-lease = "3s" + +# Run auto analyze worker on this tidb-server. +run-auto-analyze = true + +# Probability to use the query feedback to update stats, 0.0 or 1.0 for always false/true. +feedback-probability = 0.0 + +# The max number of query feedback that cache in memory. +query-feedback-limit = 512 + +# Pseudo stats will be used if the ratio between the modify count and +# row count in statistics of a table is greater than it. +pseudo-estimate-ratio = 0.8 + +# Force the priority of all statements in a specified priority. +# The value could be "NO_PRIORITY", "LOW_PRIORITY", "HIGH_PRIORITY" or "DELAYED". +force-priority = "NO_PRIORITY" + +# Bind info lease duration, which influences the duration of loading bind info and handling invalid bind. +bind-info-lease = "3s" + +# Whether support pushing down aggregation with distinct to cop task +distinct-agg-push-down = false + +# The limitation of the size in byte for the entries in one transaction. +# If using TiKV as the storage, the entry represents a key/value pair. +# NOTE: If binlog is enabled with Kafka (e.g. arbiter cluster), +# this value should be less than 1073741824(1G) because this is the maximum size that can be handled by Kafka. +# If binlog is disabled or binlog is enabled without Kafka, this value should be less than 10737418240(10G). +txn-total-size-limit = 104857600 + +# The limitation of the size in byte for each entry in one transaction. +# NOTE: Increasing this limit may cause performance problems. +txn-entry-size-limit = 6291456 + +# The max number of running concurrency two phase committer request for an SQL. +committer-concurrency = 128 + +# max lifetime of transaction ttl manager. +max-txn-ttl = 3600000 + +# the interval duration between two memory profile into global tracker +mem-profile-interval = "1m" + +# The Go GC trigger factor, you can get more information about it at https://golang.org/pkg/runtime. +# If you encounter OOM when executing large query, you can decrease this value to trigger GC earlier. +# If you find the CPU used by GC is too high or GC is too frequent and impact your business you can increase this value. +gogc = 100 + +[proxy-protocol] +# PROXY protocol acceptable client networks. +# Empty string means disable PROXY protocol, * means all networks. +networks = "" + +# PROXY protocol header read timeout, unit is second +header-timeout = 5 + +[prepared-plan-cache] +enabled = false +capacity = 100 +memory-guard-ratio = 0.1 + +[opentracing] +# Enable opentracing. +enable = false + +# Whether to enable the rpc metrics. +rpc-metrics = false + +[opentracing.sampler] +# Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote +type = "const" + +# Param is a value passed to the sampler. +# Valid values for Param field are: +# - for "const" sampler, 0 or 1 for always false/true respectively +# - for "probabilistic" sampler, a probability between 0 and 1 +# - for "rateLimiting" sampler, the number of spans per second +# - for "remote" sampler, param is the same as for "probabilistic" +# and indicates the initial sampling rate before the actual one +# is received from the mothership +param = 1.0 + +# SamplingServerURL is the address of jaeger-agent's HTTP sampling server +sampling-server-url = "" + +# MaxOperations is the maximum number of operations that the sampler +# will keep track of. If an operation is not tracked, a default probabilistic +# sampler will be used rather than the per operation specific sampler. +max-operations = 0 + +# SamplingRefreshInterval controls how often the remotely controlled sampler will poll +# jaeger-agent for the appropriate sampling strategy. +sampling-refresh-interval = 0 + +[opentracing.reporter] +# QueueSize controls how many spans the reporter can keep in memory before it starts dropping +# new spans. The queue is continuously drained by a background go-routine, as fast as spans +# can be sent out of process. +queue-size = 0 + +# BufferFlushInterval controls how often the buffer is force-flushed, even if it's not full. +# It is generally not useful, as it only matters for very low traffic services. +buffer-flush-interval = 0 + +# LogSpans, when true, enables LoggingReporter that runs in parallel with the main reporter +# and logs all submitted spans. Main Configuration.Logger must be initialized in the code +# for this option to have any effect. +log-spans = false + +# LocalAgentHostPort instructs reporter to send spans to jaeger-agent at this address +local-agent-host-port = "" + +[pd-client] +# Max time which PD client will wait for the PD server in seconds. +pd-server-timeout = 3 + +[tikv-client] +# Max gRPC connections that will be established with each tikv-server. +grpc-connection-count = 4 + +# 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. +grpc-keepalive-time = 10 + +# 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. +grpc-keepalive-timeout = 3 + +# The compression type for gRPC channel: none or gzip. +grpc-compression-type = "none" + +# Max time for commit command, must be twice bigger than raft election timeout. +commit-timeout = "41s" + +# Max batch size in gRPC. +max-batch-size = 128 +# Overload threshold of TiKV. +overload-threshold = 200 +# Max batch wait time in nanosecond to avoid waiting too long. 0 means disable this feature. +max-batch-wait-time = 0 +# Batch wait size, to avoid waiting too long. +batch-wait-size = 8 + +# Enable chunk encoded data for coprocessor requests. +enable-chunk-rpc = true + +# If a Region has not been accessed for more than the given duration (in seconds), it +# will be reloaded from the PD. +region-cache-ttl = 600 + +# store-limit is used to restrain TiDB from sending request to some stores which is up to the limit. +# If a store has been up to the limit, it will return error for the successive request in same store. +# default 0 means shutting off store limit. +store-limit = 0 + +# store-liveness-timeout is used to control timeout for store liveness after sending request failed. +store-liveness-timeout = "1s" + +# ttl-refreshed-txn-size decides whether a transaction should update its lock TTL. +# If the size(in byte) of a transaction is large than `ttl-refreshed-txn-size`, it update the lock TTL during the 2PC. +ttl-refreshed-txn-size = 33554432 + +# If the number of keys that one prewrite request of one region involves exceed this threshold, it will use `ResolveLock` instead of `ResolveLockLite`. +resolve-lock-lite-threshold = 16 + +[tikv-client.copr-cache] +# The capacity in MB of the cache. Zero means disable coprocessor cache. +capacity-mb = 1000.0 + +[binlog] +# enable to write binlog. +# NOTE: If binlog is enabled with Kafka (e.g. arbiter cluster), +# txn-total-size-limit should be less than 1073741824(1G) because this is the maximum size that can be handled by Kafka. +enable = false + +# WriteTimeout specifies how long it will wait for writing binlog to pump. +write-timeout = "15s" + +# If IgnoreError is true, when writing binlog meets error, TiDB would stop writing binlog, +# but still provide service. +ignore-error = false + +# use socket file to write binlog, for compatible with kafka version tidb-binlog. +binlog-socket = "" + +# the strategy for sending binlog to pump, value can be "range" or "hash" now. +strategy = "range" + +[pessimistic-txn] +# max retry count for a statement in a pessimistic transaction. +max-retry-count = 256 + +# The max count of deadlock events that will be recorded in the information_schema.deadlocks table. +deadlock-history-capacity = 10 + +# Whether retryable deadlocks (in-statement deadlocks) are collected to the information_schema.deadlocks table. +deadlock-history-collect-retryable = false + +[stmt-summary] +# enable statement summary. +enable = true + +# enable statement summary for TiDB internal query, default is false. +enable-internal-query = false + +# max number of statements kept in memory. +max-stmt-count = 3000 + +# max length of displayed normalized sql and sample sql. +max-sql-length = 4096 + +# the refresh interval of statement summary, it's counted in seconds. +refresh-interval = 1800 + +# the maximum history size of statement summary. +history-size = 24 + +# experimental section controls the features that are still experimental: their semantics, +# interfaces are subject to change, using these features in the production environment is not recommended. +[experimental] + +# server level isolation read by engines and labels +[isolation-read] +# engines means allow the tidb server read data from which types of engines. options: "tikv", "tiflash", "tidb". +engines = ["tikv", "tiflash", "tidb"] diff --git a/config/config_util.go b/config/config_util.go new file mode 100644 index 000000000..aef615f6c --- /dev/null +++ b/config/config_util.go @@ -0,0 +1,162 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "bytes" + "encoding/json" + "fmt" + "os" + "path/filepath" + "reflect" + "time" + + "github.com/BurntSushi/toml" + "github.com/pingcap/errors" + tikvcfg "github.com/tikv/client-go/v2/config" +) + +// CloneConf deeply clones this config. +func CloneConf(conf *Config) (*Config, error) { + content, err := json.Marshal(conf) + if err != nil { + return nil, err + } + var clonedConf Config + if err := json.Unmarshal(content, &clonedConf); err != nil { + return nil, err + } + return &clonedConf, nil +} + +var ( + // dynamicConfigItems contains all config items that can be changed during runtime. + dynamicConfigItems = map[string]struct{}{ + "Performance.MaxProcs": {}, + "Performance.MaxMemory": {}, + "Performance.CrossJoin": {}, + "Performance.FeedbackProbability": {}, + "Performance.QueryFeedbackLimit": {}, + "Performance.PseudoEstimateRatio": {}, + "Performance.StmtCountLimit": {}, + "Performance.TCPKeepAlive": {}, + "OOMAction": {}, + "MemQuotaQuery": {}, + "TiKVClient.StoreLimit": {}, + "Log.Level": {}, + "Log.SlowThreshold": {}, + "Log.QueryLogMaxLen": {}, + "Log.ExpensiveThreshold": {}, + "CheckMb4ValueInUTF8": {}, + "EnableStreaming": {}, + "TxnLocalLatches.Capacity": {}, + "CompatibleKillQuery": {}, + "TreatOldVersionUTF8AsUTF8MB4": {}, + "OpenTracing.Enable": {}, + "PreparedPlanCache.Enabled": {}, + } +) + +// MergeConfigItems overwrites the dynamic config items and leaves the other items unchanged. +func MergeConfigItems(dstConf, newConf *Config) (acceptedItems, rejectedItems []string) { + return mergeConfigItems(reflect.ValueOf(dstConf), reflect.ValueOf(newConf), "") +} + +func mergeConfigItems(dstConf, newConf reflect.Value, fieldPath string) (acceptedItems, rejectedItems []string) { + t := dstConf.Type() + if t.Kind() == reflect.Ptr { + t = t.Elem() + dstConf = dstConf.Elem() + newConf = newConf.Elem() + } + if t.Kind() != reflect.Struct { + if reflect.DeepEqual(dstConf.Interface(), newConf.Interface()) { + return + } + if _, ok := dynamicConfigItems[fieldPath]; ok { + dstConf.Set(newConf) + return []string{fieldPath}, nil + } + return nil, []string{fieldPath} + } + + for i := 0; i < t.NumField(); i++ { + fieldName := t.Field(i).Name + if fieldPath != "" { + fieldName = fieldPath + "." + fieldName + } + as, rs := mergeConfigItems(dstConf.Field(i), newConf.Field(i), fieldName) + acceptedItems = append(acceptedItems, as...) + rejectedItems = append(rejectedItems, rs...) + } + return +} + +func atomicWriteConfig(c *Config, confPath string) (err error) { + content, err := encodeConfig(c) + if err != nil { + return err + } + tmpConfPath := filepath.Join(os.TempDir(), fmt.Sprintf("tmp_conf_%v.toml", time.Now().Format("20060102150405"))) + if err := os.WriteFile(tmpConfPath, []byte(content), 0600); err != nil { + return errors.Trace(err) + } + return errors.Trace(os.Rename(tmpConfPath, confPath)) +} + +// ConfReloadFunc is used to reload the config to make it work. +type ConfReloadFunc func(oldConf, newConf *Config) + +func encodeConfig(conf *Config) (string, error) { + confBuf := bytes.NewBuffer(nil) + te := toml.NewEncoder(confBuf) + if err := te.Encode(conf); err != nil { + return "", errors.New("encode config error=" + err.Error()) + } + return confBuf.String(), nil +} + +func decodeConfig(content string) (*Config, error) { + c := new(Config) + _, err := toml.Decode(content, c) + return c, err +} + +// FlattenConfigItems flatten this config, see more cases in the test. +func FlattenConfigItems(nestedConfig map[string]interface{}) map[string]interface{} { + flatMap := make(map[string]interface{}) + flatten(flatMap, nestedConfig, "") + return flatMap +} + +func flatten(flatMap map[string]interface{}, nested interface{}, prefix string) { + switch nested := nested.(type) { + case map[string]interface{}: + for k, v := range nested { + path := k + if prefix != "" { + path = prefix + "." + k + } + flatten(flatMap, v, path) + } + default: // don't flatten arrays + flatMap[prefix] = nested + } +} + +// GetTxnScopeFromConfig extracts @@txn_scope value from the config. +func GetTxnScopeFromConfig() string { + return tikvcfg.GetTxnScopeFromConfig() +} diff --git a/dbterror/terror.go b/dbterror/terror.go new file mode 100644 index 000000000..d3f305bcd --- /dev/null +++ b/dbterror/terror.go @@ -0,0 +1,57 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dbterror + +import ( + "tinysql/errno" + "tinysql/parser/terror" +) + +// ErrClass represents a class of errors. +type ErrClass struct{ terror.ErrClass } + +// Error classes. +var ( + ClassAutoid = ErrClass{terror.ClassAutoid} + ClassDDL = ErrClass{terror.ClassDDL} + ClassDomain = ErrClass{terror.ClassDomain} + ClassExecutor = ErrClass{terror.ClassExecutor} + ClassExpression = ErrClass{terror.ClassExpression} + ClassAdmin = ErrClass{terror.ClassAdmin} + ClassKV = ErrClass{terror.ClassKV} + ClassMeta = ErrClass{terror.ClassMeta} + ClassOptimizer = ErrClass{terror.ClassOptimizer} + ClassPrivilege = ErrClass{terror.ClassPrivilege} + ClassSchema = ErrClass{terror.ClassSchema} + ClassServer = ErrClass{terror.ClassServer} + ClassStructure = ErrClass{terror.ClassStructure} + ClassVariable = ErrClass{terror.ClassVariable} + ClassXEval = ErrClass{terror.ClassXEval} + ClassTable = ErrClass{terror.ClassTable} + ClassTypes = ErrClass{terror.ClassTypes} + ClassJSON = ErrClass{terror.ClassJSON} + ClassTiKV = ErrClass{terror.ClassTiKV} + ClassSession = ErrClass{terror.ClassSession} + ClassPlugin = ErrClass{terror.ClassPlugin} + ClassUtil = ErrClass{terror.ClassUtil} +) + +// NewStd calls New using the standard message for the error code +// Attention: +// this method is not goroutine-safe and +// usually be used in global variable initializer +func (ec ErrClass) NewStd(code terror.ErrCode) *terror.Error { + return ec.NewStdErr(code, errno.MySQLErrName[uint16(code)]) +} diff --git a/errno/errcode.go b/errno/errcode.go new file mode 100644 index 000000000..8ef9795c8 --- /dev/null +++ b/errno/errcode.go @@ -0,0 +1,1070 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errno + +// MySQL error code. +// This value is numeric. It is not portable to other database systems. +const ( + ErrErrorFirst = 1000 + ErrHashchk = 1000 + ErrNisamchk = 1001 + ErrNo = 1002 + ErrYes = 1003 + ErrCantCreateFile = 1004 + ErrCantCreateTable = 1005 + ErrCantCreateDB = 1006 + ErrDBCreateExists = 1007 + ErrDBDropExists = 1008 + ErrDBDropDelete = 1009 + ErrDBDropRmdir = 1010 + ErrCantDeleteFile = 1011 + ErrCantFindSystemRec = 1012 + ErrCantGetStat = 1013 + ErrCantGetWd = 1014 + ErrCantLock = 1015 + ErrCantOpenFile = 1016 + ErrFileNotFound = 1017 + ErrCantReadDir = 1018 + ErrCantSetWd = 1019 + ErrCheckread = 1020 + ErrDiskFull = 1021 + ErrDupKey = 1022 + ErrErrorOnClose = 1023 + ErrErrorOnRead = 1024 + ErrErrorOnRename = 1025 + ErrErrorOnWrite = 1026 + ErrFileUsed = 1027 + ErrFilsortAbort = 1028 + ErrFormNotFound = 1029 + ErrGetErrno = 1030 + ErrIllegalHa = 1031 + ErrKeyNotFound = 1032 + ErrNotFormFile = 1033 + ErrNotKeyFile = 1034 + ErrOldKeyFile = 1035 + ErrOpenAsReadonly = 1036 + ErrOutofMemory = 1037 + ErrOutOfSortMemory = 1038 + ErrUnexpectedEOF = 1039 + ErrConCount = 1040 + ErrOutOfResources = 1041 + ErrBadHost = 1042 + ErrHandshake = 1043 + ErrDBaccessDenied = 1044 + ErrAccessDenied = 1045 + ErrNoDB = 1046 + ErrUnknownCom = 1047 + ErrBadNull = 1048 + ErrBadDB = 1049 + ErrTableExists = 1050 + ErrBadTable = 1051 + ErrNonUniq = 1052 + ErrServerShutdown = 1053 + ErrBadField = 1054 + ErrFieldNotInGroupBy = 1055 + ErrWrongGroupField = 1056 + ErrWrongSumSelect = 1057 + ErrWrongValueCount = 1058 + ErrTooLongIdent = 1059 + ErrDupFieldName = 1060 + ErrDupKeyName = 1061 + ErrDupEntry = 1062 + ErrWrongFieldSpec = 1063 + ErrParse = 1064 + ErrEmptyQuery = 1065 + ErrNonuniqTable = 1066 + ErrInvalidDefault = 1067 + ErrMultiplePriKey = 1068 + ErrTooManyKeys = 1069 + ErrTooManyKeyParts = 1070 + ErrTooLongKey = 1071 + ErrKeyColumnDoesNotExits = 1072 + ErrBlobUsedAsKey = 1073 + ErrTooBigFieldlength = 1074 + ErrWrongAutoKey = 1075 + ErrReady = 1076 + ErrNormalShutdown = 1077 + ErrGotSignal = 1078 + ErrShutdownComplete = 1079 + ErrForcingClose = 1080 + ErrIpsock = 1081 + ErrNoSuchIndex = 1082 + ErrWrongFieldTerminators = 1083 + ErrBlobsAndNoTerminated = 1084 + ErrTextFileNotReadable = 1085 + ErrFileExists = 1086 + ErrLoadInfo = 1087 + ErrAlterInfo = 1088 + ErrWrongSubKey = 1089 + ErrCantRemoveAllFields = 1090 + ErrCantDropFieldOrKey = 1091 + ErrInsertInfo = 1092 + ErrUpdateTableUsed = 1093 + ErrNoSuchThread = 1094 + ErrKillDenied = 1095 + ErrNoTablesUsed = 1096 + ErrTooBigSet = 1097 + ErrNoUniqueLogFile = 1098 + ErrTableNotLockedForWrite = 1099 + ErrTableNotLocked = 1100 + ErrBlobCantHaveDefault = 1101 + ErrWrongDBName = 1102 + ErrWrongTableName = 1103 + ErrTooBigSelect = 1104 + ErrUnknown = 1105 + ErrUnknownProcedure = 1106 + ErrWrongParamcountToProcedure = 1107 + ErrWrongParametersToProcedure = 1108 + ErrUnknownTable = 1109 + ErrFieldSpecifiedTwice = 1110 + ErrInvalidGroupFuncUse = 1111 + ErrUnsupportedExtension = 1112 + ErrTableMustHaveColumns = 1113 + ErrRecordFileFull = 1114 + ErrUnknownCharacterSet = 1115 + ErrTooManyTables = 1116 + ErrTooManyFields = 1117 + ErrTooBigRowsize = 1118 + ErrStackOverrun = 1119 + ErrWrongOuterJoin = 1120 + ErrNullColumnInIndex = 1121 + ErrCantFindUdf = 1122 + ErrCantInitializeUdf = 1123 + ErrUdfNoPaths = 1124 + ErrUdfExists = 1125 + ErrCantOpenLibrary = 1126 + ErrCantFindDlEntry = 1127 + ErrFunctionNotDefined = 1128 + ErrHostIsBlocked = 1129 + ErrHostNotPrivileged = 1130 + ErrPasswordAnonymousUser = 1131 + ErrPasswordNotAllowed = 1132 + ErrPasswordNoMatch = 1133 + ErrUpdateInfo = 1134 + ErrCantCreateThread = 1135 + ErrWrongValueCountOnRow = 1136 + ErrCantReopenTable = 1137 + ErrInvalidUseOfNull = 1138 + ErrRegexp = 1139 + ErrMixOfGroupFuncAndFields = 1140 + ErrNonexistingGrant = 1141 + ErrTableaccessDenied = 1142 + ErrColumnaccessDenied = 1143 + ErrIllegalGrantForTable = 1144 + ErrGrantWrongHostOrUser = 1145 + ErrNoSuchTable = 1146 + ErrNonexistingTableGrant = 1147 + ErrNotAllowedCommand = 1148 + ErrSyntax = 1149 + ErrDelayedCantChangeLock = 1150 + ErrTooManyDelayedThreads = 1151 + ErrAbortingConnection = 1152 + ErrNetPacketTooLarge = 1153 + ErrNetReadErrorFromPipe = 1154 + ErrNetFcntl = 1155 + ErrNetPacketsOutOfOrder = 1156 + ErrNetUncompress = 1157 + ErrNetRead = 1158 + ErrNetReadInterrupted = 1159 + ErrNetErrorOnWrite = 1160 + ErrNetWriteInterrupted = 1161 + ErrTooLongString = 1162 + ErrTableCantHandleBlob = 1163 + ErrTableCantHandleAutoIncrement = 1164 + ErrDelayedInsertTableLocked = 1165 + ErrWrongColumnName = 1166 + ErrWrongKeyColumn = 1167 + ErrWrongMrgTable = 1168 + ErrDupUnique = 1169 + ErrBlobKeyWithoutLength = 1170 + ErrPrimaryCantHaveNull = 1171 + ErrTooManyRows = 1172 + ErrRequiresPrimaryKey = 1173 + ErrNoRaidCompiled = 1174 + ErrUpdateWithoutKeyInSafeMode = 1175 + ErrKeyDoesNotExist = 1176 + ErrCheckNoSuchTable = 1177 + ErrCheckNotImplemented = 1178 + ErrCantDoThisDuringAnTransaction = 1179 + ErrErrorDuringCommit = 1180 + ErrErrorDuringRollback = 1181 + ErrErrorDuringFlushLogs = 1182 + ErrErrorDuringCheckpoint = 1183 + ErrNewAbortingConnection = 1184 + ErrDumpNotImplemented = 1185 + ErrIndexRebuild = 1187 + ErrFtMatchingKeyNotFound = 1191 + ErrLockOrActiveTransaction = 1192 + ErrUnknownSystemVariable = 1193 + ErrCrashedOnUsage = 1194 + ErrCrashedOnRepair = 1195 + ErrWarningNotCompleteRollback = 1196 + ErrTransCacheFull = 1197 + ErrTooManyUserConnections = 1203 + ErrSetConstantsOnly = 1204 + ErrLockWaitTimeout = 1205 + ErrLockTableFull = 1206 + ErrReadOnlyTransaction = 1207 + ErrDropDBWithReadLock = 1208 + ErrCreateDBWithReadLock = 1209 + ErrWrongArguments = 1210 + ErrNoPermissionToCreateUser = 1211 + ErrUnionTablesInDifferentDir = 1212 + ErrLockDeadlock = 1213 + ErrTableCantHandleFt = 1214 + ErrCannotAddForeign = 1215 + ErrNoReferencedRow = 1216 + ErrRowIsReferenced = 1217 + ErrErrorWhenExecutingCommand = 1220 + ErrWrongUsage = 1221 + ErrWrongNumberOfColumnsInSelect = 1222 + ErrCantUpdateWithReadlock = 1223 + ErrMixingNotAllowed = 1224 + ErrDupArgument = 1225 + ErrUserLimitReached = 1226 + ErrSpecificAccessDenied = 1227 + ErrLocalVariable = 1228 + ErrGlobalVariable = 1229 + ErrNoDefault = 1230 + ErrWrongValueForVar = 1231 + ErrWrongTypeForVar = 1232 + ErrVarCantBeRead = 1233 + ErrCantUseOptionHere = 1234 + ErrNotSupportedYet = 1235 + ErrIncorrectGlobalLocalVar = 1238 + ErrWrongFkDef = 1239 + ErrKeyRefDoNotMatchTableRef = 1240 + ErrOperandColumns = 1241 + ErrSubqueryNo1Row = 1242 + ErrUnknownStmtHandler = 1243 + ErrCorruptHelpDB = 1244 + ErrCyclicReference = 1245 + ErrAutoConvert = 1246 + ErrIllegalReference = 1247 + ErrDerivedMustHaveAlias = 1248 + ErrSelectReduced = 1249 + ErrTablenameNotAllowedHere = 1250 + ErrNotSupportedAuthMode = 1251 + ErrSpatialCantHaveNull = 1252 + ErrCollationCharsetMismatch = 1253 + ErrTooBigForUncompress = 1256 + ErrZlibZMem = 1257 + ErrZlibZBuf = 1258 + ErrZlibZData = 1259 + ErrCutValueGroupConcat = 1260 + ErrWarnTooFewRecords = 1261 + ErrWarnTooManyRecords = 1262 + ErrWarnNullToNotnull = 1263 + ErrWarnDataOutOfRange = 1264 + WarnDataTruncated = 1265 + ErrWarnUsingOtherHandler = 1266 + ErrCantAggregate2collations = 1267 + ErrDropUser = 1268 + ErrRevokeGrants = 1269 + ErrCantAggregate3collations = 1270 + ErrCantAggregateNcollations = 1271 + ErrVariableIsNotStruct = 1272 + ErrUnknownCollation = 1273 + ErrServerIsInSecureAuthMode = 1275 + ErrWarnFieldResolved = 1276 + ErrUntilCondIgnored = 1279 + ErrWrongNameForIndex = 1280 + ErrWrongNameForCatalog = 1281 + ErrWarnQcResize = 1282 + ErrBadFtColumn = 1283 + ErrUnknownKeyCache = 1284 + ErrWarnHostnameWontWork = 1285 + ErrUnknownStorageEngine = 1286 + ErrWarnDeprecatedSyntax = 1287 + ErrNonUpdatableTable = 1288 + ErrFeatureDisabled = 1289 + ErrOptionPreventsStatement = 1290 + ErrDuplicatedValueInType = 1291 + ErrTruncatedWrongValue = 1292 + ErrTooMuchAutoTimestampCols = 1293 + ErrInvalidOnUpdate = 1294 + ErrUnsupportedPs = 1295 + ErrGetErrmsg = 1296 + ErrGetTemporaryErrmsg = 1297 + ErrUnknownTimeZone = 1298 + ErrWarnInvalidTimestamp = 1299 + ErrInvalidCharacterString = 1300 + ErrWarnAllowedPacketOverflowed = 1301 + ErrConflictingDeclarations = 1302 + ErrSpNoRecursiveCreate = 1303 + ErrSpAlreadyExists = 1304 + ErrSpDoesNotExist = 1305 + ErrSpDropFailed = 1306 + ErrSpStoreFailed = 1307 + ErrSpLilabelMismatch = 1308 + ErrSpLabelRedefine = 1309 + ErrSpLabelMismatch = 1310 + ErrSpUninitVar = 1311 + ErrSpBadselect = 1312 + ErrSpBadreturn = 1313 + ErrSpBadstatement = 1314 + ErrUpdateLogDeprecatedIgnored = 1315 + ErrUpdateLogDeprecatedTranslated = 1316 + ErrQueryInterrupted = 1317 + ErrSpWrongNoOfArgs = 1318 + ErrSpCondMismatch = 1319 + ErrSpNoreturn = 1320 + ErrSpNoreturnend = 1321 + ErrSpBadCursorQuery = 1322 + ErrSpBadCursorSelect = 1323 + ErrSpCursorMismatch = 1324 + ErrSpCursorAlreadyOpen = 1325 + ErrSpCursorNotOpen = 1326 + ErrSpUndeclaredVar = 1327 + ErrSpWrongNoOfFetchArgs = 1328 + ErrSpFetchNoData = 1329 + ErrSpDupParam = 1330 + ErrSpDupVar = 1331 + ErrSpDupCond = 1332 + ErrSpDupCurs = 1333 + ErrSpCantAlter = 1334 + ErrSpSubselectNyi = 1335 + ErrStmtNotAllowedInSfOrTrg = 1336 + ErrSpVarcondAfterCurshndlr = 1337 + ErrSpCursorAfterHandler = 1338 + ErrSpCaseNotFound = 1339 + ErrFparserTooBigFile = 1340 + ErrFparserBadHeader = 1341 + ErrFparserEOFInComment = 1342 + ErrFparserErrorInParameter = 1343 + ErrFparserEOFInUnknownParameter = 1344 + ErrViewNoExplain = 1345 + ErrFrmUnknownType = 1346 + ErrWrongObject = 1347 + ErrNonupdateableColumn = 1348 + ErrViewSelectDerived = 1349 + ErrViewSelectClause = 1350 + ErrViewSelectVariable = 1351 + ErrViewSelectTmptable = 1352 + ErrViewWrongList = 1353 + ErrWarnViewMerge = 1354 + ErrWarnViewWithoutKey = 1355 + ErrViewInvalid = 1356 + ErrSpNoDropSp = 1357 + ErrSpGotoInHndlr = 1358 + ErrTrgAlreadyExists = 1359 + ErrTrgDoesNotExist = 1360 + ErrTrgOnViewOrTempTable = 1361 + ErrTrgCantChangeRow = 1362 + ErrTrgNoSuchRowInTrg = 1363 + ErrNoDefaultForField = 1364 + ErrDivisionByZero = 1365 + ErrTruncatedWrongValueForField = 1366 + ErrIllegalValueForType = 1367 + ErrViewNonupdCheck = 1368 + ErrViewCheckFailed = 1369 + ErrProcaccessDenied = 1370 + ErrRelayLogFail = 1371 + ErrPasswdLength = 1372 + ErrUnknownTargetBinlog = 1373 + ErrIoErrLogIndexRead = 1374 + ErrBinlogPurgeProhibited = 1375 + ErrFseekFail = 1376 + ErrBinlogPurgeFatalErr = 1377 + ErrLogInUse = 1378 + ErrLogPurgeUnknownErr = 1379 + ErrRelayLogInit = 1380 + ErrNoBinaryLogging = 1381 + ErrReservedSyntax = 1382 + ErrWsasFailed = 1383 + ErrDiffGroupsProc = 1384 + ErrNoGroupForProc = 1385 + ErrOrderWithProc = 1386 + ErrLoggingProhibitChangingOf = 1387 + ErrNoFileMapping = 1388 + ErrWrongMagic = 1389 + ErrPsManyParam = 1390 + ErrKeyPart0 = 1391 + ErrViewChecksum = 1392 + ErrViewMultiupdate = 1393 + ErrViewNoInsertFieldList = 1394 + ErrViewDeleteMergeView = 1395 + ErrCannotUser = 1396 + ErrXaerNota = 1397 + ErrXaerInval = 1398 + ErrXaerRmfail = 1399 + ErrXaerOutside = 1400 + ErrXaerRmerr = 1401 + ErrXaRbrollback = 1402 + ErrNonexistingProcGrant = 1403 + ErrProcAutoGrantFail = 1404 + ErrProcAutoRevokeFail = 1405 + ErrDataTooLong = 1406 + ErrSpBadSQLstate = 1407 + ErrStartup = 1408 + ErrLoadFromFixedSizeRowsToVar = 1409 + ErrCantCreateUserWithGrant = 1410 + ErrWrongValueForType = 1411 + ErrTableDefChanged = 1412 + ErrSpDupHandler = 1413 + ErrSpNotVarArg = 1414 + ErrSpNoRetset = 1415 + ErrCantCreateGeometryObject = 1416 + ErrFailedRoutineBreakBinlog = 1417 + ErrBinlogUnsafeRoutine = 1418 + ErrBinlogCreateRoutineNeedSuper = 1419 + ErrExecStmtWithOpenCursor = 1420 + ErrStmtHasNoOpenCursor = 1421 + ErrCommitNotAllowedInSfOrTrg = 1422 + ErrNoDefaultForViewField = 1423 + ErrSpNoRecursion = 1424 + ErrTooBigScale = 1425 + ErrTooBigPrecision = 1426 + ErrMBiggerThanD = 1427 + ErrWrongLockOfSystemTable = 1428 + ErrConnectToForeignDataSource = 1429 + ErrQueryOnForeignDataSource = 1430 + ErrForeignDataSourceDoesntExist = 1431 + ErrForeignDataStringInvalidCantCreate = 1432 + ErrForeignDataStringInvalid = 1433 + ErrCantCreateFederatedTable = 1434 + ErrTrgInWrongSchema = 1435 + ErrStackOverrunNeedMore = 1436 + ErrTooLongBody = 1437 + ErrWarnCantDropDefaultKeycache = 1438 + ErrTooBigDisplaywidth = 1439 + ErrXaerDupid = 1440 + ErrDatetimeFunctionOverflow = 1441 + ErrCantUpdateUsedTableInSfOrTrg = 1442 + ErrViewPreventUpdate = 1443 + ErrPsNoRecursion = 1444 + ErrSpCantSetAutocommit = 1445 + ErrMalformedDefiner = 1446 + ErrViewFrmNoUser = 1447 + ErrViewOtherUser = 1448 + ErrNoSuchUser = 1449 + ErrForbidSchemaChange = 1450 + ErrRowIsReferenced2 = 1451 + ErrNoReferencedRow2 = 1452 + ErrSpBadVarShadow = 1453 + ErrTrgNoDefiner = 1454 + ErrOldFileFormat = 1455 + ErrSpRecursionLimit = 1456 + ErrSpProcTableCorrupt = 1457 + ErrSpWrongName = 1458 + ErrTableNeedsUpgrade = 1459 + ErrSpNoAggregate = 1460 + ErrMaxPreparedStmtCountReached = 1461 + ErrViewRecursive = 1462 + ErrNonGroupingFieldUsed = 1463 + ErrTableCantHandleSpkeys = 1464 + ErrNoTriggersOnSystemSchema = 1465 + ErrRemovedSpaces = 1466 + ErrAutoincReadFailed = 1467 + ErrUsername = 1468 + ErrHostname = 1469 + ErrWrongStringLength = 1470 + ErrNonInsertableTable = 1471 + ErrAdminWrongMrgTable = 1472 + ErrTooHighLevelOfNestingForSelect = 1473 + ErrNameBecomesEmpty = 1474 + ErrAmbiguousFieldTerm = 1475 + ErrForeignServerExists = 1476 + ErrForeignServerDoesntExist = 1477 + ErrIllegalHaCreateOption = 1478 + ErrPartitionRequiresValues = 1479 + ErrPartitionWrongValues = 1480 + ErrPartitionMaxvalue = 1481 + ErrPartitionSubpartition = 1482 + ErrPartitionSubpartMix = 1483 + ErrPartitionWrongNoPart = 1484 + ErrPartitionWrongNoSubpart = 1485 + ErrWrongExprInPartitionFunc = 1486 + ErrNoConstExprInRangeOrList = 1487 + ErrFieldNotFoundPart = 1488 + ErrListOfFieldsOnlyInHash = 1489 + ErrInconsistentPartitionInfo = 1490 + ErrPartitionFuncNotAllowed = 1491 + ErrPartitionsMustBeDefined = 1492 + ErrRangeNotIncreasing = 1493 + ErrInconsistentTypeOfFunctions = 1494 + ErrMultipleDefConstInListPart = 1495 + ErrPartitionEntry = 1496 + ErrMixHandler = 1497 + ErrPartitionNotDefined = 1498 + ErrTooManyPartitions = 1499 + ErrSubpartition = 1500 + ErrCantCreateHandlerFile = 1501 + ErrBlobFieldInPartFunc = 1502 + ErrUniqueKeyNeedAllFieldsInPf = 1503 + ErrNoParts = 1504 + ErrPartitionMgmtOnNonpartitioned = 1505 + ErrForeignKeyOnPartitioned = 1506 + ErrDropPartitionNonExistent = 1507 + ErrDropLastPartition = 1508 + ErrCoalesceOnlyOnHashPartition = 1509 + ErrReorgHashOnlyOnSameNo = 1510 + ErrReorgNoParam = 1511 + ErrOnlyOnRangeListPartition = 1512 + ErrAddPartitionSubpart = 1513 + ErrAddPartitionNoNewPartition = 1514 + ErrCoalescePartitionNoPartition = 1515 + ErrReorgPartitionNotExist = 1516 + ErrSameNamePartition = 1517 + ErrNoBinlog = 1518 + ErrConsecutiveReorgPartitions = 1519 + ErrReorgOutsideRange = 1520 + ErrPartitionFunctionFailure = 1521 + ErrPartState = 1522 + ErrLimitedPartRange = 1523 + ErrPluginIsNotLoaded = 1524 + ErrWrongValue = 1525 + ErrNoPartitionForGivenValue = 1526 + ErrFilegroupOptionOnlyOnce = 1527 + ErrCreateFilegroupFailed = 1528 + ErrDropFilegroupFailed = 1529 + ErrTablespaceAutoExtend = 1530 + ErrWrongSizeNumber = 1531 + ErrSizeOverflow = 1532 + ErrAlterFilegroupFailed = 1533 + ErrBinlogRowLoggingFailed = 1534 + ErrEventAlreadyExists = 1537 + ErrEventStoreFailed = 1538 + ErrEventDoesNotExist = 1539 + ErrEventCantAlter = 1540 + ErrEventDropFailed = 1541 + ErrEventIntervalNotPositiveOrTooBig = 1542 + ErrEventEndsBeforeStarts = 1543 + ErrEventExecTimeInThePast = 1544 + ErrEventOpenTableFailed = 1545 + ErrEventNeitherMExprNorMAt = 1546 + ErrObsoleteColCountDoesntMatchCorrupted = 1547 + ErrObsoleteCannotLoadFromTable = 1548 + ErrEventCannotDelete = 1549 + ErrEventCompile = 1550 + ErrEventSameName = 1551 + ErrEventDataTooLong = 1552 + ErrDropIndexFk = 1553 + ErrWarnDeprecatedSyntaxWithVer = 1554 + ErrCantWriteLockLogTable = 1555 + ErrCantLockLogTable = 1556 + ErrForeignDuplicateKeyOldUnused = 1557 + ErrColCountDoesntMatchPleaseUpdate = 1558 + ErrTempTablePreventsSwitchOutOfRbr = 1559 + ErrStoredFunctionPreventsSwitchBinlogFormat = 1560 + ErrNdbCantSwitchBinlogFormat = 1561 + ErrPartitionNoTemporary = 1562 + ErrPartitionConstDomain = 1563 + ErrPartitionFunctionIsNotAllowed = 1564 + ErrDdlLog = 1565 + ErrNullInValuesLessThan = 1566 + ErrWrongPartitionName = 1567 + ErrCantChangeTxCharacteristics = 1568 + ErrDupEntryAutoincrementCase = 1569 + ErrEventModifyQueue = 1570 + ErrEventSetVar = 1571 + ErrPartitionMerge = 1572 + ErrCantActivateLog = 1573 + ErrRbrNotAvailable = 1574 + ErrBase64Decode = 1575 + ErrEventRecursionForbidden = 1576 + ErrEventsDB = 1577 + ErrOnlyIntegersAllowed = 1578 + ErrUnsuportedLogEngine = 1579 + ErrBadLogStatement = 1580 + ErrCantRenameLogTable = 1581 + ErrWrongParamcountToNativeFct = 1582 + ErrWrongParametersToNativeFct = 1583 + ErrWrongParametersToStoredFct = 1584 + ErrNativeFctNameCollision = 1585 + ErrDupEntryWithKeyName = 1586 + ErrBinlogPurgeEmFile = 1587 + ErrEventCannotCreateInThePast = 1588 + ErrEventCannotAlterInThePast = 1589 + ErrNoPartitionForGivenValueSilent = 1591 + ErrBinlogUnsafeStatement = 1592 + ErrBinlogLoggingImpossible = 1598 + ErrViewNoCreationCtx = 1599 + ErrViewInvalidCreationCtx = 1600 + ErrSrInvalidCreationCtx = 1601 + ErrTrgCorruptedFile = 1602 + ErrTrgNoCreationCtx = 1603 + ErrTrgInvalidCreationCtx = 1604 + ErrEventInvalidCreationCtx = 1605 + ErrTrgCantOpenTable = 1606 + ErrCantCreateSroutine = 1607 + ErrNoFormatDescriptionEventBeforeBinlogStatement = 1609 + ErrLoadDataInvalidColumn = 1611 + ErrLogPurgeNoFile = 1612 + ErrXaRbtimeout = 1613 + ErrXaRbdeadlock = 1614 + ErrNeedReprepare = 1615 + ErrDelayedNotSupported = 1616 + WarnOptionIgnored = 1618 + WarnPluginDeleteBuiltin = 1619 + WarnPluginBusy = 1620 + ErrVariableIsReadonly = 1621 + ErrWarnEngineTransactionRollback = 1622 + ErrNdbReplicationSchema = 1625 + ErrConflictFnParse = 1626 + ErrExceptionsWrite = 1627 + ErrTooLongTableComment = 1628 + ErrTooLongFieldComment = 1629 + ErrFuncInexistentNameCollision = 1630 + ErrDatabaseName = 1631 + ErrTableName = 1632 + ErrPartitionName = 1633 + ErrSubpartitionName = 1634 + ErrTemporaryName = 1635 + ErrRenamedName = 1636 + ErrTooManyConcurrentTrxs = 1637 + WarnNonASCIISeparatorNotImplemented = 1638 + ErrDebugSyncTimeout = 1639 + ErrDebugSyncHitLimit = 1640 + ErrDupSignalSet = 1641 + ErrSignalWarn = 1642 + ErrSignalNotFound = 1643 + ErrSignalException = 1644 + ErrResignalWithoutActiveHandler = 1645 + ErrSignalBadConditionType = 1646 + WarnCondItemTruncated = 1647 + ErrCondItemTooLong = 1648 + ErrUnknownLocale = 1649 + ErrQueryCacheDisabled = 1651 + ErrSameNamePartitionField = 1652 + ErrPartitionColumnList = 1653 + ErrWrongTypeColumnValue = 1654 + ErrTooManyPartitionFuncFields = 1655 + ErrMaxvalueInValuesIn = 1656 + ErrTooManyValues = 1657 + ErrRowSinglePartitionField = 1658 + ErrFieldTypeNotAllowedAsPartitionField = 1659 + ErrPartitionFieldsTooLong = 1660 + ErrBinlogRowEngineAndStmtEngine = 1661 + ErrBinlogRowModeAndStmtEngine = 1662 + ErrBinlogUnsafeAndStmtEngine = 1663 + ErrBinlogRowInjectionAndStmtEngine = 1664 + ErrBinlogStmtModeAndRowEngine = 1665 + ErrBinlogRowInjectionAndStmtMode = 1666 + ErrBinlogMultipleEnginesAndSelfLoggingEngine = 1667 + ErrBinlogUnsafeLimit = 1668 + ErrBinlogUnsafeInsertDelayed = 1669 + ErrBinlogUnsafeAutoincColumns = 1671 + ErrBinlogUnsafeNontransAfterTrans = 1675 + ErrMessageAndStatement = 1676 + ErrInsideTransactionPreventsSwitchBinlogFormat = 1679 + ErrPathLength = 1680 + ErrWarnDeprecatedSyntaxNoReplacement = 1681 + ErrWrongNativeTableStructure = 1682 + ErrWrongPerfSchemaUsage = 1683 + ErrWarnISSkippedTable = 1684 + ErrInsideTransactionPreventsSwitchBinlogDirect = 1685 + ErrStoredFunctionPreventsSwitchBinlogDirect = 1686 + ErrSpatialMustHaveGeomCol = 1687 + ErrTooLongIndexComment = 1688 + ErrLockAborted = 1689 + ErrDataOutOfRange = 1690 + ErrWrongSpvarTypeInLimit = 1691 + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine = 1692 + ErrBinlogUnsafeMixedStatement = 1693 + ErrInsideTransactionPreventsSwitchSQLLogBin = 1694 + ErrStoredFunctionPreventsSwitchSQLLogBin = 1695 + ErrFailedReadFromParFile = 1696 + ErrValuesIsNotIntType = 1697 + ErrAccessDeniedNoPassword = 1698 + ErrSetPasswordAuthPlugin = 1699 + ErrGrantPluginUserExists = 1700 + ErrTruncateIllegalFk = 1701 + ErrPluginIsPermanent = 1702 + ErrStmtCacheFull = 1705 + ErrMultiUpdateKeyConflict = 1706 + ErrTableNeedsRebuild = 1707 + WarnOptionBelowLimit = 1708 + ErrIndexColumnTooLong = 1709 + ErrErrorInTriggerBody = 1710 + ErrErrorInUnknownTriggerBody = 1711 + ErrIndexCorrupt = 1712 + ErrUndoRecordTooBig = 1713 + ErrPluginNoUninstall = 1720 + ErrPluginNoInstall = 1721 + ErrBinlogUnsafeInsertTwoKeys = 1724 + ErrTableInFkCheck = 1725 + ErrUnsupportedEngine = 1726 + ErrBinlogUnsafeAutoincNotFirst = 1727 + ErrCannotLoadFromTableV2 = 1728 + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement = 1730 + ErrPartitionExchangeDifferentOption = 1731 + ErrPartitionExchangePartTable = 1732 + ErrPartitionExchangeTempTable = 1733 + ErrPartitionInsteadOfSubpartition = 1734 + ErrUnknownPartition = 1735 + ErrTablesDifferentMetadata = 1736 + ErrRowDoesNotMatchPartition = 1737 + ErrBinlogCacheSizeGreaterThanMax = 1738 + ErrWarnIndexNotApplicable = 1739 + ErrPartitionExchangeForeignKey = 1740 + ErrNoSuchKeyValue = 1741 + ErrRplInfoDataTooLong = 1742 + ErrNetworkReadEventChecksumFailure = 1743 + ErrBinlogReadEventChecksumFailure = 1744 + ErrBinlogStmtCacheSizeGreaterThanMax = 1745 + ErrCantUpdateTableInCreateTableSelect = 1746 + ErrPartitionClauseOnNonpartitioned = 1747 + ErrRowDoesNotMatchGivenPartitionSet = 1748 + ErrNoSuchPartitionunused = 1749 + ErrChangeRplInfoRepositoryFailure = 1750 + ErrWarningNotCompleteRollbackWithCreatedTempTable = 1751 + ErrWarningNotCompleteRollbackWithDroppedTempTable = 1752 + ErrMtsUpdatedDBsGreaterMax = 1754 + ErrMtsCantParallel = 1755 + ErrMtsInconsistentData = 1756 + ErrFulltextNotSupportedWithPartitioning = 1757 + ErrDaInvalidConditionNumber = 1758 + ErrInsecurePlainText = 1759 + ErrForeignDuplicateKeyWithChildInfo = 1761 + ErrForeignDuplicateKeyWithoutChildInfo = 1762 + ErrTableHasNoFt = 1764 + ErrVariableNotSettableInSfOrTrigger = 1765 + ErrVariableNotSettableInTransaction = 1766 + ErrGtidNextIsNotInGtidNextList = 1767 + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull = 1768 + ErrSetStatementCannotInvokeFunction = 1769 + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull = 1770 + ErrSkippingLoggedTransaction = 1771 + ErrMalformedGtidSetSpecification = 1772 + ErrMalformedGtidSetEncoding = 1773 + ErrMalformedGtidSpecification = 1774 + ErrGnoExhausted = 1775 + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet = 1778 + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn = 1779 + ErrCantSetGtidNextToGtidWhenGtidModeIsOff = 1781 + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn = 1782 + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff = 1783 + ErrFoundGtidEventWhenGtidModeIsOff = 1784 + ErrGtidUnsafeNonTransactionalTable = 1785 + ErrGtidUnsafeCreateSelect = 1786 + ErrGtidUnsafeCreateDropTemporaryTableInTransaction = 1787 + ErrGtidModeCanOnlyChangeOneStepAtATime = 1788 + ErrCantSetGtidNextWhenOwningGtid = 1790 + ErrUnknownExplainFormat = 1791 + ErrCantExecuteInReadOnlyTransaction = 1792 + ErrTooLongTablePartitionComment = 1793 + ErrInnodbFtLimit = 1795 + ErrInnodbNoFtTempTable = 1796 + ErrInnodbFtWrongDocidColumn = 1797 + ErrInnodbFtWrongDocidIndex = 1798 + ErrInnodbOnlineLogTooBig = 1799 + ErrUnknownAlterAlgorithm = 1800 + ErrUnknownAlterLock = 1801 + ErrMtsResetWorkers = 1804 + ErrColCountDoesntMatchCorruptedV2 = 1805 + ErrDiscardFkChecksRunning = 1807 + ErrTableSchemaMismatch = 1808 + ErrTableInSystemTablespace = 1809 + ErrIoRead = 1810 + ErrIoWrite = 1811 + ErrTablespaceMissing = 1812 + ErrTablespaceExists = 1813 + ErrTablespaceDiscarded = 1814 + ErrInternal = 1815 + ErrInnodbImport = 1816 + ErrInnodbIndexCorrupt = 1817 + ErrInvalidYearColumnLength = 1818 + ErrNotValidPassword = 1819 + ErrMustChangePassword = 1820 + ErrFkNoIndexChild = 1821 + ErrFkNoIndexParent = 1822 + ErrFkFailAddSystem = 1823 + ErrFkCannotOpenParent = 1824 + ErrFkIncorrectOption = 1825 + ErrFkDupName = 1826 + ErrPasswordFormat = 1827 + ErrFkColumnCannotDrop = 1828 + ErrFkColumnCannotDropChild = 1829 + ErrFkColumnNotNull = 1830 + ErrDupIndex = 1831 + ErrFkColumnCannotChange = 1832 + ErrFkColumnCannotChangeChild = 1833 + ErrFkCannotDeleteParent = 1834 + ErrMalformedPacket = 1835 + ErrReadOnlyMode = 1836 + ErrVariableNotSettableInSp = 1838 + ErrCantSetGtidPurgedWhenGtidModeIsOff = 1839 + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty = 1840 + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty = 1841 + ErrGtidPurgedWasChanged = 1842 + ErrGtidExecutedWasChanged = 1843 + ErrBinlogStmtModeAndNoReplTables = 1844 + ErrAlterOperationNotSupported = 1845 + ErrAlterOperationNotSupportedReason = 1846 + ErrAlterOperationNotSupportedReasonCopy = 1847 + ErrAlterOperationNotSupportedReasonPartition = 1848 + ErrAlterOperationNotSupportedReasonFkRename = 1849 + ErrAlterOperationNotSupportedReasonColumnType = 1850 + ErrAlterOperationNotSupportedReasonFkCheck = 1851 + ErrAlterOperationNotSupportedReasonIgnore = 1852 + ErrAlterOperationNotSupportedReasonNopk = 1853 + ErrAlterOperationNotSupportedReasonAutoinc = 1854 + ErrAlterOperationNotSupportedReasonHiddenFts = 1855 + ErrAlterOperationNotSupportedReasonChangeFts = 1856 + ErrAlterOperationNotSupportedReasonFts = 1857 + ErrDupUnknownInIndex = 1859 + ErrIdentCausesTooLongPath = 1860 + ErrAlterOperationNotSupportedReasonNotNull = 1861 + ErrMustChangePasswordLogin = 1862 + ErrRowInWrongPartition = 1863 + ErrErrorLast = 1863 + ErrMaxExecTimeExceeded = 1907 + ErrInvalidFieldSize = 3013 + ErrInvalidArgumentForLogarithm = 3020 + ErrAggregateOrderNonAggQuery = 3029 + ErrIncorrectType = 3064 + ErrFieldInOrderNotSelect = 3065 + ErrAggregateInOrderNotSelect = 3066 + ErrInvalidJSONData = 3069 + ErrGeneratedColumnFunctionIsNotAllowed = 3102 + ErrUnsupportedAlterInplaceOnVirtualColumn = 3103 + ErrWrongFKOptionForGeneratedColumn = 3104 + ErrBadGeneratedColumn = 3105 + ErrUnsupportedOnGeneratedColumn = 3106 + ErrGeneratedColumnNonPrior = 3107 + ErrDependentByGeneratedColumn = 3108 + ErrGeneratedColumnRefAutoInc = 3109 + ErrWarnConflictingHint = 3126 + ErrUnresolvedHintName = 3128 + ErrInvalidJSONText = 3140 + ErrInvalidJSONPath = 3143 + ErrInvalidTypeForJSON = 3146 + ErrInvalidJSONPathWildcard = 3149 + ErrInvalidJSONContainsPathType = 3150 + ErrJSONUsedAsKey = 3152 + ErrJSONDocumentNULLKey = 3158 + ErrSecureTransportRequired = 3159 + ErrBadUser = 3162 + ErrUserAlreadyExists = 3163 + ErrInvalidJSONPathArrayCell = 3165 + ErrInvalidEncryptionOption = 3184 + ErrTooLongValueForType = 3505 + ErrPKIndexCantBeInvisible = 3522 + ErrGrantRole = 3523 + ErrRoleNotGranted = 3530 + ErrLockAcquireFailAndNoWaitSet = 3572 + ErrCTERecursiveRequiresUnion = 3573 + ErrCTERecursiveRequiresNonRecursiveFirst = 3574 + ErrCTERecursiveForbidsAggregation = 3575 + ErrCTERecursiveForbiddenJoinOrder = 3576 + ErrInvalidRequiresSingleReference = 3577 + ErrWindowNoSuchWindow = 3579 + ErrWindowCircularityInWindowGraph = 3580 + ErrWindowNoChildPartitioning = 3581 + ErrWindowNoInherentFrame = 3582 + ErrWindowNoRedefineOrderBy = 3583 + ErrWindowFrameStartIllegal = 3584 + ErrWindowFrameEndIllegal = 3585 + ErrWindowFrameIllegal = 3586 + ErrWindowRangeFrameOrderType = 3587 + ErrWindowRangeFrameTemporalType = 3588 + ErrWindowRangeFrameNumericType = 3589 + ErrWindowRangeBoundNotConstant = 3590 + ErrWindowDuplicateName = 3591 + ErrWindowIllegalOrderBy = 3592 + ErrWindowInvalidWindowFuncUse = 3593 + ErrWindowInvalidWindowFuncAliasUse = 3594 + ErrWindowNestedWindowFuncUseInWindowSpec = 3595 + ErrWindowRowsIntervalUse = 3596 + ErrWindowNoGroupOrderUnused = 3597 + ErrWindowExplainJSON = 3598 + ErrWindowFunctionIgnoresFrame = 3599 + ErrIllegalPrivilegeLevel = 3619 + ErrCTEMaxRecursionDepth = 3636 + ErrNotHintUpdatable = 3637 + ErrDataTruncatedFunctionalIndex = 3751 + ErrDataOutOfRangeFunctionalIndex = 3752 + ErrFunctionalIndexOnJSONOrGeometryFunction = 3753 + ErrFunctionalIndexRefAutoIncrement = 3754 + ErrCannotDropColumnFunctionalIndex = 3755 + ErrFunctionalIndexPrimaryKey = 3756 + ErrFunctionalIndexOnBlob = 3757 + ErrFunctionalIndexFunctionIsNotAllowed = 3758 + ErrFulltextFunctionalIndex = 3759 + ErrSpatialFunctionalIndex = 3760 + ErrWrongKeyColumnFunctionalIndex = 3761 + ErrFunctionalIndexOnField = 3762 + ErrGeneratedColumnRowValueIsNotAllowed = 3764 + ErrFKIncompatibleColumns = 3780 + ErrFunctionalIndexRowValueIsNotAllowed = 3800 + ErrDependentByFunctionalIndex = 3837 + ErrInvalidJSONValueForFuncIndex = 3903 + ErrJSONValueOutOfRangeForFuncIndex = 3904 + ErrFunctionalIndexDataIsTooLong = 3907 + ErrFunctionalIndexNotApplicable = 3909 + ErrDynamicPrivilegeNotRegistered = 3929 + // MariaDB errors. + ErrOnlyOneDefaultPartionAllowed = 4030 + ErrWrongPartitionTypeExpectedSystemTime = 4113 + ErrSystemVersioningWrongPartitions = 4128 + ErrSequenceRunOut = 4135 + ErrSequenceInvalidData = 4136 + ErrSequenceAccessFail = 4137 + ErrNotSequence = 4138 + ErrUnknownSequence = 4139 + ErrWrongInsertIntoSequence = 4140 + ErrSequenceInvalidTableStructure = 4141 + // TiDB self-defined errors. + ErrMemExceedThreshold = 8001 + ErrForUpdateCantRetry = 8002 + ErrAdminCheckTable = 8003 + ErrTxnTooLarge = 8004 + ErrWriteConflictInTiDB = 8005 + ErrOptOnTemporaryTable = 8006 + ErrDropTableOnTemporaryTable = 8007 + ErrUnsupportedReloadPlugin = 8018 + ErrUnsupportedReloadPluginVar = 8019 + ErrTableLocked = 8020 + ErrNotExist = 8021 + ErrTxnRetryable = 8022 + ErrCannotSetNilValue = 8023 + ErrInvalidTxn = 8024 + ErrEntryTooLarge = 8025 + ErrNotImplemented = 8026 + ErrInfoSchemaExpired = 8027 + ErrInfoSchemaChanged = 8028 + ErrBadNumber = 8029 + ErrCastAsSignedOverflow = 8030 + ErrCastNegIntAsUnsigned = 8031 + ErrInvalidYearFormat = 8032 + ErrInvalidYear = 8033 + ErrIncorrectDatetimeValue = 8034 + ErrInvalidTimeFormat = 8036 + ErrInvalidWeekModeFormat = 8037 + ErrFieldGetDefaultFailed = 8038 + ErrIndexOutBound = 8039 + ErrUnsupportedOp = 8040 + ErrRowNotFound = 8041 + ErrTableStateCantNone = 8042 + ErrColumnStateNonPublic = 8043 + ErrIndexStateCantNone = 8044 + ErrInvalidRecordKey = 8045 + ErrColumnStateCantNone = 8046 + ErrUnsupportedValueForVar = 8047 + ErrUnsupportedIsolationLevel = 8048 + ErrLoadPrivilege = 8049 + ErrInvalidPrivilegeType = 8050 + ErrUnknownFieldType = 8051 + ErrInvalidSequence = 8052 + ErrCantGetValidID = 8053 + ErrCantSetToNull = 8054 + ErrSnapshotTooOld = 8055 + ErrInvalidTableID = 8056 + ErrInvalidType = 8057 + ErrUnknownAllocatorType = 8058 + ErrAutoRandReadFailed = 8059 + ErrInvalidIncrementAndOffset = 8060 + ErrWarnOptimizerHintUnsupportedHint = 8061 + ErrWarnOptimizerHintInvalidToken = 8062 + ErrWarnMemoryQuotaOverflow = 8063 + ErrWarnOptimizerHintParseError = 8064 + ErrWarnOptimizerHintInvalidInteger = 8065 + ErrUnsupportedSecondArgumentType = 8066 + ErrInvalidPluginID = 8101 + ErrInvalidPluginManifest = 8102 + ErrInvalidPluginName = 8103 + ErrInvalidPluginVersion = 8104 + ErrDuplicatePlugin = 8105 + ErrInvalidPluginSysVarName = 8106 + ErrRequireVersionCheckFail = 8107 + ErrUnsupportedType = 8108 + ErrAnalyzeMissIndex = 8109 + ErrCartesianProductUnsupported = 8110 + ErrPreparedStmtNotFound = 8111 + ErrWrongParamCount = 8112 + ErrSchemaChanged = 8113 + ErrUnknownPlan = 8114 + ErrPrepareMulti = 8115 + ErrPrepareDDL = 8116 + ErrResultIsEmpty = 8117 + ErrBuildExecutor = 8118 + ErrBatchInsertFail = 8119 + ErrGetStartTS = 8120 + ErrPrivilegeCheckFail = 8121 + ErrInvalidWildCard = 8122 + ErrMixOfGroupFuncAndFieldsIncompatible = 8123 + ErrBRIEBackupFailed = 8124 + ErrBRIERestoreFailed = 8125 + ErrBRIEImportFailed = 8126 + ErrBRIEExportFailed = 8127 + ErrInvalidTableSample = 8128 + ErrJSONObjectKeyTooLong = 8129 + ErrMultiStatementDisabled = 8130 + ErrPartitionStatsMissing = 8131 + ErrNotSupportedWithSem = 8132 + ErrDataInConsistentExtraIndex = 8133 + ErrDataInConsistentMisMatchIndex = 8134 + ErrAsOf = 8135 + + // Error codes used by TiDB ddl package + ErrUnsupportedDDLOperation = 8200 + ErrNotOwner = 8201 + ErrCantDecodeRecord = 8202 + ErrInvalidDDLWorker = 8203 + ErrInvalidDDLJob = 8204 + ErrInvalidDDLJobFlag = 8205 + ErrWaitReorgTimeout = 8206 + ErrInvalidStoreVersion = 8207 + ErrUnknownTypeLength = 8208 + ErrUnknownFractionLength = 8209 + ErrInvalidDDLState = 8210 + ErrReorgPanic = 8211 + ErrInvalidSplitRegionRanges = 8212 + ErrInvalidDDLJobVersion = 8213 + ErrCancelledDDLJob = 8214 + ErrRepairTable = 8215 + ErrInvalidAutoRandom = 8216 + ErrInvalidHashKeyFlag = 8217 + ErrInvalidListIndex = 8218 + ErrInvalidListMetaData = 8219 + ErrWriteOnSnapshot = 8220 + ErrInvalidKey = 8221 + ErrInvalidIndexKey = 8222 + ErrDataInConsistent = 8223 + ErrDDLJobNotFound = 8224 + ErrCancelFinishedDDLJob = 8225 + ErrCannotCancelDDLJob = 8226 + ErrSequenceUnsupportedTableOption = 8227 + ErrColumnTypeUnsupportedNextValue = 8228 + ErrLockExpire = 8229 + ErrAddColumnWithSequenceAsDefault = 8230 + ErrUnsupportedConstraintCheck = 8231 + ErrTableOptionUnionUnsupported = 8232 + ErrTableOptionInsertMethodUnsupported = 8233 + ErrInvalidPlacementSpec = 8234 + ErrDDLReorgElementNotExist = 8235 + ErrPlacementPolicyCheck = 8236 + ErrInvalidAttributesSpec = 8237 + ErrPlacementPolicyExists = 8238 + ErrPlacementPolicyNotExists = 8239 + ErrPlacementPolicyWithDirectOption = 8240 + ErrPlacementPolicyInUse = 8241 + + // TiKV/PD/TiFlash errors. + ErrPDServerTimeout = 9001 + ErrTiKVServerTimeout = 9002 + ErrTiKVServerBusy = 9003 + ErrResolveLockTimeout = 9004 + ErrRegionUnavailable = 9005 + ErrGCTooEarly = 9006 + ErrWriteConflict = 9007 + ErrTiKVStoreLimit = 9008 + ErrPrometheusAddrIsNotSet = 9009 + ErrTiKVStaleCommand = 9010 + ErrTiKVMaxTimestampNotSynced = 9011 + ErrTiFlashServerTimeout = 9012 + ErrTiFlashServerBusy = 9013 +) diff --git a/errno/errname.go b/errno/errname.go new file mode 100644 index 000000000..7fb22015b --- /dev/null +++ b/errno/errname.go @@ -0,0 +1,1077 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errno + +import "tinysql/parser/mysql" + +// MySQLErrName maps error code to MySQL error messages. +// Note: all ErrMessage to be added should be considered about the log redaction +// by setting the suitable configuration in the second argument of mysql.Message. +// See https://github.com/pingcap/tidb/blob/master/errno/logredaction.md +var MySQLErrName = map[uint16]*mysql.ErrMessage{ + ErrHashchk: mysql.Message("hashchk", nil), + ErrNisamchk: mysql.Message("isamchk", nil), + ErrNo: mysql.Message("NO", nil), + ErrYes: mysql.Message("YES", nil), + ErrCantCreateFile: mysql.Message("Can't create file '%-.200s' (errno: %d - %s)", nil), + ErrCantCreateTable: mysql.Message("Can't create table '%-.200s' (errno: %d)", nil), + ErrCantCreateDB: mysql.Message("Can't create database '%-.192s' (errno: %d)", nil), + ErrDBCreateExists: mysql.Message("Can't create database '%-.192s'; database exists", nil), + ErrDBDropExists: mysql.Message("Can't drop database '%-.192s'; database doesn't exist", nil), + ErrDBDropDelete: mysql.Message("Error dropping database (can't delete '%-.192s', errno: %d)", nil), + ErrDBDropRmdir: mysql.Message("Error dropping database (can't rmdir '%-.192s', errno: %d)", nil), + ErrCantDeleteFile: mysql.Message("Error on delete of '%-.192s' (errno: %d - %s)", nil), + ErrCantFindSystemRec: mysql.Message("Can't read record in system table", nil), + ErrCantGetStat: mysql.Message("Can't get status of '%-.200s' (errno: %d - %s)", nil), + ErrCantGetWd: mysql.Message("Can't get working directory (errno: %d - %s)", nil), + ErrCantLock: mysql.Message("Can't lock file (errno: %d - %s)", nil), + ErrCantOpenFile: mysql.Message("Can't open file: '%-.200s' (errno: %d - %s)", nil), + ErrFileNotFound: mysql.Message("Can't find file: '%-.200s' (errno: %d - %s)", nil), + ErrCantReadDir: mysql.Message("Can't read dir of '%-.192s' (errno: %d - %s)", nil), + ErrCantSetWd: mysql.Message("Can't change dir to '%-.192s' (errno: %d - %s)", nil), + ErrCheckread: mysql.Message("Record has changed since last read in table '%-.192s'", nil), + ErrDiskFull: mysql.Message("Disk full (%s); waiting for someone to free some space... (errno: %d - %s)", nil), + ErrDupKey: mysql.Message("Can't write; duplicate key in table '%-.192s'", nil), + ErrErrorOnClose: mysql.Message("Error on close of '%-.192s' (errno: %d - %s)", nil), + ErrErrorOnRead: mysql.Message("Error reading file '%-.200s' (errno: %d - %s)", nil), + ErrErrorOnRename: mysql.Message("Error on rename of '%-.210s' to '%-.210s' (errno: %d - %s)", nil), + ErrErrorOnWrite: mysql.Message("Error writing file '%-.200s' (errno: %d - %s)", nil), + ErrFileUsed: mysql.Message("'%-.192s' is locked against change", nil), + ErrFilsortAbort: mysql.Message("Sort aborted", nil), + ErrFormNotFound: mysql.Message("View '%-.192s' doesn't exist for '%-.192s'", nil), + ErrGetErrno: mysql.Message("Got error %d from storage engine", nil), + ErrIllegalHa: mysql.Message("Table storage engine for '%-.192s' doesn't have this option", nil), + ErrKeyNotFound: mysql.Message("Can't find record in '%-.192s'", nil), + ErrNotFormFile: mysql.Message("Incorrect information in file: '%-.200s'", nil), + ErrNotKeyFile: mysql.Message("Incorrect key file for table '%-.200s'; try to repair it", nil), + ErrOldKeyFile: mysql.Message("Old key file for table '%-.192s'; repair it!", nil), + ErrOpenAsReadonly: mysql.Message("Table '%-.192s' is read only", nil), + ErrOutofMemory: mysql.Message("Out of memory; restart server and try again (needed %d bytes)", nil), + ErrOutOfSortMemory: mysql.Message("Out of sort memory, consider increasing server sort buffer size", nil), + ErrUnexpectedEOF: mysql.Message("Unexpected EOF found when reading file '%-.192s' (errno: %d - %s)", nil), + ErrConCount: mysql.Message("Too many connections", nil), + ErrOutOfResources: mysql.Message("Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space", nil), + ErrBadHost: mysql.Message("Can't get hostname for your address", nil), + ErrHandshake: mysql.Message("Bad handshake", nil), + ErrDBaccessDenied: mysql.Message("Access denied for user '%-.48s'@'%-.255s' to database '%-.192s'", nil), + ErrAccessDenied: mysql.Message("Access denied for user '%-.48s'@'%-.255s' (using password: %s)", nil), + ErrNoDB: mysql.Message("No database selected", nil), + ErrUnknownCom: mysql.Message("Unknown command", nil), + ErrBadNull: mysql.Message("Column '%-.192s' cannot be null", nil), + ErrBadDB: mysql.Message("Unknown database '%-.192s'", nil), + ErrTableExists: mysql.Message("Table '%-.192s' already exists", nil), + ErrBadTable: mysql.Message("Unknown table '%-.100s'", nil), + ErrNonUniq: mysql.Message("Column '%-.192s' in %-.192s is ambiguous", nil), + ErrServerShutdown: mysql.Message("Server shutdown in progress", nil), + ErrBadField: mysql.Message("Unknown column '%-.192s' in '%-.192s'", nil), + ErrFieldNotInGroupBy: mysql.Message("Expression #%d of %s is not in GROUP BY clause and contains nonaggregated column '%s' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by", nil), + ErrWrongGroupField: mysql.Message("Can't group on '%-.192s'", nil), + ErrWrongSumSelect: mysql.Message("Statement has sum functions and columns in same statement", nil), + ErrWrongValueCount: mysql.Message("Column count doesn't match value count", nil), + ErrTooLongIdent: mysql.Message("Identifier name '%-.100s' is too long", nil), + ErrDupFieldName: mysql.Message("Duplicate column name '%-.192s'", nil), + ErrDupKeyName: mysql.Message("Duplicate key name '%-.192s'", nil), + ErrDupEntry: mysql.Message("Duplicate entry '%-.64s' for key '%-.192s'", []int{0}), + ErrWrongFieldSpec: mysql.Message("Incorrect column specifier for column '%-.192s'", nil), + ErrParse: mysql.Message("%s %s", nil), + ErrEmptyQuery: mysql.Message("Query was empty", nil), + ErrNonuniqTable: mysql.Message("Not unique table/alias: '%-.192s'", nil), + ErrInvalidDefault: mysql.Message("Invalid default value for '%-.192s'", nil), + ErrMultiplePriKey: mysql.Message("Multiple primary key defined", nil), + ErrTooManyKeys: mysql.Message("Too many keys specified; max %d keys allowed", nil), + ErrTooManyKeyParts: mysql.Message("Too many key parts specified; max %d parts allowed", nil), + ErrTooLongKey: mysql.Message("Specified key was too long; max key length is %d bytes", nil), + ErrKeyColumnDoesNotExits: mysql.Message("Key column '%-.192s' doesn't exist in table", nil), + ErrBlobUsedAsKey: mysql.Message("BLOB column '%-.192s' can't be used in key specification with the used table type", nil), + ErrTooBigFieldlength: mysql.Message("Column length too big for column '%-.192s' (max = %d); use BLOB or TEXT instead", nil), + ErrWrongAutoKey: mysql.Message("Incorrect table definition; there can be only one auto column and it must be defined as a key", nil), + ErrReady: mysql.Message("%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d", nil), + ErrNormalShutdown: mysql.Message("%s: Normal shutdown\n", nil), + ErrGotSignal: mysql.Message("%s: Got signal %d. Aborting!\n", nil), + ErrShutdownComplete: mysql.Message("%s: Shutdown complete\n", nil), + ErrForcingClose: mysql.Message("%s: Forcing close of thread %d user: '%-.48s'\n", nil), + ErrIpsock: mysql.Message("Can't create IP socket", nil), + ErrNoSuchIndex: mysql.Message("Table '%-.192s' has no index like the one used in CREATE INDEX; recreate the table", nil), + ErrWrongFieldTerminators: mysql.Message("Field separator argument is not what is expected; check the manual", nil), + ErrBlobsAndNoTerminated: mysql.Message("You can't use fixed rowlength with BLOBs; please use 'fields terminated by'", nil), + ErrTextFileNotReadable: mysql.Message("The file '%-.128s' must be in the database directory or be readable by all", nil), + ErrFileExists: mysql.Message("File '%-.200s' already exists", nil), + ErrLoadInfo: mysql.Message("Records: %d Deleted: %d Skipped: %d Warnings: %d", nil), + ErrAlterInfo: mysql.Message("Records: %d Duplicates: %d", nil), + ErrWrongSubKey: mysql.Message("Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys", nil), + ErrCantRemoveAllFields: mysql.Message("You can't delete all columns with ALTER TABLE; use DROP TABLE instead", nil), + ErrCantDropFieldOrKey: mysql.Message("Can't DROP '%-.192s'; check that column/key exists", nil), + ErrInsertInfo: mysql.Message("Records: %d Duplicates: %d Warnings: %d", nil), + ErrUpdateTableUsed: mysql.Message("You can't specify target table '%-.192s' for update in FROM clause", nil), + ErrNoSuchThread: mysql.Message("Unknown thread id: %d", nil), + ErrKillDenied: mysql.Message("You are not owner of thread %d", nil), + ErrNoTablesUsed: mysql.Message("No tables used", nil), + ErrTooBigSet: mysql.Message("Too many strings for column %-.192s and SET", nil), + ErrNoUniqueLogFile: mysql.Message("Can't generate a unique log-filename %-.200s.(1-999)\n", nil), + ErrTableNotLockedForWrite: mysql.Message("Table '%-.192s' was locked with a READ lock and can't be updated", nil), + ErrTableNotLocked: mysql.Message("Table '%-.192s' was not locked with LOCK TABLES", nil), + ErrBlobCantHaveDefault: mysql.Message("BLOB/TEXT/JSON column '%-.192s' can't have a default value", nil), + ErrWrongDBName: mysql.Message("Incorrect database name '%-.100s'", nil), + ErrWrongTableName: mysql.Message("Incorrect table name '%-.100s'", nil), + ErrTooBigSelect: mysql.Message("The SELECT would examine more than MAXJOINSIZE rows; check your WHERE and use SET SQLBIGSELECTS=1 or SET MAXJOINSIZE=# if the SELECT is okay", nil), + ErrUnknown: mysql.Message("Unknown error", nil), + ErrUnknownProcedure: mysql.Message("Unknown procedure '%-.192s'", nil), + ErrWrongParamcountToProcedure: mysql.Message("Incorrect parameter count to procedure '%-.192s'", nil), + ErrWrongParametersToProcedure: mysql.Message("Incorrect parameters to procedure '%-.192s'", nil), + ErrUnknownTable: mysql.Message("Unknown table '%-.192s' in %-.32s", nil), + ErrFieldSpecifiedTwice: mysql.Message("Column '%-.192s' specified twice", nil), + ErrInvalidGroupFuncUse: mysql.Message("Invalid use of group function", nil), + ErrUnsupportedExtension: mysql.Message("Table '%-.192s' uses an extension that doesn't exist in this MySQL version", nil), + ErrTableMustHaveColumns: mysql.Message("A table must have at least 1 column", nil), + ErrRecordFileFull: mysql.Message("The table '%-.192s' is full", nil), + ErrUnknownCharacterSet: mysql.Message("Unknown character set: '%-.64s'", nil), + ErrTooManyTables: mysql.Message("Too many tables; MySQL can only use %d tables in a join", nil), + ErrTooManyFields: mysql.Message("Too many columns", nil), + ErrTooBigRowsize: mysql.Message("Row size too large. The maximum row size for the used table type, not counting BLOBs, is %d. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", nil), + ErrStackOverrun: mysql.Message("Thread stack overrun: Used: %d of a %d stack. Use 'mysqld --threadStack=#' to specify a bigger stack if needed", nil), + ErrWrongOuterJoin: mysql.Message("Cross dependency found in OUTER JOIN; examine your ON conditions", nil), + ErrNullColumnInIndex: mysql.Message("Table handler doesn't support NULL in given index. Please change column '%-.192s' to be NOT NULL or use another handler", nil), + ErrCantFindUdf: mysql.Message("Can't load function '%-.192s'", nil), + ErrCantInitializeUdf: mysql.Message("Can't initialize function '%-.192s'; %-.80s", nil), + ErrUdfNoPaths: mysql.Message("No paths allowed for shared library", nil), + ErrUdfExists: mysql.Message("Function '%-.192s' already exists", nil), + ErrCantOpenLibrary: mysql.Message("Can't open shared library '%-.192s' (errno: %d %-.128s)", nil), + ErrCantFindDlEntry: mysql.Message("Can't find symbol '%-.128s' in library", nil), + ErrFunctionNotDefined: mysql.Message("Function '%-.192s' is not defined", nil), + ErrHostIsBlocked: mysql.Message("Host '%-.255s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'", nil), + ErrHostNotPrivileged: mysql.Message("Host '%-.255s' is not allowed to connect to this MySQL server", nil), + ErrPasswordAnonymousUser: mysql.Message("You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords", nil), + ErrPasswordNotAllowed: mysql.Message("You must have privileges to update tables in the mysql database to be able to change passwords for others", nil), + ErrPasswordNoMatch: mysql.Message("Can't find any matching row in the user table", nil), + ErrUpdateInfo: mysql.Message("Rows matched: %d Changed: %d Warnings: %d", nil), + ErrCantCreateThread: mysql.Message("Can't create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug", nil), + ErrWrongValueCountOnRow: mysql.Message("Column count doesn't match value count at row %d", nil), + ErrCantReopenTable: mysql.Message("Can't reopen table: '%-.192s'", nil), + ErrInvalidUseOfNull: mysql.Message("Invalid use of NULL value", nil), + ErrRegexp: mysql.Message("Got error '%-.64s' from regexp", nil), + ErrMixOfGroupFuncAndFields: mysql.Message("Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause", nil), + ErrNonexistingGrant: mysql.Message("There is no such grant defined for user '%-.48s' on host '%-.255s'", nil), + ErrTableaccessDenied: mysql.Message("%-.128s command denied to user '%-.48s'@'%-.255s' for table '%-.64s'", nil), + ErrColumnaccessDenied: mysql.Message("%-.16s command denied to user '%-.48s'@'%-.255s' for column '%-.192s' in table '%-.192s'", nil), + ErrIllegalGrantForTable: mysql.Message("Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used", nil), + ErrGrantWrongHostOrUser: mysql.Message("The host or user argument to GRANT is too long", nil), + ErrNoSuchTable: mysql.Message("Table '%-.192s.%-.192s' doesn't exist", nil), + ErrNonexistingTableGrant: mysql.Message("There is no such grant defined for user '%-.48s' on host '%-.255s' on table '%-.192s'", nil), + ErrNotAllowedCommand: mysql.Message("The used command is not allowed with this MySQL version", nil), + ErrSyntax: mysql.Message("You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use", nil), + ErrDelayedCantChangeLock: mysql.Message("Delayed insert thread couldn't get requested lock for table %-.192s", nil), + ErrTooManyDelayedThreads: mysql.Message("Too many delayed threads in use", nil), + ErrAbortingConnection: mysql.Message("Aborted connection %d to db: '%-.192s' user: '%-.48s' (%-.64s)", nil), + ErrNetPacketTooLarge: mysql.Message("Got a packet bigger than 'maxAllowedPacket' bytes", nil), + ErrNetReadErrorFromPipe: mysql.Message("Got a read error from the connection pipe", nil), + ErrNetFcntl: mysql.Message("Got an error from fcntl()", nil), + ErrNetPacketsOutOfOrder: mysql.Message("Got packets out of order", nil), + ErrNetUncompress: mysql.Message("Couldn't uncompress communication packet", nil), + ErrNetRead: mysql.Message("Got an error reading communication packets", nil), + ErrNetReadInterrupted: mysql.Message("Got timeout reading communication packets", nil), + ErrNetErrorOnWrite: mysql.Message("Got an error writing communication packets", nil), + ErrNetWriteInterrupted: mysql.Message("Got timeout writing communication packets", nil), + ErrTooLongString: mysql.Message("Result string is longer than 'maxAllowedPacket' bytes", nil), + ErrTableCantHandleBlob: mysql.Message("The used table type doesn't support BLOB/TEXT columns", nil), + ErrTableCantHandleAutoIncrement: mysql.Message("The used table type doesn't support AUTOINCREMENT columns", nil), + ErrDelayedInsertTableLocked: mysql.Message("INSERT DELAYED can't be used with table '%-.192s' because it is locked with LOCK TABLES", nil), + ErrWrongColumnName: mysql.Message("Incorrect column name '%-.100s'", nil), + ErrWrongKeyColumn: mysql.Message("The used storage engine can't index column '%-.192s'", nil), + ErrWrongMrgTable: mysql.Message("Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist", nil), + ErrDupUnique: mysql.Message("Can't write, because of unique constraint, to table '%-.192s'", nil), + ErrBlobKeyWithoutLength: mysql.Message("BLOB/TEXT column '%-.192s' used in key specification without a key length", nil), + ErrPrimaryCantHaveNull: mysql.Message("All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead", nil), + ErrTooManyRows: mysql.Message("Result consisted of more than one row", nil), + ErrRequiresPrimaryKey: mysql.Message("This table type requires a primary key", nil), + ErrNoRaidCompiled: mysql.Message("This version of MySQL is not compiled with RAID support", nil), + ErrUpdateWithoutKeyInSafeMode: mysql.Message("You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", nil), + ErrKeyDoesNotExist: mysql.Message("Key '%-.192s' doesn't exist in table '%-.192s'", nil), + ErrCheckNoSuchTable: mysql.Message("Can't open table", nil), + ErrCheckNotImplemented: mysql.Message("The storage engine for the table doesn't support %s", nil), + ErrCantDoThisDuringAnTransaction: mysql.Message("You are not allowed to execute this command in a transaction", nil), + ErrErrorDuringCommit: mysql.Message("Got error %d during COMMIT", nil), + ErrErrorDuringRollback: mysql.Message("Got error %d during ROLLBACK", nil), + ErrErrorDuringFlushLogs: mysql.Message("Got error %d during FLUSHLOGS", nil), + ErrErrorDuringCheckpoint: mysql.Message("Got error %d during CHECKPOINT", nil), + ErrNewAbortingConnection: mysql.Message("Aborted connection %d to db: '%-.192s' user: '%-.48s' host: '%-.255s' (%-.64s)", nil), + ErrDumpNotImplemented: mysql.Message("The storage engine for the table does not support binary table dump", nil), + ErrIndexRebuild: mysql.Message("Failed rebuilding the index of dumped table '%-.192s'", nil), + ErrFtMatchingKeyNotFound: mysql.Message("Can't find FULLTEXT index matching the column list", nil), + ErrLockOrActiveTransaction: mysql.Message("Can't execute the given command because you have active locked tables or an active transaction", nil), + ErrUnknownSystemVariable: mysql.Message("Unknown system variable '%-.64s'", nil), + ErrCrashedOnUsage: mysql.Message("Table '%-.192s' is marked as crashed and should be repaired", nil), + ErrCrashedOnRepair: mysql.Message("Table '%-.192s' is marked as crashed and last (automatic?) repair failed", nil), + ErrWarningNotCompleteRollback: mysql.Message("Some non-transactional changed tables couldn't be rolled back", nil), + ErrTransCacheFull: mysql.Message("Multi-statement transaction required more than 'maxBinlogCacheSize' bytes of storage; increase this mysqld variable and try again", nil), + ErrTooManyUserConnections: mysql.Message("User %-.64s already has more than 'maxUserConnections' active connections", nil), + ErrSetConstantsOnly: mysql.Message("You may only use constant expressions with SET", nil), + ErrLockWaitTimeout: mysql.Message("Lock wait timeout exceeded; try restarting transaction", nil), + ErrLockTableFull: mysql.Message("The total number of locks exceeds the lock table size", nil), + ErrReadOnlyTransaction: mysql.Message("Update locks cannot be acquired during a READ UNCOMMITTED transaction", nil), + ErrDropDBWithReadLock: mysql.Message("DROP DATABASE not allowed while thread is holding global read lock", nil), + ErrCreateDBWithReadLock: mysql.Message("CREATE DATABASE not allowed while thread is holding global read lock", nil), + ErrWrongArguments: mysql.Message("Incorrect arguments to %s", nil), + ErrNoPermissionToCreateUser: mysql.Message("'%-.48s'@'%-.255s' is not allowed to create new users", nil), + ErrUnionTablesInDifferentDir: mysql.Message("Incorrect table definition; all MERGE tables must be in the same database", nil), + ErrLockDeadlock: mysql.Message("Deadlock found when trying to get lock; try restarting transaction", nil), + ErrTableCantHandleFt: mysql.Message("The used table type doesn't support FULLTEXT indexes", nil), + ErrCannotAddForeign: mysql.Message("Cannot add foreign key constraint", nil), + ErrNoReferencedRow: mysql.Message("Cannot add or update a child row: a foreign key constraint fails", nil), + ErrRowIsReferenced: mysql.Message("Cannot delete or update a parent row: a foreign key constraint fails", nil), + ErrErrorWhenExecutingCommand: mysql.Message("Error when executing command %s: %-.128s", nil), + ErrWrongUsage: mysql.Message("Incorrect usage of %s and %s", nil), + ErrWrongNumberOfColumnsInSelect: mysql.Message("The used SELECT statements have a different number of columns", nil), + ErrCantUpdateWithReadlock: mysql.Message("Can't execute the query because you have a conflicting read lock", nil), + ErrMixingNotAllowed: mysql.Message("Mixing of transactional and non-transactional tables is disabled", nil), + ErrDupArgument: mysql.Message("Option '%s' used twice in statement", nil), + ErrUserLimitReached: mysql.Message("User '%-.64s' has exceeded the '%s' resource (current value: %d)", nil), + ErrSpecificAccessDenied: mysql.Message("Access denied; you need (at least one of) the %-.128s privilege(s) for this operation", nil), + ErrLocalVariable: mysql.Message("Variable '%-.64s' is a SESSION variable and can't be used with SET GLOBAL", nil), + ErrGlobalVariable: mysql.Message("Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", nil), + ErrNoDefault: mysql.Message("Variable '%-.64s' doesn't have a default value", nil), + ErrWrongValueForVar: mysql.Message("Variable '%-.64s' can't be set to the value of '%-.200s'", nil), + ErrWrongTypeForVar: mysql.Message("Incorrect argument type to variable '%-.64s'", nil), + ErrVarCantBeRead: mysql.Message("Variable '%-.64s' can only be set, not read", nil), + ErrCantUseOptionHere: mysql.Message("Incorrect usage/placement of '%s'", nil), + ErrNotSupportedYet: mysql.Message("This version of TiDB doesn't yet support '%s'", nil), + ErrIncorrectGlobalLocalVar: mysql.Message("Variable '%-.192s' is a %s variable", nil), + ErrWrongFkDef: mysql.Message("Incorrect foreign key definition for '%-.192s': %s", nil), + ErrKeyRefDoNotMatchTableRef: mysql.Message("Key reference and table reference don't match", nil), + ErrOperandColumns: mysql.Message("Operand should contain %d column(s)", nil), + ErrSubqueryNo1Row: mysql.Message("Subquery returns more than 1 row", nil), + ErrUnknownStmtHandler: mysql.Message("Unknown prepared statement handler (%.*s) given to %s", nil), + ErrCorruptHelpDB: mysql.Message("Help database is corrupt or does not exist", nil), + ErrCyclicReference: mysql.Message("Cyclic reference on subqueries", nil), + ErrAutoConvert: mysql.Message("Converting column '%s' from %s to %s", nil), + ErrIllegalReference: mysql.Message("Reference '%-.64s' not supported (%s)", nil), + ErrDerivedMustHaveAlias: mysql.Message("Every derived table must have its own alias", nil), + ErrSelectReduced: mysql.Message("Select %d was reduced during optimization", nil), + ErrTablenameNotAllowedHere: mysql.Message("Table '%s' from one of the %ss cannot be used in %s", nil), + ErrNotSupportedAuthMode: mysql.Message("Client does not support authentication protocol requested by server; consider upgrading MySQL client", nil), + ErrSpatialCantHaveNull: mysql.Message("All parts of a SPATIAL index must be NOT NULL", nil), + ErrCollationCharsetMismatch: mysql.Message("COLLATION '%s' is not valid for CHARACTER SET '%s'", nil), + ErrTooBigForUncompress: mysql.Message("Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)", nil), + ErrZlibZMem: mysql.Message("ZLIB: Not enough memory", nil), + ErrZlibZBuf: mysql.Message("ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)", nil), + ErrZlibZData: mysql.Message("ZLIB: Input data corrupted", nil), + ErrCutValueGroupConcat: mysql.Message("Some rows were cut by GROUPCONCAT(%s)", []int{0}), + ErrWarnTooFewRecords: mysql.Message("Row %d doesn't contain data for all columns", nil), + ErrWarnTooManyRecords: mysql.Message("Row %d was truncated; it contained more data than there were input columns", nil), + ErrWarnNullToNotnull: mysql.Message("Column set to default value; NULL supplied to NOT NULL column '%s' at row %d", nil), + ErrWarnDataOutOfRange: mysql.Message("Out of range value for column '%s' at row %d", nil), + WarnDataTruncated: mysql.Message("Data truncated for column '%s' at row %d", nil), + ErrWarnUsingOtherHandler: mysql.Message("Using storage engine %s for table '%s'", nil), + ErrCantAggregate2collations: mysql.Message("Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", nil), + ErrDropUser: mysql.Message("Cannot drop one or more of the requested users", nil), + ErrRevokeGrants: mysql.Message("Can't revoke all privileges for one or more of the requested users", nil), + ErrCantAggregate3collations: mysql.Message("Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", nil), + ErrCantAggregateNcollations: mysql.Message("Illegal mix of collations for operation '%s'", nil), + ErrVariableIsNotStruct: mysql.Message("Variable '%-.64s' is not a variable component (can't be used as XXXX.variableName)", nil), + ErrUnknownCollation: mysql.Message("Unknown collation: '%-.64s'", nil), + ErrServerIsInSecureAuthMode: mysql.Message("Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format", nil), + ErrWarnFieldResolved: mysql.Message("Field or reference '%-.192s%s%-.192s%s%-.192s' of SELECT #%d was resolved in SELECT #%d", nil), + ErrUntilCondIgnored: mysql.Message("SQL thread is not to be started so UNTIL options are ignored", nil), + ErrWrongNameForIndex: mysql.Message("Incorrect index name '%-.100s'", nil), + ErrWrongNameForCatalog: mysql.Message("Incorrect catalog name '%-.100s'", nil), + ErrWarnQcResize: mysql.Message("Query cache failed to set size %d; new query cache size is %d", nil), + ErrBadFtColumn: mysql.Message("Column '%-.192s' cannot be part of FULLTEXT index", nil), + ErrUnknownKeyCache: mysql.Message("Unknown key cache '%-.100s'", nil), + ErrWarnHostnameWontWork: mysql.Message("MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work", nil), + ErrUnknownStorageEngine: mysql.Message("Unknown storage engine '%s'", nil), + ErrWarnDeprecatedSyntax: mysql.Message("'%s' is deprecated and will be removed in a future release. Please use %s instead", nil), + ErrNonUpdatableTable: mysql.Message("The target table %-.100s of the %s is not updatable", nil), + ErrFeatureDisabled: mysql.Message("The '%s' feature is disabled; you need MySQL built with '%s' to have it working", nil), + ErrOptionPreventsStatement: mysql.Message("The MySQL server is running with the %s option so it cannot execute this statement", nil), + ErrDuplicatedValueInType: mysql.Message("Column '%-.100s' has duplicated value '%-.64s' in %s", []int{1}), + ErrTruncatedWrongValue: mysql.Message("Truncated incorrect %-.64s value: '%-.128s'", []int{1}), + ErrTooMuchAutoTimestampCols: mysql.Message("Incorrect table definition; there can be only one TIMESTAMP column with CURRENTTIMESTAMP in DEFAULT or ON UPDATE clause", nil), + ErrInvalidOnUpdate: mysql.Message("Invalid ON UPDATE clause for '%-.192s' column", nil), + ErrUnsupportedPs: mysql.Message("This command is not supported in the prepared statement protocol yet", nil), + ErrGetErrmsg: mysql.Message("Got error %d '%-.100s' from %s", nil), + ErrGetTemporaryErrmsg: mysql.Message("Got temporary error %d '%-.100s' from %s", nil), + ErrUnknownTimeZone: mysql.Message("Unknown or incorrect time zone: '%-.64s'", nil), + ErrWarnInvalidTimestamp: mysql.Message("Invalid TIMESTAMP value in column '%s' at row %d", nil), + ErrInvalidCharacterString: mysql.Message("Invalid %s character string: '%.64s'", []int{1}), + ErrWarnAllowedPacketOverflowed: mysql.Message("Result of %s() was larger than max_allowed_packet (%d) - truncated", nil), + ErrConflictingDeclarations: mysql.Message("Conflicting declarations: '%s%s' and '%s%s'", nil), + ErrSpNoRecursiveCreate: mysql.Message("Can't create a %s from within another stored routine", nil), + ErrSpAlreadyExists: mysql.Message("%s %s already exists", nil), + ErrSpDoesNotExist: mysql.Message("%s %s does not exist", nil), + ErrSpDropFailed: mysql.Message("Failed to DROP %s %s", nil), + ErrSpStoreFailed: mysql.Message("Failed to CREATE %s %s", nil), + ErrSpLilabelMismatch: mysql.Message("%s with no matching label: %s", nil), + ErrSpLabelRedefine: mysql.Message("Redefining label %s", nil), + ErrSpLabelMismatch: mysql.Message("End-label %s without match", nil), + ErrSpUninitVar: mysql.Message("Referring to uninitialized variable %s", nil), + ErrSpBadselect: mysql.Message("PROCEDURE %s can't return a result set in the given context", nil), + ErrSpBadreturn: mysql.Message("RETURN is only allowed in a FUNCTION", nil), + ErrSpBadstatement: mysql.Message("%s is not allowed in stored procedures", nil), + ErrUpdateLogDeprecatedIgnored: mysql.Message("The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been ignored.", nil), + ErrUpdateLogDeprecatedTranslated: mysql.Message("The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been translated to SET SQLLOGBIN.", nil), + ErrQueryInterrupted: mysql.Message("Query execution was interrupted", nil), + ErrSpWrongNoOfArgs: mysql.Message("Incorrect number of arguments for %s %s; expected %d, got %d", nil), + ErrSpCondMismatch: mysql.Message("Undefined CONDITION: %s", nil), + ErrSpNoreturn: mysql.Message("No RETURN found in FUNCTION %s", nil), + ErrSpNoreturnend: mysql.Message("FUNCTION %s ended without RETURN", nil), + ErrSpBadCursorQuery: mysql.Message("Cursor statement must be a SELECT", nil), + ErrSpBadCursorSelect: mysql.Message("Cursor SELECT must not have INTO", nil), + ErrSpCursorMismatch: mysql.Message("Undefined CURSOR: %s", nil), + ErrSpCursorAlreadyOpen: mysql.Message("Cursor is already open", nil), + ErrSpCursorNotOpen: mysql.Message("Cursor is not open", nil), + ErrSpUndeclaredVar: mysql.Message("Undeclared variable: %s", nil), + ErrSpWrongNoOfFetchArgs: mysql.Message("Incorrect number of FETCH variables", nil), + ErrSpFetchNoData: mysql.Message("No data - zero rows fetched, selected, or processed", nil), + ErrSpDupParam: mysql.Message("Duplicate parameter: %s", nil), + ErrSpDupVar: mysql.Message("Duplicate variable: %s", nil), + ErrSpDupCond: mysql.Message("Duplicate condition: %s", nil), + ErrSpDupCurs: mysql.Message("Duplicate cursor: %s", nil), + ErrSpCantAlter: mysql.Message("Failed to ALTER %s %s", nil), + ErrSpSubselectNyi: mysql.Message("Subquery value not supported", nil), + ErrStmtNotAllowedInSfOrTrg: mysql.Message("%s is not allowed in stored function or trigger", nil), + ErrSpVarcondAfterCurshndlr: mysql.Message("Variable or condition declaration after cursor or handler declaration", nil), + ErrSpCursorAfterHandler: mysql.Message("Cursor declaration after handler declaration", nil), + ErrSpCaseNotFound: mysql.Message("Case not found for CASE statement", nil), + ErrFparserTooBigFile: mysql.Message("Configuration file '%-.192s' is too big", nil), + ErrFparserBadHeader: mysql.Message("Malformed file type header in file '%-.192s'", nil), + ErrFparserEOFInComment: mysql.Message("Unexpected end of file while parsing comment '%-.200s'", nil), + ErrFparserErrorInParameter: mysql.Message("Error while parsing parameter '%-.192s' (line: '%-.192s')", nil), + ErrFparserEOFInUnknownParameter: mysql.Message("Unexpected end of file while skipping unknown parameter '%-.192s'", nil), + ErrViewNoExplain: mysql.Message("EXPLAIN/SHOW can not be issued; lacking privileges for underlying table", nil), + ErrFrmUnknownType: mysql.Message("File '%-.192s' has unknown type '%-.64s' in its header", nil), + ErrWrongObject: mysql.Message("'%-.192s.%-.192s' is not %s", nil), + ErrNonupdateableColumn: mysql.Message("Column '%-.192s' is not updatable", nil), + ErrViewSelectDerived: mysql.Message("View's SELECT contains a subquery in the FROM clause", nil), + ErrViewSelectClause: mysql.Message("View's SELECT contains a '%s' clause", nil), + ErrViewSelectVariable: mysql.Message("View's SELECT contains a variable or parameter", nil), + ErrViewSelectTmptable: mysql.Message("View's SELECT refers to a temporary table '%-.192s'", nil), + ErrViewWrongList: mysql.Message("In definition of view, derived table or common table expression, SELECT list and column names list have different column counts", nil), + ErrWarnViewMerge: mysql.Message("View merge algorithm can't be used here for now (assumed undefined algorithm)", nil), + ErrWarnViewWithoutKey: mysql.Message("View being updated does not have complete key of underlying table in it", nil), + ErrViewInvalid: mysql.Message("View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them", nil), + ErrSpNoDropSp: mysql.Message("Can't drop or alter a %s from within another stored routine", nil), + ErrSpGotoInHndlr: mysql.Message("GOTO is not allowed in a stored procedure handler", nil), + ErrTrgAlreadyExists: mysql.Message("Trigger already exists", nil), + ErrTrgDoesNotExist: mysql.Message("Trigger does not exist", nil), + ErrTrgOnViewOrTempTable: mysql.Message("Trigger's '%-.192s' is view or temporary table", nil), + ErrTrgCantChangeRow: mysql.Message("Updating of %s row is not allowed in %strigger", nil), + ErrTrgNoSuchRowInTrg: mysql.Message("There is no %s row in %s trigger", nil), + ErrNoDefaultForField: mysql.Message("Field '%-.192s' doesn't have a default value", nil), + ErrDivisionByZero: mysql.Message("Division by 0", nil), + ErrTruncatedWrongValueForField: mysql.Message("Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d", []int{0, 1}), + ErrIllegalValueForType: mysql.Message("Illegal %s '%-.192s' value found during parsing", []int{1}), + ErrViewNonupdCheck: mysql.Message("CHECK OPTION on non-updatable view '%-.192s.%-.192s'", nil), + ErrViewCheckFailed: mysql.Message("CHECK OPTION failed '%-.192s.%-.192s'", nil), + ErrProcaccessDenied: mysql.Message("%-.16s command denied to user '%-.48s'@'%-.255s' for routine '%-.192s'", nil), + ErrRelayLogFail: mysql.Message("Failed purging old relay logs: %s", nil), + ErrPasswdLength: mysql.Message("Password hash should be a %d-digit hexadecimal number", nil), + ErrUnknownTargetBinlog: mysql.Message("Target log not found in binlog index", nil), + ErrIoErrLogIndexRead: mysql.Message("I/O error reading log index file", nil), + ErrBinlogPurgeProhibited: mysql.Message("Server configuration does not permit binlog purge", nil), + ErrFseekFail: mysql.Message("Failed on fseek()", nil), + ErrBinlogPurgeFatalErr: mysql.Message("Fatal error during log purge", nil), + ErrLogInUse: mysql.Message("A purgeable log is in use, will not purge", nil), + ErrLogPurgeUnknownErr: mysql.Message("Unknown error during log purge", nil), + ErrRelayLogInit: mysql.Message("Failed initializing relay log position: %s", nil), + ErrNoBinaryLogging: mysql.Message("You are not using binary logging", nil), + ErrReservedSyntax: mysql.Message("The '%-.64s' syntax is reserved for purposes internal to the MySQL server", nil), + ErrWsasFailed: mysql.Message("WSAStartup Failed", nil), + ErrDiffGroupsProc: mysql.Message("Can't handle procedures with different groups yet", nil), + ErrNoGroupForProc: mysql.Message("Select must have a group with this procedure", nil), + ErrOrderWithProc: mysql.Message("Can't use ORDER clause with this procedure", nil), + ErrLoggingProhibitChangingOf: mysql.Message("Binary logging and replication forbid changing the global server %s", nil), + ErrNoFileMapping: mysql.Message("Can't map file: %-.200s, errno: %d", nil), + ErrWrongMagic: mysql.Message("Wrong magic in %-.64s", nil), + ErrPsManyParam: mysql.Message("Prepared statement contains too many placeholders", nil), + ErrKeyPart0: mysql.Message("Key part '%-.192s' length cannot be 0", nil), + ErrViewChecksum: mysql.Message("View text checksum failed", nil), + ErrViewMultiupdate: mysql.Message("Can not modify more than one base table through a join view '%-.192s.%-.192s'", nil), + ErrViewNoInsertFieldList: mysql.Message("Can not insert into join view '%-.192s.%-.192s' without fields list", nil), + ErrViewDeleteMergeView: mysql.Message("Can not delete from join view '%-.192s.%-.192s'", nil), + ErrCannotUser: mysql.Message("Operation %s failed for %.256s", nil), + ErrGrantRole: mysql.Message("Unknown authorization ID %.256s", nil), + ErrXaerNota: mysql.Message("XAERNOTA: Unknown XID", nil), + ErrXaerInval: mysql.Message("XAERINVAL: Invalid arguments (or unsupported command)", nil), + ErrXaerRmfail: mysql.Message("XAERRMFAIL: The command cannot be executed when global transaction is in the %.64s state", nil), + ErrXaerOutside: mysql.Message("XAEROUTSIDE: Some work is done outside global transaction", nil), + ErrXaerRmerr: mysql.Message("XAERRMERR: Fatal error occurred in the transaction branch - check your data for consistency", nil), + ErrXaRbrollback: mysql.Message("XARBROLLBACK: Transaction branch was rolled back", nil), + ErrNonexistingProcGrant: mysql.Message("There is no such grant defined for user '%-.48s' on host '%-.255s' on routine '%-.192s'", nil), + ErrProcAutoGrantFail: mysql.Message("Failed to grant EXECUTE and ALTER ROUTINE privileges", nil), + ErrProcAutoRevokeFail: mysql.Message("Failed to revoke all privileges to dropped routine", nil), + ErrDataTooLong: mysql.Message("Data too long for column '%s' at row %d", nil), + ErrSpBadSQLstate: mysql.Message("Bad SQLSTATE: '%s'", nil), + ErrStartup: mysql.Message("%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s", nil), + ErrLoadFromFixedSizeRowsToVar: mysql.Message("Can't load value from file with fixed size rows to variable", nil), + ErrCantCreateUserWithGrant: mysql.Message("You are not allowed to create a user with GRANT", nil), + ErrWrongValueForType: mysql.Message("Incorrect %-.32s value: '%-.128s' for function %-.32s", nil), + ErrTableDefChanged: mysql.Message("Table definition has changed, please retry transaction", nil), + ErrSpDupHandler: mysql.Message("Duplicate handler declared in the same block", nil), + ErrSpNotVarArg: mysql.Message("OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger", nil), + ErrSpNoRetset: mysql.Message("Not allowed to return a result set from a %s", nil), + ErrCantCreateGeometryObject: mysql.Message("Cannot get geometry object from data you send to the GEOMETRY field", nil), + ErrFailedRoutineBreakBinlog: mysql.Message("A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes", nil), + ErrBinlogUnsafeRoutine: mysql.Message("This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", nil), + ErrBinlogCreateRoutineNeedSuper: mysql.Message("You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", nil), + ErrExecStmtWithOpenCursor: mysql.Message("You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it.", nil), + ErrStmtHasNoOpenCursor: mysql.Message("The statement (%d) has no open cursor.", nil), + ErrCommitNotAllowedInSfOrTrg: mysql.Message("Explicit or implicit commit is not allowed in stored function or trigger.", nil), + ErrNoDefaultForViewField: mysql.Message("Field of view '%-.192s.%-.192s' underlying table doesn't have a default value", nil), + ErrSpNoRecursion: mysql.Message("Recursive stored functions and triggers are not allowed.", nil), + ErrTooBigScale: mysql.Message("Too big scale %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrTooBigPrecision: mysql.Message("Too big precision %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrMBiggerThanD: mysql.Message("For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s').", nil), + ErrWrongLockOfSystemTable: mysql.Message("You can't combine write-locking of system tables with other tables or lock types", nil), + ErrConnectToForeignDataSource: mysql.Message("Unable to connect to foreign data source: %.64s", nil), + ErrQueryOnForeignDataSource: mysql.Message("There was a problem processing the query on the foreign data source. Data source : %-.64s", nil), + ErrForeignDataSourceDoesntExist: mysql.Message("The foreign data source you are trying to reference does not exist. Data source : %-.64s", nil), + ErrForeignDataStringInvalidCantCreate: mysql.Message("Can't create federated table. The data source connection string '%-.64s' is not in the correct format", nil), + ErrForeignDataStringInvalid: mysql.Message("The data source connection string '%-.64s' is not in the correct format", nil), + ErrCantCreateFederatedTable: mysql.Message("Can't create federated table. Foreign data src : %-.64s", nil), + ErrTrgInWrongSchema: mysql.Message("Trigger in wrong schema", nil), + ErrStackOverrunNeedMore: mysql.Message("Thread stack overrun: %d bytes used of a %d byte stack, and %d bytes needed. Use 'mysqld --threadStack=#' to specify a bigger stack.", nil), + ErrTooLongBody: mysql.Message("Routine body for '%-.100s' is too long", nil), + ErrWarnCantDropDefaultKeycache: mysql.Message("Cannot drop default keycache", nil), + ErrTooBigDisplaywidth: mysql.Message("Display width out of range for column '%-.192s' (max = %d)", nil), + ErrXaerDupid: mysql.Message("XAERDUPID: The XID already exists", nil), + ErrDatetimeFunctionOverflow: mysql.Message("Datetime function: %-.32s field overflow", nil), + ErrCantUpdateUsedTableInSfOrTrg: mysql.Message("Can't update table '%-.192s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.", nil), + ErrViewPreventUpdate: mysql.Message("The definition of table '%-.192s' prevents operation %.192s on table '%-.192s'.", nil), + ErrPsNoRecursion: mysql.Message("The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner", nil), + ErrSpCantSetAutocommit: mysql.Message("Not allowed to set autocommit from a stored function or trigger", nil), + ErrMalformedDefiner: mysql.Message("Definer is not fully qualified", nil), + ErrViewFrmNoUser: mysql.Message("View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!", nil), + ErrViewOtherUser: mysql.Message("You need the SUPER privilege for creation view with '%-.192s'@'%-.255s' definer", nil), + ErrNoSuchUser: mysql.Message("The user specified as a definer ('%-.64s'@'%-.255s') does not exist", nil), + ErrForbidSchemaChange: mysql.Message("Changing schema from '%-.192s' to '%-.192s' is not allowed.", nil), + ErrRowIsReferenced2: mysql.Message("Cannot delete or update a parent row: a foreign key constraint fails (%.192s)", nil), + ErrNoReferencedRow2: mysql.Message("Cannot add or update a child row: a foreign key constraint fails (%.192s)", nil), + ErrSpBadVarShadow: mysql.Message("Variable '%-.64s' must be quoted with `...`, or renamed", nil), + ErrTrgNoDefiner: mysql.Message("No definer attribute for trigger '%-.192s'.'%-.192s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.", nil), + ErrOldFileFormat: mysql.Message("'%-.192s' has an old format, you should re-create the '%s' object(s)", nil), + ErrSpRecursionLimit: mysql.Message("Recursive limit %d (as set by the maxSpRecursionDepth variable) was exceeded for routine %.192s", nil), + ErrSpProcTableCorrupt: mysql.Message("Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)", nil), + ErrSpWrongName: mysql.Message("Incorrect routine name '%-.192s'", nil), + ErrTableNeedsUpgrade: mysql.Message("Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\"", nil), + ErrSpNoAggregate: mysql.Message("AGGREGATE is not supported for stored functions", nil), + ErrMaxPreparedStmtCountReached: mysql.Message("Can't create more than maxPreparedStmtCount statements (current value: %d)", nil), + ErrViewRecursive: mysql.Message("`%-.192s`.`%-.192s` contains view recursion", nil), + ErrNonGroupingFieldUsed: mysql.Message("Non-grouping field '%-.192s' is used in %-.64s clause", nil), + ErrTableCantHandleSpkeys: mysql.Message("The used table type doesn't support SPATIAL indexes", nil), + ErrNoTriggersOnSystemSchema: mysql.Message("Triggers can not be created on system tables", nil), + ErrRemovedSpaces: mysql.Message("Leading spaces are removed from name '%s'", nil), + ErrAutoincReadFailed: mysql.Message("Failed to read auto-increment value from storage engine", nil), + ErrUsername: mysql.Message("user name", nil), + ErrHostname: mysql.Message("host name", nil), + ErrWrongStringLength: mysql.Message("String '%-.70s' is too long for %s (should be no longer than %d)", nil), + ErrNonInsertableTable: mysql.Message("The target table %-.100s of the %s is not insertable-into", nil), + ErrAdminWrongMrgTable: mysql.Message("Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist", nil), + ErrTooHighLevelOfNestingForSelect: mysql.Message("Too high level of nesting for select", nil), + ErrNameBecomesEmpty: mysql.Message("Name '%-.64s' has become ''", nil), + ErrAmbiguousFieldTerm: mysql.Message("First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY", nil), + ErrForeignServerExists: mysql.Message("The foreign server, %s, you are trying to create already exists.", nil), + ErrForeignServerDoesntExist: mysql.Message("The foreign server name you are trying to reference does not exist. Data source : %-.64s", nil), + ErrIllegalHaCreateOption: mysql.Message("Table storage engine '%-.64s' does not support the create option '%.64s'", nil), + ErrPartitionRequiresValues: mysql.Message("Syntax : %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition", nil), + ErrPartitionWrongValues: mysql.Message("Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition", []int{1}), + ErrPartitionMaxvalue: mysql.Message("MAXVALUE can only be used in last partition definition", nil), + ErrPartitionSubpartition: mysql.Message("Subpartitions can only be hash partitions and by key", nil), + ErrPartitionSubpartMix: mysql.Message("Must define subpartitions on all partitions if on one partition", nil), + ErrPartitionWrongNoPart: mysql.Message("Wrong number of partitions defined, mismatch with previous setting", nil), + ErrPartitionWrongNoSubpart: mysql.Message("Wrong number of subpartitions defined, mismatch with previous setting", nil), + ErrWrongExprInPartitionFunc: mysql.Message("Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed", nil), + ErrNoConstExprInRangeOrList: mysql.Message("Expression in RANGE/LIST VALUES must be constant", nil), + ErrFieldNotFoundPart: mysql.Message("Field in list of fields for partition function not found in table", nil), + ErrListOfFieldsOnlyInHash: mysql.Message("List of fields is only allowed in KEY partitions", nil), + ErrInconsistentPartitionInfo: mysql.Message("The partition info in the frm file is not consistent with what can be written into the frm file", nil), + ErrPartitionFuncNotAllowed: mysql.Message("The %-.192s function returns the wrong type", nil), + ErrPartitionsMustBeDefined: mysql.Message("For %-.64s partitions each partition must be defined", nil), + ErrRangeNotIncreasing: mysql.Message("VALUES LESS THAN value must be strictly increasing for each partition", nil), + ErrInconsistentTypeOfFunctions: mysql.Message("VALUES value must be of same type as partition function", nil), + ErrMultipleDefConstInListPart: mysql.Message("Multiple definition of same constant in list partitioning", nil), + ErrPartitionEntry: mysql.Message("Partitioning can not be used stand-alone in query", nil), + ErrMixHandler: mysql.Message("The mix of handlers in the partitions is not allowed in this version of MySQL", nil), + ErrPartitionNotDefined: mysql.Message("For the partitioned engine it is necessary to define all %-.64s", nil), + ErrTooManyPartitions: mysql.Message("Too many partitions (including subpartitions) were defined", nil), + ErrSubpartition: mysql.Message("It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning", nil), + ErrCantCreateHandlerFile: mysql.Message("Failed to create specific handler file", nil), + ErrBlobFieldInPartFunc: mysql.Message("A BLOB field is not allowed in partition function", nil), + ErrUniqueKeyNeedAllFieldsInPf: mysql.Message("A %-.192s must include all columns in the table's partitioning function", nil), + ErrNoParts: mysql.Message("Number of %-.64s = 0 is not an allowed value", []int{0}), + ErrPartitionMgmtOnNonpartitioned: mysql.Message("Partition management on a not partitioned table is not possible", nil), + ErrForeignKeyOnPartitioned: mysql.Message("Foreign key clause is not yet supported in conjunction with partitioning", nil), + ErrDropPartitionNonExistent: mysql.Message("Error in list of partitions to %-.64s", nil), + ErrDropLastPartition: mysql.Message("Cannot remove all partitions, use DROP TABLE instead", nil), + ErrCoalesceOnlyOnHashPartition: mysql.Message("COALESCE PARTITION can only be used on HASH/KEY partitions", nil), + ErrReorgHashOnlyOnSameNo: mysql.Message("REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers", nil), + ErrReorgNoParam: mysql.Message("REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs", nil), + ErrOnlyOnRangeListPartition: mysql.Message("%-.64s PARTITION can only be used on RANGE/LIST partitions", nil), + ErrAddPartitionSubpart: mysql.Message("Trying to Add partition(s) with wrong number of subpartitions", nil), + ErrAddPartitionNoNewPartition: mysql.Message("At least one partition must be added", nil), + ErrCoalescePartitionNoPartition: mysql.Message("At least one partition must be coalesced", nil), + ErrReorgPartitionNotExist: mysql.Message("More partitions to reorganize than there are partitions", nil), + ErrSameNamePartition: mysql.Message("Duplicate partition name %-.192s", nil), + ErrNoBinlog: mysql.Message("It is not allowed to shut off binlog on this command", nil), + ErrConsecutiveReorgPartitions: mysql.Message("When reorganizing a set of partitions they must be in consecutive order", nil), + ErrReorgOutsideRange: mysql.Message("Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range", nil), + ErrPartitionFunctionFailure: mysql.Message("Partition function not supported in this version for this handler", nil), + ErrPartState: mysql.Message("Partition state cannot be defined from CREATE/ALTER TABLE", nil), + ErrLimitedPartRange: mysql.Message("The %-.64s handler only supports 32 bit integers in VALUES", nil), + ErrPluginIsNotLoaded: mysql.Message("Plugin '%-.192s' is not loaded", nil), + ErrWrongValue: mysql.Message("Incorrect %-.32s value: '%-.128s'", []int{1}), + ErrNoPartitionForGivenValue: mysql.Message("Table has no partition for value %-.64s", []int{0}), + ErrFilegroupOptionOnlyOnce: mysql.Message("It is not allowed to specify %s more than once", nil), + ErrCreateFilegroupFailed: mysql.Message("Failed to create %s", nil), + ErrDropFilegroupFailed: mysql.Message("Failed to drop %s", nil), + ErrTablespaceAutoExtend: mysql.Message("The handler doesn't support autoextend of tablespaces", nil), + ErrWrongSizeNumber: mysql.Message("A size parameter was incorrectly specified, either number or on the form 10M", nil), + ErrSizeOverflow: mysql.Message("The size number was correct but we don't allow the digit part to be more than 2 billion", nil), + ErrAlterFilegroupFailed: mysql.Message("Failed to alter: %s", nil), + ErrBinlogRowLoggingFailed: mysql.Message("Writing one row to the row-based binary log failed", nil), + ErrEventAlreadyExists: mysql.Message("Event '%-.192s' already exists", nil), + ErrEventStoreFailed: mysql.Message("Failed to store event %s. Error code %d from storage engine.", nil), + ErrEventDoesNotExist: mysql.Message("Unknown event '%-.192s'", nil), + ErrEventCantAlter: mysql.Message("Failed to alter event '%-.192s'", nil), + ErrEventDropFailed: mysql.Message("Failed to drop %s", nil), + ErrEventIntervalNotPositiveOrTooBig: mysql.Message("INTERVAL is either not positive or too big", nil), + ErrEventEndsBeforeStarts: mysql.Message("ENDS is either invalid or before STARTS", nil), + ErrEventExecTimeInThePast: mysql.Message("Event execution time is in the past. Event has been disabled", nil), + ErrEventOpenTableFailed: mysql.Message("Failed to open mysql.event", nil), + ErrEventNeitherMExprNorMAt: mysql.Message("No datetime expression provided", nil), + ErrObsoleteColCountDoesntMatchCorrupted: mysql.Message("Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted", nil), + ErrObsoleteCannotLoadFromTable: mysql.Message("Cannot load from mysql.%s. The table is probably corrupted", nil), + ErrEventCannotDelete: mysql.Message("Failed to delete the event from mysql.event", nil), + ErrEventCompile: mysql.Message("Error during compilation of event's body", nil), + ErrEventSameName: mysql.Message("Same old and new event name", nil), + ErrEventDataTooLong: mysql.Message("Data for column '%s' too long", nil), + ErrDropIndexFk: mysql.Message("Cannot drop index '%-.192s': needed in a foreign key constraint", nil), + ErrWarnDeprecatedSyntaxWithVer: mysql.Message("The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead", nil), + ErrCantWriteLockLogTable: mysql.Message("You can't write-lock a log table. Only read access is possible", nil), + ErrCantLockLogTable: mysql.Message("You can't use locks with log tables.", nil), + ErrForeignDuplicateKeyOldUnused: mysql.Message("Upholding foreign key constraints for table '%.192s', entry '%-.192s', key %d would lead to a duplicate entry", nil), + ErrColCountDoesntMatchPleaseUpdate: mysql.Message("Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysqlUpgrade to fix this error.", nil), + ErrTempTablePreventsSwitchOutOfRbr: mysql.Message("Cannot switch out of the row-based binary log format when the session has open temporary tables", nil), + ErrStoredFunctionPreventsSwitchBinlogFormat: mysql.Message("Cannot change the binary logging format inside a stored function or trigger", nil), + ErrNdbCantSwitchBinlogFormat: mysql.Message("The NDB cluster engine does not support changing the binlog format on the fly yet", nil), + ErrPartitionNoTemporary: mysql.Message("Cannot create temporary table with partitions", nil), + ErrPartitionConstDomain: mysql.Message("Partition constant is out of partition function domain", nil), + ErrPartitionFunctionIsNotAllowed: mysql.Message("This partition function is not allowed", nil), + ErrDdlLog: mysql.Message("Error in DDL log", nil), + ErrNullInValuesLessThan: mysql.Message("Not allowed to use NULL value in VALUES LESS THAN", nil), + ErrWrongPartitionName: mysql.Message("Incorrect partition name", nil), + ErrCantChangeTxCharacteristics: mysql.Message("Transaction characteristics can't be changed while a transaction is in progress", nil), + ErrDupEntryAutoincrementCase: mysql.Message("ALTER TABLE causes autoIncrement resequencing, resulting in duplicate entry '%-.192s' for key '%-.192s'", nil), + ErrEventModifyQueue: mysql.Message("Internal scheduler error %d", nil), + ErrEventSetVar: mysql.Message("Error during starting/stopping of the scheduler. Error code %d", nil), + ErrPartitionMerge: mysql.Message("Engine cannot be used in partitioned tables", nil), + ErrCantActivateLog: mysql.Message("Cannot activate '%-.64s' log", nil), + ErrRbrNotAvailable: mysql.Message("The server was not built with row-based replication", nil), + ErrBase64Decode: mysql.Message("Decoding of base64 string failed", nil), + ErrEventRecursionForbidden: mysql.Message("Recursion of EVENT DDL statements is forbidden when body is present", nil), + ErrEventsDB: mysql.Message("Cannot proceed because system tables used by Event Scheduler were found damaged at server start", nil), + ErrOnlyIntegersAllowed: mysql.Message("Only integers allowed as number here", nil), + ErrUnsuportedLogEngine: mysql.Message("This storage engine cannot be used for log tables\"", nil), + ErrBadLogStatement: mysql.Message("You cannot '%s' a log table if logging is enabled", nil), + ErrCantRenameLogTable: mysql.Message("Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to '%s'", nil), + ErrWrongParamcountToNativeFct: mysql.Message("Incorrect parameter count in the call to native function '%-.192s'", nil), + ErrWrongParametersToNativeFct: mysql.Message("Incorrect parameters in the call to native function '%-.192s'", nil), + ErrWrongParametersToStoredFct: mysql.Message("Incorrect parameters in the call to stored function '%-.192s'", nil), + ErrNativeFctNameCollision: mysql.Message("This function '%-.192s' has the same name as a native function", nil), + ErrDupEntryWithKeyName: mysql.Message("Duplicate entry '%-.64s' for key '%-.192s'", nil), + ErrBinlogPurgeEmFile: mysql.Message("Too many files opened, please execute the command again", nil), + ErrEventCannotCreateInThePast: mysql.Message("Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.", nil), + ErrEventCannotAlterInThePast: mysql.Message("Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.", nil), + ErrNoPartitionForGivenValueSilent: mysql.Message("Table has no partition for some existing values", nil), + ErrBinlogUnsafeStatement: mysql.Message("Unsafe statement written to the binary log using statement format since BINLOGFORMAT = STATEMENT. %s", nil), + ErrBinlogLoggingImpossible: mysql.Message("Binary logging not possible. Message: %s", nil), + ErrViewNoCreationCtx: mysql.Message("View `%-.64s`.`%-.64s` has no creation context", nil), + ErrViewInvalidCreationCtx: mysql.Message("Creation context of view `%-.64s`.`%-.64s' is invalid", nil), + ErrSrInvalidCreationCtx: mysql.Message("Creation context of stored routine `%-.64s`.`%-.64s` is invalid", nil), + ErrTrgCorruptedFile: mysql.Message("Corrupted TRG file for table `%-.64s`.`%-.64s`", nil), + ErrTrgNoCreationCtx: mysql.Message("Triggers for table `%-.64s`.`%-.64s` have no creation context", nil), + ErrTrgInvalidCreationCtx: mysql.Message("Trigger creation context of table `%-.64s`.`%-.64s` is invalid", nil), + ErrEventInvalidCreationCtx: mysql.Message("Creation context of event `%-.64s`.`%-.64s` is invalid", nil), + ErrTrgCantOpenTable: mysql.Message("Cannot open table for trigger `%-.64s`.`%-.64s`", nil), + ErrCantCreateSroutine: mysql.Message("Cannot create stored routine `%-.64s`. Check warnings", nil), + ErrNoFormatDescriptionEventBeforeBinlogStatement: mysql.Message("The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement.", nil), + ErrLoadDataInvalidColumn: mysql.Message("Invalid column reference (%-.64s) in LOAD DATA", nil), + ErrLogPurgeNoFile: mysql.Message("Being purged log %s was not found", nil), + ErrXaRbtimeout: mysql.Message("XARBTIMEOUT: Transaction branch was rolled back: took too long", nil), + ErrXaRbdeadlock: mysql.Message("XARBDEADLOCK: Transaction branch was rolled back: deadlock was detected", nil), + ErrNeedReprepare: mysql.Message("Prepared statement needs to be re-prepared", nil), + ErrDelayedNotSupported: mysql.Message("DELAYED option not supported for table '%-.192s'", nil), + WarnOptionIgnored: mysql.Message("<%-.64s> option ignored", nil), + WarnPluginDeleteBuiltin: mysql.Message("Built-in plugins cannot be deleted", nil), + WarnPluginBusy: mysql.Message("Plugin is busy and will be uninstalled on shutdown", nil), + ErrVariableIsReadonly: mysql.Message("%s variable '%s' is read-only. Use SET %s to assign the value", nil), + ErrWarnEngineTransactionRollback: mysql.Message("Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted", nil), + ErrNdbReplicationSchema: mysql.Message("Bad schema for mysql.ndbReplication table. Message: %-.64s", nil), + ErrConflictFnParse: mysql.Message("Error in parsing conflict function. Message: %-.64s", nil), + ErrExceptionsWrite: mysql.Message("Write to exceptions table failed. Message: %-.128s\"", nil), + ErrTooLongTableComment: mysql.Message("Comment for table '%-.64s' is too long (max = %d)", nil), + ErrTooLongFieldComment: mysql.Message("Comment for field '%-.64s' is too long (max = %d)", nil), + ErrFuncInexistentNameCollision: mysql.Message("FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual", nil), + ErrDatabaseName: mysql.Message("Database", nil), + ErrTableName: mysql.Message("Table", nil), + ErrPartitionName: mysql.Message("Partition", nil), + ErrSubpartitionName: mysql.Message("Subpartition", nil), + ErrTemporaryName: mysql.Message("Temporary", nil), + ErrRenamedName: mysql.Message("Renamed", nil), + ErrTooManyConcurrentTrxs: mysql.Message("Too many active concurrent transactions", nil), + WarnNonASCIISeparatorNotImplemented: mysql.Message("Non-ASCII separator arguments are not fully supported", nil), + ErrDebugSyncTimeout: mysql.Message("debug sync point wait timed out", nil), + ErrDebugSyncHitLimit: mysql.Message("debug sync point hit limit reached", nil), + ErrDupSignalSet: mysql.Message("Duplicate condition information item '%s'", nil), + ErrSignalWarn: mysql.Message("Unhandled user-defined warning condition", nil), + ErrSignalNotFound: mysql.Message("Unhandled user-defined not found condition", nil), + ErrSignalException: mysql.Message("Unhandled user-defined exception condition", nil), + ErrResignalWithoutActiveHandler: mysql.Message("RESIGNAL when handler not active", nil), + ErrSignalBadConditionType: mysql.Message("SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE", nil), + WarnCondItemTruncated: mysql.Message("Data truncated for condition item '%s'", nil), + ErrCondItemTooLong: mysql.Message("Data too long for condition item '%s'", nil), + ErrUnknownLocale: mysql.Message("Unknown locale: '%-.64s'", nil), + ErrQueryCacheDisabled: mysql.Message("Query cache is disabled; restart the server with queryCacheType=1 to enable it", nil), + ErrSameNamePartitionField: mysql.Message("Duplicate partition field name '%-.192s'", nil), + ErrPartitionColumnList: mysql.Message("Inconsistency in usage of column lists for partitioning", nil), + ErrWrongTypeColumnValue: mysql.Message("Partition column values of incorrect type", nil), + ErrTooManyPartitionFuncFields: mysql.Message("Too many fields in '%-.192s'", nil), + ErrMaxvalueInValuesIn: mysql.Message("Cannot use MAXVALUE as value in VALUES IN", nil), + ErrTooManyValues: mysql.Message("Cannot have more than one value for this type of %-.64s partitioning", nil), + ErrRowSinglePartitionField: mysql.Message("Row expressions in VALUES IN only allowed for multi-field column partitioning", nil), + ErrFieldTypeNotAllowedAsPartitionField: mysql.Message("Field '%-.192s' is of a not allowed type for this type of partitioning", nil), + ErrPartitionFieldsTooLong: mysql.Message("The total length of the partitioning fields is too large", nil), + ErrBinlogRowEngineAndStmtEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved.", nil), + ErrBinlogRowModeAndStmtEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = ROW and at least one table uses a storage engine limited to statement-based logging.", nil), + ErrBinlogUnsafeAndStmtEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOGFORMAT = MIXED. %s", nil), + ErrBinlogRowInjectionAndStmtEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging.", nil), + ErrBinlogStmtModeAndRowEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s", nil), + ErrBinlogRowInjectionAndStmtMode: mysql.Message("Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOGFORMAT = STATEMENT.", nil), + ErrBinlogMultipleEnginesAndSelfLoggingEngine: mysql.Message("Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.", nil), + ErrBinlogUnsafeLimit: mysql.Message("The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.", nil), + ErrBinlogUnsafeInsertDelayed: mysql.Message("The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.", nil), + ErrBinlogUnsafeAutoincColumns: mysql.Message("Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTOINCREMENT column. Inserted values cannot be logged correctly.", nil), + ErrBinlogUnsafeNontransAfterTrans: mysql.Message("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.", nil), + ErrMessageAndStatement: mysql.Message("%s Statement: %s", nil), + ErrInsideTransactionPreventsSwitchBinlogFormat: mysql.Message("Cannot modify @@session.binlogFormat inside a transaction", nil), + ErrPathLength: mysql.Message("The path specified for %.64s is too long.", nil), + ErrWarnDeprecatedSyntaxNoReplacement: mysql.Message("'%s' is deprecated and will be removed in a future release.", nil), + ErrWrongNativeTableStructure: mysql.Message("Native table '%-.64s'.'%-.64s' has the wrong structure", nil), + ErrWrongPerfSchemaUsage: mysql.Message("Invalid performanceSchema usage.", nil), + ErrWarnISSkippedTable: mysql.Message("Table '%s'.'%s' was skipped since its definition is being modified by concurrent DDL statement", nil), + ErrInsideTransactionPreventsSwitchBinlogDirect: mysql.Message("Cannot modify @@session.binlogDirectNonTransactionalUpdates inside a transaction", nil), + ErrStoredFunctionPreventsSwitchBinlogDirect: mysql.Message("Cannot change the binlog direct flag inside a stored function or trigger", nil), + ErrSpatialMustHaveGeomCol: mysql.Message("A SPATIAL index may only contain a geometrical type column", nil), + ErrTooLongIndexComment: mysql.Message("Comment for index '%-.64s' is too long (max = %d)", nil), + ErrLockAborted: mysql.Message("Wait on a lock was aborted due to a pending exclusive lock", nil), + ErrDataOutOfRange: mysql.Message("%s value is out of range in '%s'", []int{1}), + ErrWrongSpvarTypeInLimit: mysql.Message("A variable of a non-integer based type in LIMIT clause", nil), + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine: mysql.Message("Mixing self-logging and non-self-logging engines in a statement is unsafe.", nil), + ErrBinlogUnsafeMixedStatement: mysql.Message("Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.", nil), + ErrInsideTransactionPreventsSwitchSQLLogBin: mysql.Message("Cannot modify @@session.sqlLogBin inside a transaction", nil), + ErrStoredFunctionPreventsSwitchSQLLogBin: mysql.Message("Cannot change the sqlLogBin inside a stored function or trigger", nil), + ErrFailedReadFromParFile: mysql.Message("Failed to read from the .par file", nil), + ErrValuesIsNotIntType: mysql.Message("VALUES value for partition '%-.64s' must have type INT", nil), + ErrAccessDeniedNoPassword: mysql.Message("Access denied for user '%-.48s'@'%-.255s'", nil), + ErrSetPasswordAuthPlugin: mysql.Message("SET PASSWORD has no significance for users authenticating via plugins", nil), + ErrGrantPluginUserExists: mysql.Message("GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists", nil), + ErrTruncateIllegalFk: mysql.Message("Cannot truncate a table referenced in a foreign key constraint (%.192s)", nil), + ErrPluginIsPermanent: mysql.Message("Plugin '%s' is forcePlusPermanent and can not be unloaded", nil), + ErrStmtCacheFull: mysql.Message("Multi-row statements required more than 'maxBinlogStmtCacheSize' bytes of storage; increase this mysqld variable and try again", nil), + ErrMultiUpdateKeyConflict: mysql.Message("Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'.", nil), + ErrTableNeedsRebuild: mysql.Message("Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!", nil), + WarnOptionBelowLimit: mysql.Message("The value of '%s' should be no less than the value of '%s'", nil), + ErrIndexColumnTooLong: mysql.Message("Index column size too large. The maximum column size is %d bytes.", nil), + ErrErrorInTriggerBody: mysql.Message("Trigger '%-.64s' has an error in its body: '%-.256s'", nil), + ErrErrorInUnknownTriggerBody: mysql.Message("Unknown trigger has an error in its body: '%-.256s'", nil), + ErrIndexCorrupt: mysql.Message("Index %s is corrupted", nil), + ErrUndoRecordTooBig: mysql.Message("Undo log record is too big.", nil), + ErrPluginNoUninstall: mysql.Message("Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it.", nil), + ErrPluginNoInstall: mysql.Message("Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it.", nil), + ErrBinlogUnsafeInsertTwoKeys: mysql.Message("INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe", nil), + ErrTableInFkCheck: mysql.Message("Table is being used in foreign key check.", nil), + ErrUnsupportedEngine: mysql.Message("Storage engine '%s' does not support system tables. [%s.%s]", nil), + ErrBinlogUnsafeAutoincNotFirst: mysql.Message("INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.", nil), + ErrCannotLoadFromTableV2: mysql.Message("Cannot load from %s.%s. The table is probably corrupted", nil), + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement: mysql.Message("Only FormatDescriptionLogEvent and row events are allowed in BINLOG statements (but %s was provided)", nil), + ErrPartitionExchangeDifferentOption: mysql.Message("Non matching attribute '%-.64s' between partition and table", nil), + ErrPartitionExchangePartTable: mysql.Message("Table to exchange with partition is partitioned: '%-.64s'", nil), + ErrPartitionExchangeTempTable: mysql.Message("Table to exchange with partition is temporary: '%-.64s'", nil), + ErrPartitionInsteadOfSubpartition: mysql.Message("Subpartitioned table, use subpartition instead of partition", nil), + ErrUnknownPartition: mysql.Message("Unknown partition '%-.64s' in table '%-.64s'", nil), + ErrTablesDifferentMetadata: mysql.Message("Tables have different definitions", nil), + ErrRowDoesNotMatchPartition: mysql.Message("Found a row that does not match the partition", nil), + ErrBinlogCacheSizeGreaterThanMax: mysql.Message("Option binlogCacheSize (%d) is greater than maxBinlogCacheSize (%d); setting binlogCacheSize equal to maxBinlogCacheSize.", nil), + ErrWarnIndexNotApplicable: mysql.Message("Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'", nil), + ErrPartitionExchangeForeignKey: mysql.Message("Table to exchange with partition has foreign key references: '%-.64s'", nil), + ErrNoSuchKeyValue: mysql.Message("Key value '%-.192s' was not found in table '%-.192s.%-.192s'", nil), + ErrRplInfoDataTooLong: mysql.Message("Data for column '%s' too long", nil), + ErrNetworkReadEventChecksumFailure: mysql.Message("Replication event checksum verification failed while reading from network.", nil), + ErrBinlogReadEventChecksumFailure: mysql.Message("Replication event checksum verification failed while reading from a log file.", nil), + ErrBinlogStmtCacheSizeGreaterThanMax: mysql.Message("Option binlogStmtCacheSize (%d) is greater than maxBinlogStmtCacheSize (%d); setting binlogStmtCacheSize equal to maxBinlogStmtCacheSize.", nil), + ErrCantUpdateTableInCreateTableSelect: mysql.Message("Can't update table '%-.192s' while '%-.192s' is being created.", nil), + ErrPartitionClauseOnNonpartitioned: mysql.Message("PARTITION () clause on non partitioned table", nil), + ErrRowDoesNotMatchGivenPartitionSet: mysql.Message("Found a row not matching the given partition set", nil), + ErrNoSuchPartitionunused: mysql.Message("partition '%-.64s' doesn't exist", nil), + ErrChangeRplInfoRepositoryFailure: mysql.Message("Failure while changing the type of replication repository: %s.", nil), + ErrWarningNotCompleteRollbackWithCreatedTempTable: mysql.Message("The creation of some temporary tables could not be rolled back.", nil), + ErrWarningNotCompleteRollbackWithDroppedTempTable: mysql.Message("Some temporary tables were dropped, but these operations could not be rolled back.", nil), + ErrMtsUpdatedDBsGreaterMax: mysql.Message("The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata.", nil), + ErrMtsCantParallel: mysql.Message("Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s.", nil), + ErrMtsInconsistentData: mysql.Message("%s", nil), + ErrFulltextNotSupportedWithPartitioning: mysql.Message("FULLTEXT index is not supported for partitioned tables.", nil), + ErrDaInvalidConditionNumber: mysql.Message("Invalid condition number", nil), + ErrInsecurePlainText: mysql.Message("Sending passwords in plain text without SSL/TLS is extremely insecure.", nil), + ErrForeignDuplicateKeyWithChildInfo: mysql.Message("Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in table '%.192s', key '%.192s'", nil), + ErrForeignDuplicateKeyWithoutChildInfo: mysql.Message("Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in a child table", nil), + ErrTableHasNoFt: mysql.Message("The table does not have FULLTEXT index to support this query", nil), + ErrVariableNotSettableInSfOrTrigger: mysql.Message("The system variable %.200s cannot be set in stored functions or triggers.", nil), + ErrVariableNotSettableInTransaction: mysql.Message("The system variable %.200s cannot be set when there is an ongoing transaction.", nil), + ErrGtidNextIsNotInGtidNextList: mysql.Message("The system variable @@SESSION.GTIDNEXT has the value %.200s, which is not listed in @@SESSION.GTIDNEXTLIST.", nil), + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull: mysql.Message("When @@SESSION.GTIDNEXTLIST == NULL, the system variable @@SESSION.GTIDNEXT cannot change inside a transaction.", nil), + ErrSetStatementCannotInvokeFunction: mysql.Message("The statement 'SET %.200s' cannot invoke a stored function.", nil), + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull: mysql.Message("The system variable @@SESSION.GTIDNEXT cannot be 'AUTOMATIC' when @@SESSION.GTIDNEXTLIST is non-NULL.", nil), + ErrSkippingLoggedTransaction: mysql.Message("Skipping transaction %.200s because it has already been executed and logged.", nil), + ErrMalformedGtidSetSpecification: mysql.Message("Malformed GTID set specification '%.200s'.", nil), + ErrMalformedGtidSetEncoding: mysql.Message("Malformed GTID set encoding.", nil), + ErrMalformedGtidSpecification: mysql.Message("Malformed GTID specification '%.200s'.", nil), + ErrGnoExhausted: mysql.Message("Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new serverUuid.", nil), + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet: mysql.Message("Cannot execute statements with implicit commit inside a transaction when @@SESSION.GTIDNEXT != AUTOMATIC or @@SESSION.GTIDNEXTLIST != NULL.", nil), + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn: mysql.Message("@@GLOBAL.GTIDMODE = ON or UPGRADESTEP2 requires @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", nil), + ErrCantSetGtidNextToGtidWhenGtidModeIsOff: mysql.Message("@@SESSION.GTIDNEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn: mysql.Message("@@SESSION.GTIDNEXT cannot be set to ANONYMOUS when @@GLOBAL.GTIDMODE = ON.", nil), + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff: mysql.Message("@@SESSION.GTIDNEXTLIST cannot be set to a non-NULL value when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrFoundGtidEventWhenGtidModeIsOff: mysql.Message("Found a GtidLogEvent or PreviousGtidsLogEvent when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrGtidUnsafeNonTransactionalTable: mysql.Message("When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.", nil), + ErrGtidUnsafeCreateSelect: mysql.Message("CREATE TABLE ... SELECT is forbidden when @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", nil), + ErrGtidUnsafeCreateDropTemporaryTableInTransaction: mysql.Message("When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.", nil), + ErrGtidModeCanOnlyChangeOneStepAtATime: mysql.Message("The value of @@GLOBAL.GTIDMODE can only change one step at a time: OFF <-> UPGRADESTEP1 <-> UPGRADESTEP2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions.", nil), + ErrCantSetGtidNextWhenOwningGtid: mysql.Message("@@SESSION.GTIDNEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK.", nil), + ErrUnknownExplainFormat: mysql.Message("Unknown EXPLAIN format name: '%s'", nil), + ErrCantExecuteInReadOnlyTransaction: mysql.Message("Cannot execute statement in a READ ONLY transaction.", nil), + ErrTooLongTablePartitionComment: mysql.Message("Comment for table partition '%-.64s' is too long (max = %d)", nil), + ErrInnodbFtLimit: mysql.Message("InnoDB presently supports one FULLTEXT index creation at a time", nil), + ErrInnodbNoFtTempTable: mysql.Message("Cannot create FULLTEXT index on temporary InnoDB table", nil), + ErrInnodbFtWrongDocidColumn: mysql.Message("Column '%-.192s' is of wrong type for an InnoDB FULLTEXT index", nil), + ErrInnodbFtWrongDocidIndex: mysql.Message("Index '%-.192s' is of wrong type for an InnoDB FULLTEXT index", nil), + ErrInnodbOnlineLogTooBig: mysql.Message("Creating index '%-.192s' required more than 'innodbOnlineAlterLogMaxSize' bytes of modification log. Please try again.", nil), + ErrUnknownAlterAlgorithm: mysql.Message("Unknown ALGORITHM '%s'", nil), + ErrUnknownAlterLock: mysql.Message("Unknown LOCK type '%s'", nil), + ErrMtsResetWorkers: mysql.Message("Cannot clean up worker info tables. Additional error messages can be found in the MySQL error log.", nil), + ErrColCountDoesntMatchCorruptedV2: mysql.Message("Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted", nil), + ErrDiscardFkChecksRunning: mysql.Message("There is a foreign key check running on table '%-.192s'. Cannot discard the table.", nil), + ErrTableSchemaMismatch: mysql.Message("Schema mismatch (%s)", nil), + ErrTableInSystemTablespace: mysql.Message("Table '%-.192s' in system tablespace", nil), + ErrIoRead: mysql.Message("IO Read : (%d, %s) %s", nil), + ErrIoWrite: mysql.Message("IO Write : (%d, %s) %s", nil), + ErrTablespaceMissing: mysql.Message("Tablespace is missing for table '%-.192s'", nil), + ErrTablespaceExists: mysql.Message("Tablespace for table '%-.192s' exists. Please DISCARD the tablespace before IMPORT.", nil), + ErrTablespaceDiscarded: mysql.Message("Tablespace has been discarded for table '%-.192s'", nil), + ErrInternal: mysql.Message("Internal : %s", nil), + ErrInnodbImport: mysql.Message("ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %d : '%s'", nil), + ErrInnodbIndexCorrupt: mysql.Message("Index corrupt: %s", nil), + ErrInvalidYearColumnLength: mysql.Message("Supports only YEAR or YEAR(4) column", nil), + ErrNotValidPassword: mysql.Message("Your password does not satisfy the current policy requirements", nil), + ErrMustChangePassword: mysql.Message("You must SET PASSWORD before executing this statement", nil), + ErrFkNoIndexChild: mysql.Message("Failed to add the foreign key constaint. Missing index for constraint '%s' in the foreign table '%s'", nil), + ErrFkNoIndexParent: mysql.Message("Failed to add the foreign key constaint. Missing index for constraint '%s' in the referenced table '%s'", nil), + ErrFkFailAddSystem: mysql.Message("Failed to add the foreign key constraint '%s' to system tables", nil), + ErrFkCannotOpenParent: mysql.Message("Failed to open the referenced table '%s'", nil), + ErrFkIncorrectOption: mysql.Message("Failed to add the foreign key constraint on table '%s'. Incorrect options in FOREIGN KEY constraint '%s'", nil), + ErrFkDupName: mysql.Message("Duplicate foreign key constraint name '%s'", nil), + ErrPasswordFormat: mysql.Message("The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.", nil), + ErrFkColumnCannotDrop: mysql.Message("Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s'", nil), + ErrFkColumnCannotDropChild: mysql.Message("Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrFkColumnNotNull: mysql.Message("Column '%-.192s' cannot be NOT NULL: needed in a foreign key constraint '%-.192s' SET NULL", nil), + ErrDupIndex: mysql.Message("Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release.", nil), + ErrFkColumnCannotChange: mysql.Message("Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'", nil), + ErrFkColumnCannotChangeChild: mysql.Message("Cannot change column '%-.192s': used in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrFkCannotDeleteParent: mysql.Message("Cannot delete rows from table which is parent in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrMalformedPacket: mysql.Message("Malformed communication packet.", nil), + ErrReadOnlyMode: mysql.Message("Running in read-only mode", nil), + ErrVariableNotSettableInSp: mysql.Message("The system variable %.200s cannot be set in stored procedures.", nil), + ErrCantSetGtidPurgedWhenGtidModeIsOff: mysql.Message("@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDMODE = ON.", nil), + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty: mysql.Message("@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDEXECUTED is empty.", nil), + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty: mysql.Message("@@GLOBAL.GTIDPURGED can only be set when there are no ongoing transactions (not even in other clients).", nil), + ErrGtidPurgedWasChanged: mysql.Message("@@GLOBAL.GTIDPURGED was changed from '%s' to '%s'.", nil), + ErrGtidExecutedWasChanged: mysql.Message("@@GLOBAL.GTIDEXECUTED was changed from '%s' to '%s'.", nil), + ErrBinlogStmtModeAndNoReplTables: mysql.Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT, and both replicated and non replicated tables are written to.", nil), + ErrAlterOperationNotSupported: mysql.Message("%s is not supported for this operation. Try %s.", nil), + ErrAlterOperationNotSupportedReason: mysql.Message("%s is not supported. Reason: %s. Try %s.", nil), + ErrAlterOperationNotSupportedReasonCopy: mysql.Message("COPY algorithm requires a lock", nil), + ErrAlterOperationNotSupportedReasonPartition: mysql.Message("Partition specific operations do not yet support LOCK/ALGORITHM", nil), + ErrAlterOperationNotSupportedReasonFkRename: mysql.Message("Columns participating in a foreign key are renamed", nil), + ErrAlterOperationNotSupportedReasonColumnType: mysql.Message("Cannot change column type INPLACE", nil), + ErrAlterOperationNotSupportedReasonFkCheck: mysql.Message("Adding foreign keys needs foreignKeyChecks=OFF", nil), + ErrAlterOperationNotSupportedReasonIgnore: mysql.Message("Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows", nil), + ErrAlterOperationNotSupportedReasonNopk: mysql.Message("Dropping a primary key is not allowed without also adding a new primary key", nil), + ErrAlterOperationNotSupportedReasonAutoinc: mysql.Message("Adding an auto-increment column requires a lock", nil), + ErrAlterOperationNotSupportedReasonHiddenFts: mysql.Message("Cannot replace hidden FTSDOCID with a user-visible one", nil), + ErrAlterOperationNotSupportedReasonChangeFts: mysql.Message("Cannot drop or rename FTSDOCID", nil), + ErrAlterOperationNotSupportedReasonFts: mysql.Message("Fulltext index creation requires a lock", nil), + ErrDupUnknownInIndex: mysql.Message("Duplicate entry for key '%-.192s'", nil), + ErrIdentCausesTooLongPath: mysql.Message("Long database name and identifier for object resulted in path length exceeding %d characters. Path: '%s'.", nil), + ErrAlterOperationNotSupportedReasonNotNull: mysql.Message("cannot silently convert NULL values, as required in this SQLMODE", nil), + ErrMustChangePasswordLogin: mysql.Message("Your password has expired. To log in you must change it using a client that supports expired passwords.", nil), + ErrRowInWrongPartition: mysql.Message("Found a row in wrong partition %s", []int{0}), + ErrGeneratedColumnFunctionIsNotAllowed: mysql.Message("Expression of generated column '%s' contains a disallowed function.", nil), + ErrGeneratedColumnRowValueIsNotAllowed: mysql.Message("Expression of generated column '%s' cannot refer to a row value", nil), + ErrUnsupportedAlterInplaceOnVirtualColumn: mysql.Message("INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions.", nil), + ErrWrongFKOptionForGeneratedColumn: mysql.Message("Cannot define foreign key with %s clause on a generated column.", nil), + ErrBadGeneratedColumn: mysql.Message("The value specified for generated column '%s' in table '%s' is not allowed.", nil), + ErrUnsupportedOnGeneratedColumn: mysql.Message("'%s' is not supported for generated columns.", nil), + ErrGeneratedColumnNonPrior: mysql.Message("Generated column can refer only to generated columns defined prior to it.", nil), + ErrDependentByGeneratedColumn: mysql.Message("Column '%s' has a generated column dependency.", nil), + ErrGeneratedColumnRefAutoInc: mysql.Message("Generated column '%s' cannot refer to auto-increment column.", nil), + ErrWarnConflictingHint: mysql.Message("Hint %s is ignored as conflicting/duplicated.", nil), + ErrUnresolvedHintName: mysql.Message("Unresolved name '%s' for %s hint", nil), + ErrInvalidFieldSize: mysql.Message("Invalid size for column '%s'.", nil), + ErrInvalidArgumentForLogarithm: mysql.Message("Invalid argument for logarithm", nil), + ErrAggregateOrderNonAggQuery: mysql.Message("Expression #%d of ORDER BY contains aggregate function and applies to the result of a non-aggregated query", nil), + ErrIncorrectType: mysql.Message("Incorrect type for argument %s in function %s.", nil), + ErrFieldInOrderNotSelect: mysql.Message("Expression #%d of ORDER BY clause is not in SELECT list, references column '%s' which is not in SELECT list; this is incompatible with %s", nil), + ErrAggregateInOrderNotSelect: mysql.Message("Expression #%d of ORDER BY clause is not in SELECT list, contains aggregate function; this is incompatible with %s", nil), + ErrInvalidJSONData: mysql.Message("Invalid JSON data provided to function %s: %s", nil), + ErrInvalidJSONText: mysql.Message("Invalid JSON text: %-.192s", []int{0}), + ErrInvalidJSONPath: mysql.Message("Invalid JSON path expression %s.", nil), + ErrInvalidTypeForJSON: mysql.Message("Invalid data type for JSON data in argument %d to function %s; a JSON string or JSON type is required.", nil), + ErrInvalidJSONPathWildcard: mysql.Message("In this situation, path expressions may not contain the * and ** tokens.", nil), + ErrInvalidJSONContainsPathType: mysql.Message("The second argument can only be either 'one' or 'all'.", nil), + ErrJSONUsedAsKey: mysql.Message("JSON column '%-.192s' cannot be used in key specification.", nil), + ErrJSONDocumentNULLKey: mysql.Message("JSON documents may not contain NULL member names.", nil), + ErrSecureTransportRequired: mysql.Message("Connections using insecure transport are prohibited while --require_secure_transport=ON.", nil), + ErrBadUser: mysql.Message("User %s does not exist.", nil), + ErrUserAlreadyExists: mysql.Message("User %s already exists.", nil), + ErrInvalidJSONPathArrayCell: mysql.Message("A path expression is not a path to a cell in an array.", nil), + ErrInvalidEncryptionOption: mysql.Message("Invalid encryption option.", nil), + ErrTooLongValueForType: mysql.Message("Too long enumeration/set value for column %s.", nil), + ErrPKIndexCantBeInvisible: mysql.Message("A primary key index cannot be invisible", nil), + ErrWindowNoSuchWindow: mysql.Message("Window name '%s' is not defined.", nil), + ErrWindowCircularityInWindowGraph: mysql.Message("There is a circularity in the window dependency graph.", nil), + ErrWindowNoChildPartitioning: mysql.Message("A window which depends on another cannot define partitioning.", nil), + ErrWindowNoInherentFrame: mysql.Message("Window '%s' has a frame definition, so cannot be referenced by another window.", nil), + ErrWindowNoRedefineOrderBy: mysql.Message("Window '%s' cannot inherit '%s' since both contain an ORDER BY clause.", nil), + ErrWindowFrameStartIllegal: mysql.Message("Window '%s': frame start cannot be UNBOUNDED FOLLOWING.", nil), + ErrWindowFrameEndIllegal: mysql.Message("Window '%s': frame end cannot be UNBOUNDED PRECEDING.", nil), + ErrWindowFrameIllegal: mysql.Message("Window '%s': frame start or end is negative, NULL or of non-integral type", nil), + ErrWindowRangeFrameOrderType: mysql.Message("Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type", nil), + ErrWindowRangeFrameTemporalType: mysql.Message("Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed.", nil), + ErrWindowRangeFrameNumericType: mysql.Message("Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed.", nil), + ErrWindowRangeBoundNotConstant: mysql.Message("Window '%s' has a non-constant frame bound.", nil), + ErrWindowDuplicateName: mysql.Message("Window '%s' is defined twice.", nil), + ErrWindowIllegalOrderBy: mysql.Message("Window '%s': ORDER BY or PARTITION BY uses legacy position indication which is not supported, use expression.", nil), + ErrWindowInvalidWindowFuncUse: mysql.Message("You cannot use the window function '%s' in this context.'", nil), + ErrWindowInvalidWindowFuncAliasUse: mysql.Message("You cannot use the alias '%s' of an expression containing a window function in this context.'", nil), + ErrWindowNestedWindowFuncUseInWindowSpec: mysql.Message("You cannot nest a window function in the specification of window '%s'.", nil), + ErrWindowRowsIntervalUse: mysql.Message("Window '%s': INTERVAL can only be used with RANGE frames.", nil), + ErrWindowNoGroupOrderUnused: mysql.Message("ASC or DESC with GROUP BY isn't allowed with window functions; put ASC or DESC in ORDER BY", nil), + ErrWindowExplainJSON: mysql.Message("To get information about window functions use EXPLAIN FORMAT=JSON", nil), + ErrWindowFunctionIgnoresFrame: mysql.Message("Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition", nil), + ErrRoleNotGranted: mysql.Message("%s is is not granted to %s", nil), + ErrMaxExecTimeExceeded: mysql.Message("Query execution was interrupted, max_execution_time exceeded.", nil), + ErrLockAcquireFailAndNoWaitSet: mysql.Message("Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.", nil), + ErrNotHintUpdatable: mysql.Message("Variable '%s' cannot be set using SET_VAR hint.", nil), + ErrDataTruncatedFunctionalIndex: mysql.Message("Data truncated for expression index '%s' at row %d", nil), + ErrDataOutOfRangeFunctionalIndex: mysql.Message("Value is out of range for expression index '%s' at row %d", nil), + ErrFunctionalIndexOnJSONOrGeometryFunction: mysql.Message("Cannot create an expression index on a function that returns a JSON or GEOMETRY value", nil), + ErrFunctionalIndexRefAutoIncrement: mysql.Message("Expression index '%s' cannot refer to an auto-increment column", nil), + ErrCannotDropColumnFunctionalIndex: mysql.Message("Cannot drop column '%s' because it is used by an expression index. In order to drop the column, you must remove the expression index", nil), + ErrFunctionalIndexPrimaryKey: mysql.Message("The primary key cannot be an expression index", nil), + ErrFunctionalIndexOnBlob: mysql.Message("Cannot create an expression index on an expression that returns a BLOB or TEXT. Please consider using CAST", nil), + ErrFunctionalIndexFunctionIsNotAllowed: mysql.Message("Expression of expression index '%s' contains a disallowed function", nil), + ErrFulltextFunctionalIndex: mysql.Message("Fulltext expression index is not supported", nil), + ErrSpatialFunctionalIndex: mysql.Message("Spatial expression index is not supported", nil), + ErrWrongKeyColumnFunctionalIndex: mysql.Message("The used storage engine cannot index the expression '%s'", nil), + ErrFunctionalIndexOnField: mysql.Message("Expression index on a column is not supported. Consider using a regular index instead", nil), + ErrFKIncompatibleColumns: mysql.Message("Referencing column '%s' in foreign key constraint '%s' are incompatible", nil), + ErrFunctionalIndexRowValueIsNotAllowed: mysql.Message("Expression of expression index '%s' cannot refer to a row value", nil), + ErrDependentByFunctionalIndex: mysql.Message("Column '%s' has an expression index dependency and cannot be dropped or renamed", nil), + ErrInvalidJSONValueForFuncIndex: mysql.Message("Invalid JSON value for CAST for expression index '%s'", nil), + ErrJSONValueOutOfRangeForFuncIndex: mysql.Message("Out of range JSON value for CAST for expression index '%s'", nil), + ErrFunctionalIndexDataIsTooLong: mysql.Message("Data too long for expression index '%s'", nil), + ErrFunctionalIndexNotApplicable: mysql.Message("Cannot use expression index '%s' due to type or collation conversion", nil), + ErrUnsupportedConstraintCheck: mysql.Message("%s is not supported", nil), + ErrDynamicPrivilegeNotRegistered: mysql.Message("Dynamic privilege '%s' is not registered with the server.", nil), + ErrIllegalPrivilegeLevel: mysql.Message("Illegal privilege level specified for %s", nil), + ErrCTERecursiveRequiresUnion: mysql.Message("Recursive Common Table Expression '%s' should contain a UNION", nil), + ErrCTERecursiveRequiresNonRecursiveFirst: mysql.Message("Recursive Common Table Expression '%s' should have one or more non-recursive query blocks followed by one or more recursive ones", nil), + ErrCTERecursiveForbidsAggregation: mysql.Message("Recursive Common Table Expression '%s' can contain neither aggregation nor window functions in recursive query block", nil), + ErrCTERecursiveForbiddenJoinOrder: mysql.Message("In recursive query block of Recursive Common Table Expression '%s', the recursive table must neither be in the right argument of a LEFT JOIN, nor be forced to be non-first with join order hints", nil), + ErrInvalidRequiresSingleReference: mysql.Message("In recursive query block of Recursive Common Table Expression '%s', the recursive table must be referenced only once, and not in any subquery", nil), + ErrCTEMaxRecursionDepth: mysql.Message("Recursive query aborted after %d iterations. Try increasing @@cte_max_recursion_depth to a larger value", nil), + // MariaDB errors. + ErrOnlyOneDefaultPartionAllowed: mysql.Message("Only one DEFAULT partition allowed", nil), + ErrWrongPartitionTypeExpectedSystemTime: mysql.Message("Wrong partitioning type, expected type: `SYSTEM_TIME`", nil), + ErrSystemVersioningWrongPartitions: mysql.Message("Wrong Partitions: must have at least one HISTORY and exactly one last CURRENT", nil), + ErrSequenceRunOut: mysql.Message("Sequence '%-.64s.%-.64s' has run out", nil), + ErrSequenceInvalidData: mysql.Message("Sequence '%-.64s.%-.64s' values are conflicting", nil), + ErrSequenceAccessFail: mysql.Message("Sequence '%-.64s.%-.64s' access error", nil), + ErrNotSequence: mysql.Message("'%-.64s.%-.64s' is not a SEQUENCE", nil), + ErrUnknownSequence: mysql.Message("Unknown SEQUENCE: '%-.300s'", nil), + ErrWrongInsertIntoSequence: mysql.Message("Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a sequence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead.", nil), + ErrSequenceInvalidTableStructure: mysql.Message("Sequence '%-.64s.%-.64s' table structure is invalid (%s)", nil), + + // TiDB errors. + ErrMemExceedThreshold: mysql.Message("%s holds %dB memory, exceeds threshold %dB.%s", nil), + ErrForUpdateCantRetry: mysql.Message("[%d] can not retry select for update statement", nil), + ErrAdminCheckTable: mysql.Message("TiDB admin check table failed.", nil), + ErrOptOnTemporaryTable: mysql.Message("`%s` is unsupported on temporary tables.", nil), + ErrDropTableOnTemporaryTable: mysql.Message("`drop global temporary table` can only drop global temporary table", nil), + ErrTxnTooLarge: mysql.Message("Transaction is too large, size: %d", nil), + ErrWriteConflictInTiDB: mysql.Message("Write conflict, txnStartTS %d is stale", nil), + ErrInvalidPluginID: mysql.Message("Wrong plugin id: %s, valid plugin id is [name]-[version], both name and version should not contain '-'", nil), + ErrInvalidPluginManifest: mysql.Message("Cannot read plugin %s's manifest", nil), + ErrInvalidPluginName: mysql.Message("Plugin load with %s but got wrong name %s", nil), + ErrInvalidPluginVersion: mysql.Message("Plugin load with %s but got %s", nil), + ErrDuplicatePlugin: mysql.Message("Plugin [%s] is redeclared", nil), + ErrInvalidPluginSysVarName: mysql.Message("Plugin %s's sysVar %s must start with its plugin name %s", nil), + ErrRequireVersionCheckFail: mysql.Message("Plugin %s require %s be %v but got %v", nil), + ErrUnsupportedReloadPlugin: mysql.Message("Plugin %s isn't loaded so cannot be reloaded", nil), + ErrUnsupportedReloadPluginVar: mysql.Message("Reload plugin with different sysVar is unsupported %v", nil), + ErrTableLocked: mysql.Message("Table '%s' was locked in %s by %v", nil), + ErrNotExist: mysql.Message("Error: key not exist", nil), + ErrTxnRetryable: mysql.Message("Error: KV error safe to retry %s ", []int{0}), + ErrCannotSetNilValue: mysql.Message("can not set nil value", nil), + ErrInvalidTxn: mysql.Message("invalid transaction", nil), + ErrEntryTooLarge: mysql.Message("entry too large, the max entry size is %d, the size of data is %d", nil), + ErrNotImplemented: mysql.Message("not implemented", nil), + ErrInfoSchemaExpired: mysql.Message("Information schema is out of date: schema failed to update in 1 lease, please make sure TiDB can connect to TiKV", nil), + ErrInfoSchemaChanged: mysql.Message("Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`", nil), + ErrBadNumber: mysql.Message("Bad Number", nil), + ErrCastAsSignedOverflow: mysql.Message("Cast to signed converted positive out-of-range integer to it's negative complement", nil), + ErrCastNegIntAsUnsigned: mysql.Message("Cast to unsigned converted negative integer to it's positive complement", nil), + ErrInvalidYearFormat: mysql.Message("invalid year format", nil), + ErrInvalidYear: mysql.Message("invalid year", nil), + ErrIncorrectDatetimeValue: mysql.Message("Incorrect datetime value: '%s'", []int{0}), + ErrInvalidTimeFormat: mysql.Message("invalid time format: '%v'", []int{0}), + ErrInvalidWeekModeFormat: mysql.Message("invalid week mode format: '%v'", nil), + ErrFieldGetDefaultFailed: mysql.Message("Field '%s' get default value fail", nil), + ErrIndexOutBound: mysql.Message("Index column %s offset out of bound, offset: %d, row: %v", []int{2}), + ErrUnsupportedOp: mysql.Message("operation not supported", nil), + ErrRowNotFound: mysql.Message("can not find the row: %s", []int{0}), + ErrTableStateCantNone: mysql.Message("table %s can't be in none state", nil), + ErrColumnStateCantNone: mysql.Message("column %s can't be in none state", nil), + ErrColumnStateNonPublic: mysql.Message("can not use non-public column", nil), + ErrIndexStateCantNone: mysql.Message("index %s can't be in none state", nil), + ErrInvalidRecordKey: mysql.Message("invalid record key", nil), + ErrUnsupportedValueForVar: mysql.Message("variable '%s' does not yet support value: %s", nil), + ErrUnsupportedIsolationLevel: mysql.Message("The isolation level '%s' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error", nil), + ErrInvalidDDLWorker: mysql.Message("Invalid DDL worker", nil), + ErrUnsupportedDDLOperation: mysql.Message("Unsupported %s", nil), + ErrNotOwner: mysql.Message("TiDB server is not a DDL owner", nil), + ErrCantDecodeRecord: mysql.Message("Cannot decode %s value, because %v", nil), + ErrInvalidDDLJob: mysql.Message("Invalid DDL job", nil), + ErrInvalidDDLJobFlag: mysql.Message("Invalid DDL job flag", nil), + ErrWaitReorgTimeout: mysql.Message("Timeout waiting for data reorganization", nil), + ErrInvalidStoreVersion: mysql.Message("Invalid storage current version: %d", nil), + ErrUnknownTypeLength: mysql.Message("Unknown length for type %d", nil), + ErrUnknownFractionLength: mysql.Message("Unknown length for type %d and fraction %d", nil), + ErrInvalidDDLJobVersion: mysql.Message("Version %d of DDL job is greater than current one: %d", nil), + ErrInvalidSplitRegionRanges: mysql.Message("Failed to split region ranges: %s", nil), + ErrReorgPanic: mysql.Message("Reorg worker panic", nil), + ErrInvalidDDLState: mysql.Message("Invalid %s state: %v", nil), + ErrCancelledDDLJob: mysql.Message("Cancelled DDL job", nil), + ErrRepairTable: mysql.Message("Failed to repair table: %s", nil), + ErrLoadPrivilege: mysql.Message("Load privilege table fail: %s", nil), + ErrInvalidPrivilegeType: mysql.Message("unknown privilege type %s", nil), + ErrUnknownFieldType: mysql.Message("unknown field type", nil), + ErrInvalidSequence: mysql.Message("invalid sequence", nil), + ErrInvalidType: mysql.Message("invalid type", nil), + ErrCantGetValidID: mysql.Message("Cannot get a valid auto-ID when retrying the statement", nil), + ErrCantSetToNull: mysql.Message("cannot set variable to null", nil), + ErrSnapshotTooOld: mysql.Message("snapshot is older than GC safe point %s", nil), + ErrInvalidTableID: mysql.Message("invalid TableID", nil), + ErrInvalidAutoRandom: mysql.Message("Invalid auto random: %s", nil), + ErrInvalidHashKeyFlag: mysql.Message("invalid encoded hash key flag", nil), + ErrInvalidListIndex: mysql.Message("invalid list index", nil), + ErrInvalidListMetaData: mysql.Message("invalid list meta data", nil), + ErrWriteOnSnapshot: mysql.Message("write on snapshot", nil), + ErrInvalidKey: mysql.Message("invalid key", nil), + ErrInvalidIndexKey: mysql.Message("invalid index key", nil), + ErrDataInConsistent: mysql.Message("index:%#v != record:%#v", []int{0, 1}), + ErrDDLReorgElementNotExist: mysql.Message("DDL reorg element does not exist", nil), + ErrDDLJobNotFound: mysql.Message("DDL Job:%v not found", nil), + ErrCancelFinishedDDLJob: mysql.Message("This job:%v is finished, so can't be cancelled", nil), + ErrCannotCancelDDLJob: mysql.Message("This job:%v is almost finished, can't be cancelled now", nil), + ErrUnknownAllocatorType: mysql.Message("Invalid allocator type", nil), + ErrAutoRandReadFailed: mysql.Message("Failed to read auto-random value from storage engine", nil), + ErrInvalidIncrementAndOffset: mysql.Message("Invalid auto_increment settings: auto_increment_increment: %d, auto_increment_offset: %d, both of them must be in range [1..65535]", nil), + ErrDataInConsistentExtraIndex: mysql.Message("handle %#v, index:%#v != record:%#v", []int{0, 1, 2}), + ErrDataInConsistentMisMatchIndex: mysql.Message("col %s, handle %#v, index:%#v != record:%#v, compare err:%#v", []int{1, 2, 3, 4}), + + ErrWarnOptimizerHintInvalidInteger: mysql.Message("integer value is out of range in '%s'", nil), + ErrWarnOptimizerHintUnsupportedHint: mysql.Message("Optimizer hint %s is not supported by TiDB and is ignored", nil), + ErrWarnOptimizerHintInvalidToken: mysql.Message("Cannot use %s '%s' (tok = %d) in an optimizer hint", nil), + ErrWarnMemoryQuotaOverflow: mysql.Message("Max value of MEMORY_QUOTA is %d bytes, ignore this invalid limit", nil), + ErrWarnOptimizerHintParseError: mysql.Message("Optimizer hint syntax error at %v", nil), + + ErrSequenceUnsupportedTableOption: mysql.Message("Unsupported sequence table-option %s", nil), + ErrColumnTypeUnsupportedNextValue: mysql.Message("Unsupported sequence default value for column type '%s'", nil), + ErrAddColumnWithSequenceAsDefault: mysql.Message("Unsupported using sequence as default value in add column '%s'", nil), + ErrUnsupportedType: mysql.Message("Unsupported type %T", nil), + ErrAnalyzeMissIndex: mysql.Message("Index '%s' in field list does not exist in table '%s'", nil), + ErrCartesianProductUnsupported: mysql.Message("Cartesian product is unsupported", nil), + ErrPreparedStmtNotFound: mysql.Message("Prepared statement not found", nil), + ErrWrongParamCount: mysql.Message("Wrong parameter count", nil), + ErrSchemaChanged: mysql.Message("Schema has changed", nil), + ErrUnknownPlan: mysql.Message("Unknown plan", nil), + ErrPrepareMulti: mysql.Message("Can not prepare multiple statements", nil), + ErrPrepareDDL: mysql.Message("Can not prepare DDL statements with parameters", nil), + ErrResultIsEmpty: mysql.Message("Result is empty", nil), + ErrBuildExecutor: mysql.Message("Failed to build executor", nil), + ErrBatchInsertFail: mysql.Message("Batch insert failed, please clean the table and try again.", nil), + ErrGetStartTS: mysql.Message("Can not get start ts", nil), + ErrPrivilegeCheckFail: mysql.Message("privilege check for '%s' fail", nil), // this error message should begin lowercased to be compatible with the test + ErrInvalidWildCard: mysql.Message("Wildcard fields without any table name appears in wrong place", nil), + ErrMixOfGroupFuncAndFieldsIncompatible: mysql.Message("In aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by", nil), + ErrUnsupportedSecondArgumentType: mysql.Message("JSON_OBJECTAGG: unsupported second argument type %v", nil), + ErrLockExpire: mysql.Message("TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction", nil), + ErrTableOptionUnionUnsupported: mysql.Message("CREATE/ALTER table with union option is not supported", nil), + ErrTableOptionInsertMethodUnsupported: mysql.Message("CREATE/ALTER table with insert method option is not supported", nil), + + ErrBRIEBackupFailed: mysql.Message("Backup failed: %s", nil), + ErrBRIERestoreFailed: mysql.Message("Restore failed: %s", nil), + ErrBRIEImportFailed: mysql.Message("Import failed: %s", nil), + ErrBRIEExportFailed: mysql.Message("Export failed: %s", nil), + + ErrInvalidTableSample: mysql.Message("Invalid TABLESAMPLE: %s", nil), + + ErrJSONObjectKeyTooLong: mysql.Message("TiDB does not yet support JSON objects with the key length >= 65536", nil), + ErrPartitionStatsMissing: mysql.Message("Build table: %s global-level stats failed due to missing partition-level stats", nil), + ErrNotSupportedWithSem: mysql.Message("Feature '%s' is not supported when security enhanced mode is enabled", nil), + + ErrInvalidPlacementSpec: mysql.Message("Invalid placement policy '%s': %s", nil), + ErrPlacementPolicyCheck: mysql.Message("Placement policy didn't meet the constraint, reason: %s", nil), + ErrMultiStatementDisabled: mysql.Message("client has multi-statement capability disabled. Run SET GLOBAL tidb_multi_statement_mode='ON' after you understand the security risk", nil), + ErrAsOf: mysql.Message("invalid as of timestamp: %s", nil), + ErrInvalidAttributesSpec: mysql.Message("Invalid attributes '%s': %s", nil), + ErrPlacementPolicyExists: mysql.Message("Placement policy '%-.192s' already exists", nil), + ErrPlacementPolicyNotExists: mysql.Message("Unknown placement policy '%-.192s'", nil), + ErrPlacementPolicyWithDirectOption: mysql.Message("Placement policy '%s' can't co-exist with direct placement options", nil), + ErrPlacementPolicyInUse: mysql.Message("Placement policy '%-.192s' is still in use", nil), + + // TiKV/PD errors. + ErrPDServerTimeout: mysql.Message("PD server timeout", nil), + ErrTiKVServerTimeout: mysql.Message("TiKV server timeout", nil), + ErrTiKVServerBusy: mysql.Message("TiKV server is busy", nil), + ErrTiFlashServerTimeout: mysql.Message("TiFlash server timeout", nil), + ErrTiFlashServerBusy: mysql.Message("TiFlash server is busy", nil), + ErrResolveLockTimeout: mysql.Message("Resolve lock timeout", nil), + ErrRegionUnavailable: mysql.Message("Region is unavailable", nil), + ErrGCTooEarly: mysql.Message("GC life time is shorter than transaction duration, transaction starts at %v, GC safe point is %v", nil), + ErrWriteConflict: mysql.Message("Write conflict, txnStartTS=%d, conflictStartTS=%d, conflictCommitTS=%d, key=%s", []int{3}), + ErrTiKVStoreLimit: mysql.Message("Store token is up to the limit, store id = %d", nil), + ErrPrometheusAddrIsNotSet: mysql.Message("Prometheus address is not set in PD and etcd", nil), + ErrTiKVStaleCommand: mysql.Message("TiKV server reports stale command", nil), + ErrTiKVMaxTimestampNotSynced: mysql.Message("TiKV max timestamp is not synced", nil), +} diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..78d693f1f --- /dev/null +++ b/go.mod @@ -0,0 +1,19 @@ +module tinysql + +go 1.16 + +require ( + github.com/BurntSushi/toml v0.4.1 + github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect + github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d + github.com/golang/protobuf v1.5.2 + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 + github.com/opentracing/opentracing-go v1.2.0 + github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 + github.com/pingcap/log v0.0.0-20210906054005-afc726e70354 + github.com/sirupsen/logrus v1.8.1 + github.com/tikv/client-go/v2 v2.0.0-alpha + github.com/uber/jaeger-client-go v2.29.1+incompatible + github.com/uber/jaeger-lib v2.4.1+incompatible // indirect + go.uber.org/zap v1.19.1 +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..50d95d306 --- /dev/null +++ b/go.sum @@ -0,0 +1,684 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VividCortex/mysqlerr v0.0.0-20200629151747-c28746d985dd/go.mod h1:f3HiCrHjHBdcm6E83vGaXh1KomZMA2P6aeo3hKx/wg0= +github.com/Xeoncross/go-aesctr-with-hmac v0.0.0-20200623134604-12b17a7ff502/go.mod h1:pmnBM9bxWSiHvC/gSWunUIyDvGn33EkP2CUjxFKtTTM= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0= +github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aws/aws-sdk-go v1.35.3 h1:r0puXncSaAfRt7Btml2swUo74Kao+vKhO3VLjwDjK54= +github.com/aws/aws-sdk-go v1.35.3/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d h1:rQlvB2AYWme2bIB18r/SipGiMEVJYE9U0z+MGoU/LtQ= +github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU= +github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5 h1:BjkPE3785EwPhhyuFkbINB+2a1xATwk8SNDWnJiD41g= +github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5/go.mod h1:jtAfVaU/2cu1+wdSRPWE2c1N2qeAA3K4RH9pYgqwets= +github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/parser v0.0.0-20160622100904-31edd927e5b1/go.mod h1:2B43mz36vGZNZEwkWi8ayRSSUXLfjL8OkbzwW4NcPMM= +github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= +github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= +github.com/cznic/y v0.0.0-20170802143616-045f81c6662a/go.mod h1:1rk5VM7oSnA4vjp+hrLQ3HWHa+Y4yPCa3/CsJrcNnvs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= +github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= +github.com/go-echarts/go-echarts v1.0.0/go.mod h1:qbmyAb/Rl1f2w7wKba1D4LoNq4U164yO4/wedFbcWyo= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= +github.com/go-playground/overalls v0.0.0-20180201144345-22ec1a223b7c/go.mod h1:UqxAgEOt89sCiXlrc/ycnx00LVvUO/eS8tMUkWX4R7w= +github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= +github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-graphviz v0.0.5/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= +github.com/gogo/protobuf v0.0.0-20180717141946-636bf0302bc9/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v0.0.0-20180814211427-aa810b61a9c7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf h1:gFVkHXmVAhEbxZVDln5V9GKrLaluNoFHDbrZwAWZgws= +github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20200407044318-7d83b28da2e9/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.12.1 h1:zCy2xE9ablevUOrUZc3Dl72Dt+ya2FNAvC2yLYMHzi4= +github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= +github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69/go.mod h1:YLEMZOtU+AZ7dhN9T/IpGhXVGly2bvkJQ+zxj3WeVQo= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hypnoglow/gormzap v0.3.0/go.mod h1:5Wom8B7Jl2oK0Im9hs6KQ+Kl92w4Y7gKCrj66rhyvw0= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/joomcode/errorx v1.0.1/go.mod h1:kgco15ekB6cs+4Xjzo7SPeXzx38PbJzBwbnu9qfVNHQ= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY= +github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= +github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= +github.com/mgechev/revive v1.0.2/go.mod h1:rb0dQy1LVAxW9SWy5R3LPUjevzUbUS316U5MFySA2lo= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk= +github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oleiade/reflections v1.0.1/go.mod h1:rdFxbxq4QXVZWj0F+e9jqjDkc7dbp97vkRixKo2JR60= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.3.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d h1:U+PMnTlV2tu7RuMK5etusZG3Cf+rpow5hqQByeCzJ2g= +github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d/go.mod h1:lXfE4PvvTW5xOjO6Mba8zDPyw8M93B6AQ7frTGnMlA8= +github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= +github.com/pingcap/check v0.0.0-20191107115940-caf2b9e6ccf4/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc= +github.com/pingcap/check v0.0.0-20191216031241-8a5a85928f12/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc= +github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712 h1:R8gStypOBmpnHEx1qi//SaqxJVI4inOqljg/Aj5/390= +github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc= +github.com/pingcap/errcode v0.3.0/go.mod h1:4b2X8xSqxIroj/IZ9MX/VGZhAwc11wB9wRIzHvz6SeM= +github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.5-0.20200917111840-a15ef68f753d/go.mod h1:g4vx//d6VakjJ0mk7iLBlKA8LFavV/sAVINT/1PFxeQ= +github.com/pingcap/errors v0.11.5-0.20201029093017-5a7df2af2ac7/go.mod h1:G7x87le1poQzLB/TqvTJI2ILrSgobnq4Ut7luOwvfvI= +github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 h1:LllgC9eGfqzkfubMgjKIDyZYaa609nNWAyNZtpy2B3M= +github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3/go.mod h1:G7x87le1poQzLB/TqvTJI2ILrSgobnq4Ut7luOwvfvI= +github.com/pingcap/failpoint v0.0.0-20191029060244-12f4ac2fd11d/go.mod h1:DNS3Qg7bEDhU6EXNHF+XSv/PGznQaMJ5FWvctpm6pQI= +github.com/pingcap/failpoint v0.0.0-20200702092429-9f69995143ce/go.mod h1:w4PEZ5y16LeofeeGwdgZB4ddv9bLyDuIX+ljstgKZyk= +github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd h1:I8IeI8MNiZVKnwuXhcIIzz6pREcOSbq18Q31KYIzFVM= +github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd/go.mod h1:IVF+ijPSMZVtx2oIqxAg7ur6EyixtTYfOHwpfmlhqI4= +github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw= +github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= +github.com/pingcap/kvproto v0.0.0-20200411081810-b85805c9476c/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20210219064844-c1844a4775d6/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20210531063847-f42e582bf0bb h1:6isHwZRl1fc9i1Mggiza2iQcfvVvYAAerFIs5t9msXg= +github.com/pingcap/kvproto v0.0.0-20210531063847-f42e582bf0bb/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20210317133921-96f4fcab92a4/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20210906054005-afc726e70354 h1:SvWCbCPh1YeHd9yQLksvJYAgft6wLTY1aNG81tpyscQ= +github.com/pingcap/log v0.0.0-20210906054005-afc726e70354/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= +github.com/pingcap/parser v0.0.0-20210525032559-c37778aff307/go.mod h1:xZC8I7bug4GJ5KtHhgAikjTfU4kBv1Sbo3Pf1MZ6lVw= +github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= +github.com/pingcap/sysutil v0.0.0-20210315073920-cc0985d983a3/go.mod h1:tckvA041UWP+NqYzrJ3fMgC/Hw9wnmQ/tUkp/JaHly8= +github.com/pingcap/tidb-dashboard v0.0.0-20210312062513-eef5d6404638/go.mod h1:OzFN8H0EDMMqeulPhPMw2i2JaiZWOKFQ7zdRPhENNgo= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= +github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sergi/go-diff v1.0.1-0.20180205163309-da645544ed44/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shirou/gopsutil v2.19.10+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.2+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= +github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= +github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0= +github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= +github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio= +github.com/swaggo/swag v1.6.6-0.20200529100950-7c765ddd0476/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc= +github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= +github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/thoas/go-funk v0.7.0/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= +github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= +github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tikv/client-go/v2 v2.0.0-alpha h1:q4SCsd0ks03Y1+g0MR8WkrRFOMUIPFir6mS6xV5YJMk= +github.com/tikv/client-go/v2 v2.0.0-alpha/go.mod h1:CwWVYq/nNO7qMPzK6FY+PsXdkFlBfFYURkDRlKueD9U= +github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d h1:K0XnvsnT6ofLDuM8Rt3PuFQO4p8bNraeHYstspD316g= +github.com/tikv/pd v1.1.0-beta.0.20210323121136-78679e5e209d/go.mod h1:Jw9KG11C/23Rr7DW4XWQ7H5xOgGZo6DFL1OKAF4+Igw= +github.com/tklauser/go-sysconf v0.3.4/go.mod h1:Cl2c8ZRWfHD5IrfHo9VN+FX9kCFjIOyVklgXycLB6ek= +github.com/tklauser/numcpus v0.2.1/go.mod h1:9aU+wOc6WjUIZEwWMP62PL/41d65P+iks1gBkr4QyP8= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/twmb/murmur3 v1.1.3/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/uber/jaeger-client-go v2.29.1+incompatible h1:R9ec3zO3sGpzs0abd43Y+fBZRJ9uiH6lXyR/+u6brW4= +github.com/uber/jaeger-client-go v2.29.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= +github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= +github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/unrolled/render v1.0.1/go.mod h1:gN9T0NhL4Bfbwu8ann7Ry/TGHYfosul+J0obPf6NBdM= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/negroni v0.3.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/msgpack/v5 v5.0.0-beta.1/go.mod h1:xlngVLeyQ/Qi05oQxhQ+oTuqa03RjMwMfk/7/TCs+QI= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yookoala/realpath v1.0.0/go.mod h1:gJJMA9wuX7AcqLy1+ffPatSCySA1FQ2S8Ya9AIoYBpE= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b h1:3kC4J3eQF6p1UEfQTkC67eEeb3rTk+shQqdX6tFyq9Q= +go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/dig v1.8.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw= +go.uber.org/fx v1.10.0/go.mod h1:vLRicqpG/qQEzno4SYU86iCwfT95EZza+Eba0ItuxqY= +go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= +go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191107010934-f79515f33823/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191114200427-caa0b0f7d508/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200225230052-807dcd883420/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181004005441-af9cb2a35e7f/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215 h1:0Uz5jLJQioKgVozXa1gzGbzYxbb/rhQEVvSWxzw5oUs= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/grpc v0.0.0-20180607172857-7a6a684ca69e/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/gometalinter.v2 v2.0.12/go.mod h1:NDRytsqEZyolNuAgTzJkZMkSQM7FIKyzVzGhjB/qfYo= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c/go.mod h1:3HH7i1SgMqlzxCcBmUHW657sD4Kvv9sC3HpL3YukzwA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.2.0/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/parser/mysql/charset.go b/parser/mysql/charset.go new file mode 100644 index 000000000..f2937c07b --- /dev/null +++ b/parser/mysql/charset.go @@ -0,0 +1,260 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +// MySQL collation information. +const ( + UTF8Charset = "utf8" + UTF8MB4Charset = "utf8mb4" + DefaultCharset = UTF8MB4Charset + // DefaultCollationID is utf8mb4_bin(46) + DefaultCollationID = 46 + Latin1DefaultCollationID = 47 + ASCIIDefaultCollationID = 65 + UTF8DefaultCollationID = 83 + UTF8MB4DefaultCollationID = 46 + BinaryDefaultCollationID = 63 + UTF8DefaultCollation = "utf8_bin" + UTF8MB4DefaultCollation = "utf8mb4_bin" + DefaultCollationName = UTF8MB4DefaultCollation + + // MaxBytesOfCharacter, is the max bytes length of a character, + // refer to RFC3629, in UTF-8, characters from the U+0000..U+10FFFF range + // (the UTF-16 accessible range) are encoded using sequences of 1 to 4 octets. + MaxBytesOfCharacter = 4 +) + +// CollationNames maps MySQL collation name to its ID +var CollationNames = map[string]uint8{ + "big5_chinese_ci": 1, + "latin2_czech_cs": 2, + "dec8_swedish_ci": 3, + "cp850_general_ci": 4, + "latin1_german1_ci": 5, + "hp8_english_ci": 6, + "koi8r_general_ci": 7, + "latin1_swedish_ci": 8, + "latin2_general_ci": 9, + "swe7_swedish_ci": 10, + "ascii_general_ci": 11, + "ujis_japanese_ci": 12, + "sjis_japanese_ci": 13, + "cp1251_bulgarian_ci": 14, + "latin1_danish_ci": 15, + "hebrew_general_ci": 16, + "tis620_thai_ci": 18, + "euckr_korean_ci": 19, + "latin7_estonian_cs": 20, + "latin2_hungarian_ci": 21, + "koi8u_general_ci": 22, + "cp1251_ukrainian_ci": 23, + "gb2312_chinese_ci": 24, + "greek_general_ci": 25, + "cp1250_general_ci": 26, + "latin2_croatian_ci": 27, + "gbk_chinese_ci": 28, + "cp1257_lithuanian_ci": 29, + "latin5_turkish_ci": 30, + "latin1_german2_ci": 31, + "armscii8_general_ci": 32, + "utf8_general_ci": 33, + "cp1250_czech_cs": 34, + "ucs2_general_ci": 35, + "cp866_general_ci": 36, + "keybcs2_general_ci": 37, + "macce_general_ci": 38, + "macroman_general_ci": 39, + "cp852_general_ci": 40, + "latin7_general_ci": 41, + "latin7_general_cs": 42, + "macce_bin": 43, + "cp1250_croatian_ci": 44, + "utf8mb4_general_ci": 45, + "utf8mb4_bin": 46, + "latin1_bin": 47, + "latin1_general_ci": 48, + "latin1_general_cs": 49, + "cp1251_bin": 50, + "cp1251_general_ci": 51, + "cp1251_general_cs": 52, + "macroman_bin": 53, + "utf16_general_ci": 54, + "utf16_bin": 55, + "utf16le_general_ci": 56, + "cp1256_general_ci": 57, + "cp1257_bin": 58, + "cp1257_general_ci": 59, + "utf32_general_ci": 60, + "utf32_bin": 61, + "utf16le_bin": 62, + "binary": 63, + "armscii8_bin": 64, + "ascii_bin": 65, + "cp1250_bin": 66, + "cp1256_bin": 67, + "cp866_bin": 68, + "dec8_bin": 69, + "greek_bin": 70, + "hebrew_bin": 71, + "hp8_bin": 72, + "keybcs2_bin": 73, + "koi8r_bin": 74, + "koi8u_bin": 75, + "latin2_bin": 77, + "latin5_bin": 78, + "latin7_bin": 79, + "cp850_bin": 80, + "cp852_bin": 81, + "swe7_bin": 82, + "utf8_bin": 83, + "big5_bin": 84, + "euckr_bin": 85, + "gb2312_bin": 86, + "gbk_bin": 87, + "sjis_bin": 88, + "tis620_bin": 89, + "ucs2_bin": 90, + "ujis_bin": 91, + "geostd8_general_ci": 92, + "geostd8_bin": 93, + "latin1_spanish_ci": 94, + "cp932_japanese_ci": 95, + "cp932_bin": 96, + "eucjpms_japanese_ci": 97, + "eucjpms_bin": 98, + "cp1250_polish_ci": 99, + "utf16_unicode_ci": 101, + "utf16_icelandic_ci": 102, + "utf16_latvian_ci": 103, + "utf16_romanian_ci": 104, + "utf16_slovenian_ci": 105, + "utf16_polish_ci": 106, + "utf16_estonian_ci": 107, + "utf16_spanish_ci": 108, + "utf16_swedish_ci": 109, + "utf16_turkish_ci": 110, + "utf16_czech_ci": 111, + "utf16_danish_ci": 112, + "utf16_lithuanian_ci": 113, + "utf16_slovak_ci": 114, + "utf16_spanish2_ci": 115, + "utf16_roman_ci": 116, + "utf16_persian_ci": 117, + "utf16_esperanto_ci": 118, + "utf16_hungarian_ci": 119, + "utf16_sinhala_ci": 120, + "utf16_german2_ci": 121, + "utf16_croatian_ci": 122, + "utf16_unicode_520_ci": 123, + "utf16_vietnamese_ci": 124, + "ucs2_unicode_ci": 128, + "ucs2_icelandic_ci": 129, + "ucs2_latvian_ci": 130, + "ucs2_romanian_ci": 131, + "ucs2_slovenian_ci": 132, + "ucs2_polish_ci": 133, + "ucs2_estonian_ci": 134, + "ucs2_spanish_ci": 135, + "ucs2_swedish_ci": 136, + "ucs2_turkish_ci": 137, + "ucs2_czech_ci": 138, + "ucs2_danish_ci": 139, + "ucs2_lithuanian_ci": 140, + "ucs2_slovak_ci": 141, + "ucs2_spanish2_ci": 142, + "ucs2_roman_ci": 143, + "ucs2_persian_ci": 144, + "ucs2_esperanto_ci": 145, + "ucs2_hungarian_ci": 146, + "ucs2_sinhala_ci": 147, + "ucs2_german2_ci": 148, + "ucs2_croatian_ci": 149, + "ucs2_unicode_520_ci": 150, + "ucs2_vietnamese_ci": 151, + "ucs2_general_mysql500_ci": 159, + "utf32_unicode_ci": 160, + "utf32_icelandic_ci": 161, + "utf32_latvian_ci": 162, + "utf32_romanian_ci": 163, + "utf32_slovenian_ci": 164, + "utf32_polish_ci": 165, + "utf32_estonian_ci": 166, + "utf32_spanish_ci": 167, + "utf32_swedish_ci": 168, + "utf32_turkish_ci": 169, + "utf32_czech_ci": 170, + "utf32_danish_ci": 171, + "utf32_lithuanian_ci": 172, + "utf32_slovak_ci": 173, + "utf32_spanish2_ci": 174, + "utf32_roman_ci": 175, + "utf32_persian_ci": 176, + "utf32_esperanto_ci": 177, + "utf32_hungarian_ci": 178, + "utf32_sinhala_ci": 179, + "utf32_german2_ci": 180, + "utf32_croatian_ci": 181, + "utf32_unicode_520_ci": 182, + "utf32_vietnamese_ci": 183, + "utf8_unicode_ci": 192, + "utf8_icelandic_ci": 193, + "utf8_latvian_ci": 194, + "utf8_romanian_ci": 195, + "utf8_slovenian_ci": 196, + "utf8_polish_ci": 197, + "utf8_estonian_ci": 198, + "utf8_spanish_ci": 199, + "utf8_swedish_ci": 200, + "utf8_turkish_ci": 201, + "utf8_czech_ci": 202, + "utf8_danish_ci": 203, + "utf8_lithuanian_ci": 204, + "utf8_slovak_ci": 205, + "utf8_spanish2_ci": 206, + "utf8_roman_ci": 207, + "utf8_persian_ci": 208, + "utf8_esperanto_ci": 209, + "utf8_hungarian_ci": 210, + "utf8_sinhala_ci": 211, + "utf8_german2_ci": 212, + "utf8_croatian_ci": 213, + "utf8_unicode_520_ci": 214, + "utf8_vietnamese_ci": 215, + "utf8_general_mysql500_ci": 223, + "utf8mb4_unicode_ci": 224, + "utf8mb4_icelandic_ci": 225, + "utf8mb4_latvian_ci": 226, + "utf8mb4_romanian_ci": 227, + "utf8mb4_slovenian_ci": 228, + "utf8mb4_polish_ci": 229, + "utf8mb4_estonian_ci": 230, + "utf8mb4_spanish_ci": 231, + "utf8mb4_swedish_ci": 232, + "utf8mb4_turkish_ci": 233, + "utf8mb4_czech_ci": 234, + "utf8mb4_danish_ci": 235, + "utf8mb4_lithuanian_ci": 236, + "utf8mb4_slovak_ci": 237, + "utf8mb4_spanish2_ci": 238, + "utf8mb4_roman_ci": 239, + "utf8mb4_persian_ci": 240, + "utf8mb4_esperanto_ci": 241, + "utf8mb4_hungarian_ci": 242, + "utf8mb4_sinhala_ci": 243, + "utf8mb4_german2_ci": 244, + "utf8mb4_croatian_ci": 245, + "utf8mb4_unicode_520_ci": 246, + "utf8mb4_vietnamese_ci": 247, + "utf8mb4_0900_ai_ci": 255, +} diff --git a/parser/mysql/const.go b/parser/mysql/const.go new file mode 100644 index 000000000..1b3db3512 --- /dev/null +++ b/parser/mysql/const.go @@ -0,0 +1,185 @@ +// Copyright 2017 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +import ( + "fmt" +) + +// Version information. +var ( + // TiDBReleaseVersion is initialized by (git describe --tags) in Makefile. + TiDBReleaseVersion = "None" + + // ServerVersion is the version information of this tidb-server in MySQL's format. + ServerVersion = fmt.Sprintf("TinySQL-lab0-%s", TiDBReleaseVersion) +) + +// Header information. +const ( + OKHeader byte = 0x00 + ErrHeader byte = 0xff + EOFHeader byte = 0xfe + LocalInFileHeader byte = 0xfb +) + +// Auth name information. +const ( + AuthNativePassword = "mysql_native_password" + AuthCachingSha2Password = "caching_sha2_password" + AuthSocket = "auth_socket" +) + +// Protocol Features +const AuthSwitchRequest byte = 0xfe + +// Server information. +const ( + ServerStatusInTrans uint16 = 0x0001 + ServerStatusAutocommit uint16 = 0x0002 + ServerMoreResultsExists uint16 = 0x0008 + ServerStatusNoGoodIndexUsed uint16 = 0x0010 + ServerStatusNoIndexUsed uint16 = 0x0020 + ServerStatusCursorExists uint16 = 0x0040 + ServerStatusLastRowSend uint16 = 0x0080 + ServerStatusDBDropped uint16 = 0x0100 + ServerStatusNoBackslashEscaped uint16 = 0x0200 + ServerStatusMetadataChanged uint16 = 0x0400 + ServerStatusWasSlow uint16 = 0x0800 + ServerPSOutParams uint16 = 0x1000 +) + +// Command information. +const ( + ComSleep byte = iota + ComQuit + ComInitDB + ComQuery + ComFieldList + ComCreateDB + ComDropDB + ComRefresh + ComShutdown + ComStatistics + ComProcessInfo + ComConnect + ComProcessKill + ComDebug + ComPing + ComTime + ComDelayedInsert + ComChangeUser + ComBinlogDump + ComTableDump + ComConnectOut + ComRegisterSlave + ComStmtPrepare + ComStmtExecute + ComStmtSendLongData + ComStmtClose + ComStmtReset + ComSetOption + ComStmtFetch + ComDaemon + ComBinlogDumpGtid + ComResetConnection + ComEnd +) + +// Command2Str is the command information to command name. +var Command2Str = map[byte]string{ + ComSleep: "Sleep", + ComQuit: "Quit", + ComInitDB: "Init DB", + ComQuery: "Query", + ComFieldList: "Field List", + ComCreateDB: "Create DB", + ComDropDB: "Drop DB", + ComRefresh: "Refresh", + ComShutdown: "Shutdown", + ComStatistics: "Statistics", + ComProcessInfo: "Processlist", + ComConnect: "Connect", + ComProcessKill: "Kill", + ComDebug: "Debug", + ComPing: "Ping", + ComTime: "Time", + ComDelayedInsert: "Delayed Insert", + ComChangeUser: "Change User", + ComBinlogDump: "Binlog Dump", + ComTableDump: "Table Dump", + ComConnectOut: "Connect out", + ComRegisterSlave: "Register Slave", + ComStmtPrepare: "Prepare", + ComStmtExecute: "Execute", + ComStmtSendLongData: "Long Data", + ComStmtClose: "Close stmt", + ComStmtReset: "Reset stmt", + ComSetOption: "Set option", + ComStmtFetch: "Fetch", + ComDaemon: "Daemon", + ComBinlogDumpGtid: "Binlog Dump", + ComResetConnection: "Reset connect", +} + +// Client information. +const ( + ClientLongPassword uint32 = 1 << iota + ClientFoundRows + ClientLongFlag + ClientConnectWithDB + ClientNoSchema + ClientCompress + ClientODBC + ClientLocalFiles + ClientIgnoreSpace + ClientProtocol41 + ClientInteractive + ClientSSL + ClientIgnoreSigpipe + ClientTransactions + ClientReserved + ClientSecureConnection + ClientMultiStatements + ClientMultiResults + ClientPSMultiResults + ClientPluginAuth + ClientConnectAtts + ClientPluginAuthLenencClientData +) + +// Identifier length limitations. +// See https://dev.mysql.com/doc/refman/5.7/en/identifiers.html +const ( + // MaxPayloadLen is the max packet payload length. + MaxPayloadLen = 1<<24 - 1 + // MaxTableNameLength is max length of table name identifier. + MaxTableNameLength = 64 + // MaxDatabaseNameLength is max length of database name identifier. + MaxDatabaseNameLength = 64 + // MaxColumnNameLength is max length of column name identifier. + MaxColumnNameLength = 64 + // MaxKeyParts is max length of key parts. + MaxKeyParts = 16 + // MaxIndexIdentifierLen is max length of index identifier. + MaxIndexIdentifierLen = 64 + // MaxConstraintIdentifierLen is max length of constrain identifier. + MaxConstraintIdentifierLen = 64 + // MaxViewIdentifierLen is max length of view identifier. + MaxViewIdentifierLen = 64 + // MaxAliasIdentifierLen is max length of alias identifier. + MaxAliasIdentifierLen = 256 + // MaxUserDefinedVariableLen is max length of user-defined variable. + MaxUserDefinedVariableLen = 64 +) diff --git a/parser/mysql/errcode.go b/parser/mysql/errcode.go new file mode 100644 index 000000000..d9e3fe5a6 --- /dev/null +++ b/parser/mysql/errcode.go @@ -0,0 +1,972 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +// MySQL error code. +// This value is numeric. It is not portable to other database systems. +const ( + ErrErrorFirst = 1000 + ErrHashchk = 1000 + ErrNisamchk = 1001 + ErrNo = 1002 + ErrYes = 1003 + ErrCantCreateFile = 1004 + ErrCantCreateTable = 1005 + ErrCantCreateDB = 1006 + ErrDBCreateExists = 1007 + ErrDBDropExists = 1008 + ErrDBDropDelete = 1009 + ErrDBDropRmdir = 1010 + ErrCantDeleteFile = 1011 + ErrCantFindSystemRec = 1012 + ErrCantGetStat = 1013 + ErrCantGetWd = 1014 + ErrCantLock = 1015 + ErrCantOpenFile = 1016 + ErrFileNotFound = 1017 + ErrCantReadDir = 1018 + ErrCantSetWd = 1019 + ErrCheckread = 1020 + ErrDiskFull = 1021 + ErrDupKey = 1022 + ErrErrorOnClose = 1023 + ErrErrorOnRead = 1024 + ErrErrorOnRename = 1025 + ErrErrorOnWrite = 1026 + ErrFileUsed = 1027 + ErrFilsortAbort = 1028 + ErrFormNotFound = 1029 + ErrGetErrno = 1030 + ErrIllegalHa = 1031 + ErrKeyNotFound = 1032 + ErrNotFormFile = 1033 + ErrNotKeyFile = 1034 + ErrOldKeyFile = 1035 + ErrOpenAsReadonly = 1036 + ErrOutofMemory = 1037 + ErrOutOfSortMemory = 1038 + ErrUnexpectedEOF = 1039 + ErrConCount = 1040 + ErrOutOfResources = 1041 + ErrBadHost = 1042 + ErrHandshake = 1043 + ErrDBaccessDenied = 1044 + ErrAccessDenied = 1045 + ErrNoDB = 1046 + ErrUnknownCom = 1047 + ErrBadNull = 1048 + ErrBadDB = 1049 + ErrTableExists = 1050 + ErrBadTable = 1051 + ErrNonUniq = 1052 + ErrServerShutdown = 1053 + ErrBadField = 1054 + ErrFieldNotInGroupBy = 1055 + ErrWrongGroupField = 1056 + ErrWrongSumSelect = 1057 + ErrWrongValueCount = 1058 + ErrTooLongIdent = 1059 + ErrDupFieldName = 1060 + ErrDupKeyName = 1061 + ErrDupEntry = 1062 + ErrWrongFieldSpec = 1063 + ErrParse = 1064 + ErrEmptyQuery = 1065 + ErrNonuniqTable = 1066 + ErrInvalidDefault = 1067 + ErrMultiplePriKey = 1068 + ErrTooManyKeys = 1069 + ErrTooManyKeyParts = 1070 + ErrTooLongKey = 1071 + ErrKeyColumnDoesNotExits = 1072 + ErrBlobUsedAsKey = 1073 + ErrTooBigFieldlength = 1074 + ErrWrongAutoKey = 1075 + ErrReady = 1076 + ErrNormalShutdown = 1077 + ErrGotSignal = 1078 + ErrShutdownComplete = 1079 + ErrForcingClose = 1080 + ErrIpsock = 1081 + ErrNoSuchIndex = 1082 + ErrWrongFieldTerminators = 1083 + ErrBlobsAndNoTerminated = 1084 + ErrTextFileNotReadable = 1085 + ErrFileExists = 1086 + ErrLoadInfo = 1087 + ErrAlterInfo = 1088 + ErrWrongSubKey = 1089 + ErrCantRemoveAllFields = 1090 + ErrCantDropFieldOrKey = 1091 + ErrInsertInfo = 1092 + ErrUpdateTableUsed = 1093 + ErrNoSuchThread = 1094 + ErrKillDenied = 1095 + ErrNoTablesUsed = 1096 + ErrTooBigSet = 1097 + ErrNoUniqueLogFile = 1098 + ErrTableNotLockedForWrite = 1099 + ErrTableNotLocked = 1100 + ErrBlobCantHaveDefault = 1101 + ErrWrongDBName = 1102 + ErrWrongTableName = 1103 + ErrTooBigSelect = 1104 + ErrUnknown = 1105 + ErrUnknownProcedure = 1106 + ErrWrongParamcountToProcedure = 1107 + ErrWrongParametersToProcedure = 1108 + ErrUnknownTable = 1109 + ErrFieldSpecifiedTwice = 1110 + ErrInvalidGroupFuncUse = 1111 + ErrUnsupportedExtension = 1112 + ErrTableMustHaveColumns = 1113 + ErrRecordFileFull = 1114 + ErrUnknownCharacterSet = 1115 + ErrTooManyTables = 1116 + ErrTooManyFields = 1117 + ErrTooBigRowsize = 1118 + ErrStackOverrun = 1119 + ErrWrongOuterJoin = 1120 + ErrNullColumnInIndex = 1121 + ErrCantFindUdf = 1122 + ErrCantInitializeUdf = 1123 + ErrUdfNoPaths = 1124 + ErrUdfExists = 1125 + ErrCantOpenLibrary = 1126 + ErrCantFindDlEntry = 1127 + ErrFunctionNotDefined = 1128 + ErrHostIsBlocked = 1129 + ErrHostNotPrivileged = 1130 + ErrPasswordAnonymousUser = 1131 + ErrPasswordNotAllowed = 1132 + ErrPasswordNoMatch = 1133 + ErrUpdateInfo = 1134 + ErrCantCreateThread = 1135 + ErrWrongValueCountOnRow = 1136 + ErrCantReopenTable = 1137 + ErrInvalidUseOfNull = 1138 + ErrRegexp = 1139 + ErrMixOfGroupFuncAndFields = 1140 + ErrNonexistingGrant = 1141 + ErrTableaccessDenied = 1142 + ErrColumnaccessDenied = 1143 + ErrIllegalGrantForTable = 1144 + ErrGrantWrongHostOrUser = 1145 + ErrNoSuchTable = 1146 + ErrNonexistingTableGrant = 1147 + ErrNotAllowedCommand = 1148 + ErrSyntax = 1149 + ErrDelayedCantChangeLock = 1150 + ErrTooManyDelayedThreads = 1151 + ErrAbortingConnection = 1152 + ErrNetPacketTooLarge = 1153 + ErrNetReadErrorFromPipe = 1154 + ErrNetFcntl = 1155 + ErrNetPacketsOutOfOrder = 1156 + ErrNetUncompress = 1157 + ErrNetRead = 1158 + ErrNetReadInterrupted = 1159 + ErrNetErrorOnWrite = 1160 + ErrNetWriteInterrupted = 1161 + ErrTooLongString = 1162 + ErrTableCantHandleBlob = 1163 + ErrTableCantHandleAutoIncrement = 1164 + ErrDelayedInsertTableLocked = 1165 + ErrWrongColumnName = 1166 + ErrWrongKeyColumn = 1167 + ErrWrongMrgTable = 1168 + ErrDupUnique = 1169 + ErrBlobKeyWithoutLength = 1170 + ErrPrimaryCantHaveNull = 1171 + ErrTooManyRows = 1172 + ErrRequiresPrimaryKey = 1173 + ErrNoRaidCompiled = 1174 + ErrUpdateWithoutKeyInSafeMode = 1175 + ErrKeyDoesNotExist = 1176 + ErrCheckNoSuchTable = 1177 + ErrCheckNotImplemented = 1178 + ErrCantDoThisDuringAnTransaction = 1179 + ErrErrorDuringCommit = 1180 + ErrErrorDuringRollback = 1181 + ErrErrorDuringFlushLogs = 1182 + ErrErrorDuringCheckpoint = 1183 + ErrNewAbortingConnection = 1184 + ErrDumpNotImplemented = 1185 + ErrFlushMasterBinlogClosed = 1186 + ErrIndexRebuild = 1187 + ErrMaster = 1188 + ErrMasterNetRead = 1189 + ErrMasterNetWrite = 1190 + ErrFtMatchingKeyNotFound = 1191 + ErrLockOrActiveTransaction = 1192 + ErrUnknownSystemVariable = 1193 + ErrCrashedOnUsage = 1194 + ErrCrashedOnRepair = 1195 + ErrWarningNotCompleteRollback = 1196 + ErrTransCacheFull = 1197 + ErrSlaveMustStop = 1198 + ErrSlaveNotRunning = 1199 + ErrBadSlave = 1200 + ErrMasterInfo = 1201 + ErrSlaveThread = 1202 + ErrTooManyUserConnections = 1203 + ErrSetConstantsOnly = 1204 + ErrLockWaitTimeout = 1205 + ErrLockTableFull = 1206 + ErrReadOnlyTransaction = 1207 + ErrDropDBWithReadLock = 1208 + ErrCreateDBWithReadLock = 1209 + ErrWrongArguments = 1210 + ErrNoPermissionToCreateUser = 1211 + ErrUnionTablesInDifferentDir = 1212 + ErrLockDeadlock = 1213 + ErrTableCantHandleFt = 1214 + ErrCannotAddForeign = 1215 + ErrNoReferencedRow = 1216 + ErrRowIsReferenced = 1217 + ErrConnectToMaster = 1218 + ErrQueryOnMaster = 1219 + ErrErrorWhenExecutingCommand = 1220 + ErrWrongUsage = 1221 + ErrWrongNumberOfColumnsInSelect = 1222 + ErrCantUpdateWithReadlock = 1223 + ErrMixingNotAllowed = 1224 + ErrDupArgument = 1225 + ErrUserLimitReached = 1226 + ErrSpecificAccessDenied = 1227 + ErrLocalVariable = 1228 + ErrGlobalVariable = 1229 + ErrNoDefault = 1230 + ErrWrongValueForVar = 1231 + ErrWrongTypeForVar = 1232 + ErrVarCantBeRead = 1233 + ErrCantUseOptionHere = 1234 + ErrNotSupportedYet = 1235 + ErrMasterFatalErrorReadingBinlog = 1236 + ErrSlaveIgnoredTable = 1237 + ErrIncorrectGlobalLocalVar = 1238 + ErrWrongFkDef = 1239 + ErrKeyRefDoNotMatchTableRef = 1240 + ErrOperandColumns = 1241 + ErrSubqueryNo1Row = 1242 + ErrUnknownStmtHandler = 1243 + ErrCorruptHelpDB = 1244 + ErrCyclicReference = 1245 + ErrAutoConvert = 1246 + ErrIllegalReference = 1247 + ErrDerivedMustHaveAlias = 1248 + ErrSelectReduced = 1249 + ErrTablenameNotAllowedHere = 1250 + ErrNotSupportedAuthMode = 1251 + ErrSpatialCantHaveNull = 1252 + ErrCollationCharsetMismatch = 1253 + ErrSlaveWasRunning = 1254 + ErrSlaveWasNotRunning = 1255 + ErrTooBigForUncompress = 1256 + ErrZlibZMem = 1257 + ErrZlibZBuf = 1258 + ErrZlibZData = 1259 + ErrCutValueGroupConcat = 1260 + ErrWarnTooFewRecords = 1261 + ErrWarnTooManyRecords = 1262 + ErrWarnNullToNotnull = 1263 + ErrWarnDataOutOfRange = 1264 + WarnDataTruncated = 1265 + ErrWarnUsingOtherHandler = 1266 + ErrCantAggregate2collations = 1267 + ErrDropUser = 1268 + ErrRevokeGrants = 1269 + ErrCantAggregate3collations = 1270 + ErrCantAggregateNcollations = 1271 + ErrVariableIsNotStruct = 1272 + ErrUnknownCollation = 1273 + ErrSlaveIgnoredSslParams = 1274 + ErrServerIsInSecureAuthMode = 1275 + ErrWarnFieldResolved = 1276 + ErrBadSlaveUntilCond = 1277 + ErrMissingSkipSlave = 1278 + ErrUntilCondIgnored = 1279 + ErrWrongNameForIndex = 1280 + ErrWrongNameForCatalog = 1281 + ErrWarnQcResize = 1282 + ErrBadFtColumn = 1283 + ErrUnknownKeyCache = 1284 + ErrWarnHostnameWontWork = 1285 + ErrUnknownStorageEngine = 1286 + ErrWarnDeprecatedSyntax = 1287 + ErrNonUpdatableTable = 1288 + ErrFeatureDisabled = 1289 + ErrOptionPreventsStatement = 1290 + ErrDuplicatedValueInType = 1291 + ErrTruncatedWrongValue = 1292 + ErrTooMuchAutoTimestampCols = 1293 + ErrInvalidOnUpdate = 1294 + ErrUnsupportedPs = 1295 + ErrGetErrmsg = 1296 + ErrGetTemporaryErrmsg = 1297 + ErrUnknownTimeZone = 1298 + ErrWarnInvalidTimestamp = 1299 + ErrInvalidCharacterString = 1300 + ErrWarnAllowedPacketOverflowed = 1301 + ErrConflictingDeclarations = 1302 + ErrSpNoRecursiveCreate = 1303 + ErrSpAlreadyExists = 1304 + ErrSpDoesNotExist = 1305 + ErrSpDropFailed = 1306 + ErrSpStoreFailed = 1307 + ErrSpLilabelMismatch = 1308 + ErrSpLabelRedefine = 1309 + ErrSpLabelMismatch = 1310 + ErrSpUninitVar = 1311 + ErrSpBadselect = 1312 + ErrSpBadreturn = 1313 + ErrSpBadstatement = 1314 + ErrUpdateLogDeprecatedIgnored = 1315 + ErrUpdateLogDeprecatedTranslated = 1316 + ErrQueryInterrupted = 1317 + ErrSpWrongNoOfArgs = 1318 + ErrSpCondMismatch = 1319 + ErrSpNoreturn = 1320 + ErrSpNoreturnend = 1321 + ErrSpBadCursorQuery = 1322 + ErrSpBadCursorSelect = 1323 + ErrSpCursorMismatch = 1324 + ErrSpCursorAlreadyOpen = 1325 + ErrSpCursorNotOpen = 1326 + ErrSpUndeclaredVar = 1327 + ErrSpWrongNoOfFetchArgs = 1328 + ErrSpFetchNoData = 1329 + ErrSpDupParam = 1330 + ErrSpDupVar = 1331 + ErrSpDupCond = 1332 + ErrSpDupCurs = 1333 + ErrSpCantAlter = 1334 + ErrSpSubselectNyi = 1335 + ErrStmtNotAllowedInSfOrTrg = 1336 + ErrSpVarcondAfterCurshndlr = 1337 + ErrSpCursorAfterHandler = 1338 + ErrSpCaseNotFound = 1339 + ErrFparserTooBigFile = 1340 + ErrFparserBadHeader = 1341 + ErrFparserEOFInComment = 1342 + ErrFparserErrorInParameter = 1343 + ErrFparserEOFInUnknownParameter = 1344 + ErrViewNoExplain = 1345 + ErrFrmUnknownType = 1346 + ErrWrongObject = 1347 + ErrNonupdateableColumn = 1348 + ErrViewSelectDerived = 1349 + ErrViewSelectClause = 1350 + ErrViewSelectVariable = 1351 + ErrViewSelectTmptable = 1352 + ErrViewWrongList = 1353 + ErrWarnViewMerge = 1354 + ErrWarnViewWithoutKey = 1355 + ErrViewInvalid = 1356 + ErrSpNoDropSp = 1357 + ErrSpGotoInHndlr = 1358 + ErrTrgAlreadyExists = 1359 + ErrTrgDoesNotExist = 1360 + ErrTrgOnViewOrTempTable = 1361 + ErrTrgCantChangeRow = 1362 + ErrTrgNoSuchRowInTrg = 1363 + ErrNoDefaultForField = 1364 + ErrDivisionByZero = 1365 + ErrTruncatedWrongValueForField = 1366 + ErrIllegalValueForType = 1367 + ErrViewNonupdCheck = 1368 + ErrViewCheckFailed = 1369 + ErrProcaccessDenied = 1370 + ErrRelayLogFail = 1371 + ErrPasswdLength = 1372 + ErrUnknownTargetBinlog = 1373 + ErrIoErrLogIndexRead = 1374 + ErrBinlogPurgeProhibited = 1375 + ErrFseekFail = 1376 + ErrBinlogPurgeFatalErr = 1377 + ErrLogInUse = 1378 + ErrLogPurgeUnknownErr = 1379 + ErrRelayLogInit = 1380 + ErrNoBinaryLogging = 1381 + ErrReservedSyntax = 1382 + ErrWsasFailed = 1383 + ErrDiffGroupsProc = 1384 + ErrNoGroupForProc = 1385 + ErrOrderWithProc = 1386 + ErrLoggingProhibitChangingOf = 1387 + ErrNoFileMapping = 1388 + ErrWrongMagic = 1389 + ErrPsManyParam = 1390 + ErrKeyPart0 = 1391 + ErrViewChecksum = 1392 + ErrViewMultiupdate = 1393 + ErrViewNoInsertFieldList = 1394 + ErrViewDeleteMergeView = 1395 + ErrCannotUser = 1396 + ErrXaerNota = 1397 + ErrXaerInval = 1398 + ErrXaerRmfail = 1399 + ErrXaerOutside = 1400 + ErrXaerRmerr = 1401 + ErrXaRbrollback = 1402 + ErrNonexistingProcGrant = 1403 + ErrProcAutoGrantFail = 1404 + ErrProcAutoRevokeFail = 1405 + ErrDataTooLong = 1406 + ErrSpBadSQLstate = 1407 + ErrStartup = 1408 + ErrLoadFromFixedSizeRowsToVar = 1409 + ErrCantCreateUserWithGrant = 1410 + ErrWrongValueForType = 1411 + ErrTableDefChanged = 1412 + ErrSpDupHandler = 1413 + ErrSpNotVarArg = 1414 + ErrSpNoRetset = 1415 + ErrCantCreateGeometryObject = 1416 + ErrFailedRoutineBreakBinlog = 1417 + ErrBinlogUnsafeRoutine = 1418 + ErrBinlogCreateRoutineNeedSuper = 1419 + ErrExecStmtWithOpenCursor = 1420 + ErrStmtHasNoOpenCursor = 1421 + ErrCommitNotAllowedInSfOrTrg = 1422 + ErrNoDefaultForViewField = 1423 + ErrSpNoRecursion = 1424 + ErrTooBigScale = 1425 + ErrTooBigPrecision = 1426 + ErrMBiggerThanD = 1427 + ErrWrongLockOfSystemTable = 1428 + ErrConnectToForeignDataSource = 1429 + ErrQueryOnForeignDataSource = 1430 + ErrForeignDataSourceDoesntExist = 1431 + ErrForeignDataStringInvalidCantCreate = 1432 + ErrForeignDataStringInvalid = 1433 + ErrCantCreateFederatedTable = 1434 + ErrTrgInWrongSchema = 1435 + ErrStackOverrunNeedMore = 1436 + ErrTooLongBody = 1437 + ErrWarnCantDropDefaultKeycache = 1438 + ErrTooBigDisplaywidth = 1439 + ErrXaerDupid = 1440 + ErrDatetimeFunctionOverflow = 1441 + ErrCantUpdateUsedTableInSfOrTrg = 1442 + ErrViewPreventUpdate = 1443 + ErrPsNoRecursion = 1444 + ErrSpCantSetAutocommit = 1445 + ErrMalformedDefiner = 1446 + ErrViewFrmNoUser = 1447 + ErrViewOtherUser = 1448 + ErrNoSuchUser = 1449 + ErrForbidSchemaChange = 1450 + ErrRowIsReferenced2 = 1451 + ErrNoReferencedRow2 = 1452 + ErrSpBadVarShadow = 1453 + ErrTrgNoDefiner = 1454 + ErrOldFileFormat = 1455 + ErrSpRecursionLimit = 1456 + ErrSpProcTableCorrupt = 1457 + ErrSpWrongName = 1458 + ErrTableNeedsUpgrade = 1459 + ErrSpNoAggregate = 1460 + ErrMaxPreparedStmtCountReached = 1461 + ErrViewRecursive = 1462 + ErrNonGroupingFieldUsed = 1463 + ErrTableCantHandleSpkeys = 1464 + ErrNoTriggersOnSystemSchema = 1465 + ErrRemovedSpaces = 1466 + ErrAutoincReadFailed = 1467 + ErrUsername = 1468 + ErrHostname = 1469 + ErrWrongStringLength = 1470 + ErrNonInsertableTable = 1471 + ErrAdminWrongMrgTable = 1472 + ErrTooHighLevelOfNestingForSelect = 1473 + ErrNameBecomesEmpty = 1474 + ErrAmbiguousFieldTerm = 1475 + ErrForeignServerExists = 1476 + ErrForeignServerDoesntExist = 1477 + ErrIllegalHaCreateOption = 1478 + ErrPartitionRequiresValues = 1479 + ErrPartitionWrongValues = 1480 + ErrPartitionMaxvalue = 1481 + ErrPartitionSubpartition = 1482 + ErrPartitionSubpartMix = 1483 + ErrPartitionWrongNoPart = 1484 + ErrPartitionWrongNoSubpart = 1485 + ErrWrongExprInPartitionFunc = 1486 + ErrNoConstExprInRangeOrList = 1487 + ErrFieldNotFoundPart = 1488 + ErrListOfFieldsOnlyInHash = 1489 + ErrInconsistentPartitionInfo = 1490 + ErrPartitionFuncNotAllowed = 1491 + ErrPartitionsMustBeDefined = 1492 + ErrRangeNotIncreasing = 1493 + ErrInconsistentTypeOfFunctions = 1494 + ErrMultipleDefConstInListPart = 1495 + ErrPartitionEntry = 1496 + ErrMixHandler = 1497 + ErrPartitionNotDefined = 1498 + ErrTooManyPartitions = 1499 + ErrSubpartition = 1500 + ErrCantCreateHandlerFile = 1501 + ErrBlobFieldInPartFunc = 1502 + ErrUniqueKeyNeedAllFieldsInPf = 1503 + ErrNoParts = 1504 + ErrPartitionMgmtOnNonpartitioned = 1505 + ErrForeignKeyOnPartitioned = 1506 + ErrDropPartitionNonExistent = 1507 + ErrDropLastPartition = 1508 + ErrCoalesceOnlyOnHashPartition = 1509 + ErrReorgHashOnlyOnSameNo = 1510 + ErrReorgNoParam = 1511 + ErrOnlyOnRangeListPartition = 1512 + ErrAddPartitionSubpart = 1513 + ErrAddPartitionNoNewPartition = 1514 + ErrCoalescePartitionNoPartition = 1515 + ErrReorgPartitionNotExist = 1516 + ErrSameNamePartition = 1517 + ErrNoBinlog = 1518 + ErrConsecutiveReorgPartitions = 1519 + ErrReorgOutsideRange = 1520 + ErrPartitionFunctionFailure = 1521 + ErrPartState = 1522 + ErrLimitedPartRange = 1523 + ErrPluginIsNotLoaded = 1524 + ErrWrongValue = 1525 + ErrNoPartitionForGivenValue = 1526 + ErrFilegroupOptionOnlyOnce = 1527 + ErrCreateFilegroupFailed = 1528 + ErrDropFilegroupFailed = 1529 + ErrTablespaceAutoExtend = 1530 + ErrWrongSizeNumber = 1531 + ErrSizeOverflow = 1532 + ErrAlterFilegroupFailed = 1533 + ErrBinlogRowLoggingFailed = 1534 + ErrBinlogRowWrongTableDef = 1535 + ErrBinlogRowRbrToSbr = 1536 + ErrEventAlreadyExists = 1537 + ErrEventStoreFailed = 1538 + ErrEventDoesNotExist = 1539 + ErrEventCantAlter = 1540 + ErrEventDropFailed = 1541 + ErrEventIntervalNotPositiveOrTooBig = 1542 + ErrEventEndsBeforeStarts = 1543 + ErrEventExecTimeInThePast = 1544 + ErrEventOpenTableFailed = 1545 + ErrEventNeitherMExprNorMAt = 1546 + ErrObsoleteColCountDoesntMatchCorrupted = 1547 + ErrObsoleteCannotLoadFromTable = 1548 + ErrEventCannotDelete = 1549 + ErrEventCompile = 1550 + ErrEventSameName = 1551 + ErrEventDataTooLong = 1552 + ErrDropIndexFk = 1553 + ErrWarnDeprecatedSyntaxWithVer = 1554 + ErrCantWriteLockLogTable = 1555 + ErrCantLockLogTable = 1556 + ErrForeignDuplicateKeyOldUnused = 1557 + ErrColCountDoesntMatchPleaseUpdate = 1558 + ErrTempTablePreventsSwitchOutOfRbr = 1559 + ErrStoredFunctionPreventsSwitchBinlogFormat = 1560 + ErrNdbCantSwitchBinlogFormat = 1561 + ErrPartitionNoTemporary = 1562 + ErrPartitionConstDomain = 1563 + ErrPartitionFunctionIsNotAllowed = 1564 + ErrDdlLog = 1565 + ErrNullInValuesLessThan = 1566 + ErrWrongPartitionName = 1567 + ErrCantChangeTxCharacteristics = 1568 + ErrDupEntryAutoincrementCase = 1569 + ErrEventModifyQueue = 1570 + ErrEventSetVar = 1571 + ErrPartitionMerge = 1572 + ErrCantActivateLog = 1573 + ErrRbrNotAvailable = 1574 + ErrBase64Decode = 1575 + ErrEventRecursionForbidden = 1576 + ErrEventsDB = 1577 + ErrOnlyIntegersAllowed = 1578 + ErrUnsuportedLogEngine = 1579 + ErrBadLogStatement = 1580 + ErrCantRenameLogTable = 1581 + ErrWrongParamcountToNativeFct = 1582 + ErrWrongParametersToNativeFct = 1583 + ErrWrongParametersToStoredFct = 1584 + ErrNativeFctNameCollision = 1585 + ErrDupEntryWithKeyName = 1586 + ErrBinlogPurgeEmFile = 1587 + ErrEventCannotCreateInThePast = 1588 + ErrEventCannotAlterInThePast = 1589 + ErrSlaveIncident = 1590 + ErrNoPartitionForGivenValueSilent = 1591 + ErrBinlogUnsafeStatement = 1592 + ErrSlaveFatal = 1593 + ErrSlaveRelayLogReadFailure = 1594 + ErrSlaveRelayLogWriteFailure = 1595 + ErrSlaveCreateEventFailure = 1596 + ErrSlaveMasterComFailure = 1597 + ErrBinlogLoggingImpossible = 1598 + ErrViewNoCreationCtx = 1599 + ErrViewInvalidCreationCtx = 1600 + ErrSrInvalidCreationCtx = 1601 + ErrTrgCorruptedFile = 1602 + ErrTrgNoCreationCtx = 1603 + ErrTrgInvalidCreationCtx = 1604 + ErrEventInvalidCreationCtx = 1605 + ErrTrgCantOpenTable = 1606 + ErrCantCreateSroutine = 1607 + ErrNeverUsed = 1608 + ErrNoFormatDescriptionEventBeforeBinlogStatement = 1609 + ErrSlaveCorruptEvent = 1610 + ErrLoadDataInvalidColumn = 1611 + ErrLogPurgeNoFile = 1612 + ErrXaRbtimeout = 1613 + ErrXaRbdeadlock = 1614 + ErrNeedReprepare = 1615 + ErrDelayedNotSupported = 1616 + WarnNoMasterInfo = 1617 + WarnOptionIgnored = 1618 + WarnPluginDeleteBuiltin = 1619 + WarnPluginBusy = 1620 + ErrVariableIsReadonly = 1621 + ErrWarnEngineTransactionRollback = 1622 + ErrSlaveHeartbeatFailure = 1623 + ErrSlaveHeartbeatValueOutOfRange = 1624 + ErrNdbReplicationSchema = 1625 + ErrConflictFnParse = 1626 + ErrExceptionsWrite = 1627 + ErrTooLongTableComment = 1628 + ErrTooLongFieldComment = 1629 + ErrFuncInexistentNameCollision = 1630 + ErrDatabaseName = 1631 + ErrTableName = 1632 + ErrPartitionName = 1633 + ErrSubpartitionName = 1634 + ErrTemporaryName = 1635 + ErrRenamedName = 1636 + ErrTooManyConcurrentTrxs = 1637 + WarnNonASCIISeparatorNotImplemented = 1638 + ErrDebugSyncTimeout = 1639 + ErrDebugSyncHitLimit = 1640 + ErrDupSignalSet = 1641 + ErrSignalWarn = 1642 + ErrSignalNotFound = 1643 + ErrSignalException = 1644 + ErrResignalWithoutActiveHandler = 1645 + ErrSignalBadConditionType = 1646 + WarnCondItemTruncated = 1647 + ErrCondItemTooLong = 1648 + ErrUnknownLocale = 1649 + ErrSlaveIgnoreServerIds = 1650 + ErrQueryCacheDisabled = 1651 + ErrSameNamePartitionField = 1652 + ErrPartitionColumnList = 1653 + ErrWrongTypeColumnValue = 1654 + ErrTooManyPartitionFuncFields = 1655 + ErrMaxvalueInValuesIn = 1656 + ErrTooManyValues = 1657 + ErrRowSinglePartitionField = 1658 + ErrFieldTypeNotAllowedAsPartitionField = 1659 + ErrPartitionFieldsTooLong = 1660 + ErrBinlogRowEngineAndStmtEngine = 1661 + ErrBinlogRowModeAndStmtEngine = 1662 + ErrBinlogUnsafeAndStmtEngine = 1663 + ErrBinlogRowInjectionAndStmtEngine = 1664 + ErrBinlogStmtModeAndRowEngine = 1665 + ErrBinlogRowInjectionAndStmtMode = 1666 + ErrBinlogMultipleEnginesAndSelfLoggingEngine = 1667 + ErrBinlogUnsafeLimit = 1668 + ErrBinlogUnsafeInsertDelayed = 1669 + ErrBinlogUnsafeSystemTable = 1670 + ErrBinlogUnsafeAutoincColumns = 1671 + ErrBinlogUnsafeUdf = 1672 + ErrBinlogUnsafeSystemVariable = 1673 + ErrBinlogUnsafeSystemFunction = 1674 + ErrBinlogUnsafeNontransAfterTrans = 1675 + ErrMessageAndStatement = 1676 + ErrSlaveConversionFailed = 1677 + ErrSlaveCantCreateConversion = 1678 + ErrInsideTransactionPreventsSwitchBinlogFormat = 1679 + ErrPathLength = 1680 + ErrWarnDeprecatedSyntaxNoReplacement = 1681 + ErrWrongNativeTableStructure = 1682 + ErrWrongPerfSchemaUsage = 1683 + ErrWarnISSkippedTable = 1684 + ErrInsideTransactionPreventsSwitchBinlogDirect = 1685 + ErrStoredFunctionPreventsSwitchBinlogDirect = 1686 + ErrSpatialMustHaveGeomCol = 1687 + ErrTooLongIndexComment = 1688 + ErrLockAborted = 1689 + ErrDataOutOfRange = 1690 + ErrWrongSpvarTypeInLimit = 1691 + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine = 1692 + ErrBinlogUnsafeMixedStatement = 1693 + ErrInsideTransactionPreventsSwitchSQLLogBin = 1694 + ErrStoredFunctionPreventsSwitchSQLLogBin = 1695 + ErrFailedReadFromParFile = 1696 + ErrValuesIsNotIntType = 1697 + ErrAccessDeniedNoPassword = 1698 + ErrSetPasswordAuthPlugin = 1699 + ErrGrantPluginUserExists = 1700 + ErrTruncateIllegalFk = 1701 + ErrPluginIsPermanent = 1702 + ErrSlaveHeartbeatValueOutOfRangeMin = 1703 + ErrSlaveHeartbeatValueOutOfRangeMax = 1704 + ErrStmtCacheFull = 1705 + ErrMultiUpdateKeyConflict = 1706 + ErrTableNeedsRebuild = 1707 + WarnOptionBelowLimit = 1708 + ErrIndexColumnTooLong = 1709 + ErrErrorInTriggerBody = 1710 + ErrErrorInUnknownTriggerBody = 1711 + ErrIndexCorrupt = 1712 + ErrUndoRecordTooBig = 1713 + ErrBinlogUnsafeInsertIgnoreSelect = 1714 + ErrBinlogUnsafeInsertSelectUpdate = 1715 + ErrBinlogUnsafeReplaceSelect = 1716 + ErrBinlogUnsafeCreateIgnoreSelect = 1717 + ErrBinlogUnsafeCreateReplaceSelect = 1718 + ErrBinlogUnsafeUpdateIgnore = 1719 + ErrPluginNoUninstall = 1720 + ErrPluginNoInstall = 1721 + ErrBinlogUnsafeWriteAutoincSelect = 1722 + ErrBinlogUnsafeCreateSelectAutoinc = 1723 + ErrBinlogUnsafeInsertTwoKeys = 1724 + ErrTableInFkCheck = 1725 + ErrUnsupportedEngine = 1726 + ErrBinlogUnsafeAutoincNotFirst = 1727 + ErrCannotLoadFromTableV2 = 1728 + ErrMasterDelayValueOutOfRange = 1729 + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement = 1730 + ErrPartitionExchangeDifferentOption = 1731 + ErrPartitionExchangePartTable = 1732 + ErrPartitionExchangeTempTable = 1733 + ErrPartitionInsteadOfSubpartition = 1734 + ErrUnknownPartition = 1735 + ErrTablesDifferentMetadata = 1736 + ErrRowDoesNotMatchPartition = 1737 + ErrBinlogCacheSizeGreaterThanMax = 1738 + ErrWarnIndexNotApplicable = 1739 + ErrPartitionExchangeForeignKey = 1740 + ErrNoSuchKeyValue = 1741 + ErrRplInfoDataTooLong = 1742 + ErrNetworkReadEventChecksumFailure = 1743 + ErrBinlogReadEventChecksumFailure = 1744 + ErrBinlogStmtCacheSizeGreaterThanMax = 1745 + ErrCantUpdateTableInCreateTableSelect = 1746 + ErrPartitionClauseOnNonpartitioned = 1747 + ErrRowDoesNotMatchGivenPartitionSet = 1748 + ErrNoSuchPartitionunused = 1749 + ErrChangeRplInfoRepositoryFailure = 1750 + ErrWarningNotCompleteRollbackWithCreatedTempTable = 1751 + ErrWarningNotCompleteRollbackWithDroppedTempTable = 1752 + ErrMtsFeatureIsNotSupported = 1753 + ErrMtsUpdatedDBsGreaterMax = 1754 + ErrMtsCantParallel = 1755 + ErrMtsInconsistentData = 1756 + ErrFulltextNotSupportedWithPartitioning = 1757 + ErrDaInvalidConditionNumber = 1758 + ErrInsecurePlainText = 1759 + ErrInsecureChangeMaster = 1760 + ErrForeignDuplicateKeyWithChildInfo = 1761 + ErrForeignDuplicateKeyWithoutChildInfo = 1762 + ErrSQLthreadWithSecureSlave = 1763 + ErrTableHasNoFt = 1764 + ErrVariableNotSettableInSfOrTrigger = 1765 + ErrVariableNotSettableInTransaction = 1766 + ErrGtidNextIsNotInGtidNextList = 1767 + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull = 1768 + ErrSetStatementCannotInvokeFunction = 1769 + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull = 1770 + ErrSkippingLoggedTransaction = 1771 + ErrMalformedGtidSetSpecification = 1772 + ErrMalformedGtidSetEncoding = 1773 + ErrMalformedGtidSpecification = 1774 + ErrGnoExhausted = 1775 + ErrBadSlaveAutoPosition = 1776 + ErrAutoPositionRequiresGtidModeOn = 1777 + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet = 1778 + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn = 1779 + ErrGtidModeRequiresBinlog = 1780 + ErrCantSetGtidNextToGtidWhenGtidModeIsOff = 1781 + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn = 1782 + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff = 1783 + ErrFoundGtidEventWhenGtidModeIsOff = 1784 + ErrGtidUnsafeNonTransactionalTable = 1785 + ErrGtidUnsafeCreateSelect = 1786 + ErrGtidUnsafeCreateDropTemporaryTableInTransaction = 1787 + ErrGtidModeCanOnlyChangeOneStepAtATime = 1788 + ErrMasterHasPurgedRequiredGtids = 1789 + ErrCantSetGtidNextWhenOwningGtid = 1790 + ErrUnknownExplainFormat = 1791 + ErrCantExecuteInReadOnlyTransaction = 1792 + ErrTooLongTablePartitionComment = 1793 + ErrSlaveConfiguration = 1794 + ErrInnodbFtLimit = 1795 + ErrInnodbNoFtTempTable = 1796 + ErrInnodbFtWrongDocidColumn = 1797 + ErrInnodbFtWrongDocidIndex = 1798 + ErrInnodbOnlineLogTooBig = 1799 + ErrUnknownAlterAlgorithm = 1800 + ErrUnknownAlterLock = 1801 + ErrMtsChangeMasterCantRunWithGaps = 1802 + ErrMtsRecoveryFailure = 1803 + ErrMtsResetWorkers = 1804 + ErrColCountDoesntMatchCorruptedV2 = 1805 + ErrSlaveSilentRetryTransaction = 1806 + ErrDiscardFkChecksRunning = 1807 + ErrTableSchemaMismatch = 1808 + ErrTableInSystemTablespace = 1809 + ErrIoRead = 1810 + ErrIoWrite = 1811 + ErrTablespaceMissing = 1812 + ErrTablespaceExists = 1813 + ErrTablespaceDiscarded = 1814 + ErrInternal = 1815 + ErrInnodbImport = 1816 + ErrInnodbIndexCorrupt = 1817 + ErrInvalidYearColumnLength = 1818 + ErrNotValidPassword = 1819 + ErrMustChangePassword = 1820 + ErrFkNoIndexChild = 1821 + ErrFkNoIndexParent = 1822 + ErrFkFailAddSystem = 1823 + ErrFkCannotOpenParent = 1824 + ErrFkIncorrectOption = 1825 + ErrFkDupName = 1826 + ErrPasswordFormat = 1827 + ErrFkColumnCannotDrop = 1828 + ErrFkColumnCannotDropChild = 1829 + ErrFkColumnNotNull = 1830 + ErrDupIndex = 1831 + ErrFkColumnCannotChange = 1832 + ErrFkColumnCannotChangeChild = 1833 + ErrFkCannotDeleteParent = 1834 + ErrMalformedPacket = 1835 + ErrReadOnlyMode = 1836 + ErrGtidNextTypeUndefinedGroup = 1837 + ErrVariableNotSettableInSp = 1838 + ErrCantSetGtidPurgedWhenGtidModeIsOff = 1839 + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty = 1840 + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty = 1841 + ErrGtidPurgedWasChanged = 1842 + ErrGtidExecutedWasChanged = 1843 + ErrBinlogStmtModeAndNoReplTables = 1844 + ErrAlterOperationNotSupported = 1845 + ErrAlterOperationNotSupportedReason = 1846 + ErrAlterOperationNotSupportedReasonCopy = 1847 + ErrAlterOperationNotSupportedReasonPartition = 1848 + ErrAlterOperationNotSupportedReasonFkRename = 1849 + ErrAlterOperationNotSupportedReasonColumnType = 1850 + ErrAlterOperationNotSupportedReasonFkCheck = 1851 + ErrAlterOperationNotSupportedReasonIgnore = 1852 + ErrAlterOperationNotSupportedReasonNopk = 1853 + ErrAlterOperationNotSupportedReasonAutoinc = 1854 + ErrAlterOperationNotSupportedReasonHiddenFts = 1855 + ErrAlterOperationNotSupportedReasonChangeFts = 1856 + ErrAlterOperationNotSupportedReasonFts = 1857 + ErrSQLSlaveSkipCounterNotSettableInGtidMode = 1858 + ErrDupUnknownInIndex = 1859 + ErrIdentCausesTooLongPath = 1860 + ErrAlterOperationNotSupportedReasonNotNull = 1861 + ErrMustChangePasswordLogin = 1862 + ErrRowInWrongPartition = 1863 + ErrErrorLast = 1863 + ErrMaxExecTimeExceeded = 1907 + ErrInvalidFieldSize = 3013 + ErrIncorrectType = 3064 + ErrInvalidJSONData = 3069 + ErrGeneratedColumnFunctionIsNotAllowed = 3102 + ErrUnsupportedAlterInplaceOnVirtualColumn = 3103 + ErrWrongFKOptionForGeneratedColumn = 3104 + ErrBadGeneratedColumn = 3105 + ErrUnsupportedOnGeneratedColumn = 3106 + ErrGeneratedColumnNonPrior = 3107 + ErrDependentByGeneratedColumn = 3108 + ErrGeneratedColumnRefAutoInc = 3109 + ErrInvalidJSONText = 3140 + ErrInvalidJSONPath = 3143 + ErrInvalidTypeForJSON = 3146 + ErrInvalidJSONPathWildcard = 3149 + ErrInvalidJSONContainsPathType = 3150 + ErrJSONUsedAsKey = 3152 + ErrJSONDocumentNULLKey = 3158 + ErrBadUser = 3162 + ErrUserAlreadyExists = 3163 + ErrInvalidJSONPathArrayCell = 3165 + ErrInvalidEncryptionOption = 3184 + ErrRoleNotGranted = 3530 + ErrLockAcquireFailAndNoWaitSet = 3572 + ErrWindowNoSuchWindow = 3579 + ErrWindowCircularityInWindowGraph = 3580 + ErrWindowNoChildPartitioning = 3581 + ErrWindowNoInherentFrame = 3582 + ErrWindowNoRedefineOrderBy = 3583 + ErrWindowFrameStartIllegal = 3584 + ErrWindowFrameEndIllegal = 3585 + ErrWindowFrameIllegal = 3586 + ErrWindowRangeFrameOrderType = 3587 + ErrWindowRangeFrameTemporalType = 3588 + ErrWindowRangeFrameNumericType = 3589 + ErrWindowRangeBoundNotConstant = 3590 + ErrWindowDuplicateName = 3591 + ErrWindowIllegalOrderBy = 3592 + ErrWindowInvalidWindowFuncUse = 3593 + ErrWindowInvalidWindowFuncAliasUse = 3594 + ErrWindowNestedWindowFuncUseInWindowSpec = 3595 + ErrWindowRowsIntervalUse = 3596 + ErrWindowNoGroupOrderUnused = 3597 + ErrWindowExplainJson = 3598 + ErrWindowFunctionIgnoresFrame = 3599 + ErrDataTruncatedFunctionalIndex = 3751 + ErrDataOutOfRangeFunctionalIndex = 3752 + ErrFunctionalIndexOnJsonOrGeometryFunction = 3753 + ErrFunctionalIndexRefAutoIncrement = 3754 + ErrCannotDropColumnFunctionalIndex = 3755 + ErrFunctionalIndexPrimaryKey = 3756 + ErrFunctionalIndexOnLob = 3757 + ErrFunctionalIndexFunctionIsNotAllowed = 3758 + ErrFulltextFunctionalIndex = 3759 + ErrSpatialFunctionalIndex = 3760 + ErrWrongKeyColumnFunctionalIndex = 3761 + ErrFunctionalIndexOnField = 3762 + ErrFKIncompatibleColumns = 3780 + ErrFunctionalIndexRowValueIsNotAllowed = 3800 + ErrDependentByFunctionalIndex = 3837 + ErrInvalidJsonValueForFuncIndex = 3903 + ErrJsonValueOutOfRangeForFuncIndex = 3904 + ErrFunctionalIndexDataIsTooLong = 3907 + ErrFunctionalIndexNotApplicable = 3909 + + // MariaDB errors. + ErrOnlyOneDefaultPartionAllowed = 4030 + ErrWrongPartitionTypeExpectedSystemTime = 4113 + ErrSystemVersioningWrongPartitions = 4128 + ErrSequenceRunOut = 4135 + ErrSequenceInvalidData = 4136 + ErrSequenceAccessFail = 4137 + ErrNotSequence = 4138 + ErrUnknownSequence = 4139 + ErrWrongInsertIntoSequence = 4140 + ErrSequenceInvalidTableStructure = 4141 + + // TiDB self-defined errors. + ErrWarnOptimizerHintUnsupportedHint = 8061 + ErrWarnOptimizerHintInvalidToken = 8062 + ErrWarnMemoryQuotaOverflow = 8063 + ErrWarnOptimizerHintParseError = 8064 + ErrWarnOptimizerHintInvalidInteger = 8065 + + // Stop adding error code here! + // They are moved to github.com/pingcap/tidb/errno +) diff --git a/parser/mysql/errname.go b/parser/mysql/errname.go new file mode 100644 index 000000000..3cb38f927 --- /dev/null +++ b/parser/mysql/errname.go @@ -0,0 +1,976 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +type ErrMessage struct { + Raw string + RedactArgPos []int +} + +// Message creates a error message with the format specifier. +func Message(message string, redactArgs []int) *ErrMessage { + return &ErrMessage{Raw: message, RedactArgPos: redactArgs} +} + +// MySQLErrName maps error code to MySQL error messages. +var MySQLErrName = map[uint16]*ErrMessage{ + ErrHashchk: Message("hashchk", nil), + ErrNisamchk: Message("isamchk", nil), + ErrNo: Message("NO", nil), + ErrYes: Message("YES", nil), + ErrCantCreateFile: Message("Can't create file '%-.200s' (errno: %d - %s)", nil), + ErrCantCreateTable: Message("Can't create table '%-.200s' (errno: %d)", nil), + ErrCantCreateDB: Message("Can't create database '%-.192s' (errno: %d)", nil), + ErrDBCreateExists: Message("Can't create database '%-.192s'; database exists", nil), + ErrDBDropExists: Message("Can't drop database '%-.192s'; database doesn't exist", nil), + ErrDBDropDelete: Message("Error dropping database (can't delete '%-.192s', errno: %d)", nil), + ErrDBDropRmdir: Message("Error dropping database (can't rmdir '%-.192s', errno: %d)", nil), + ErrCantDeleteFile: Message("Error on delete of '%-.192s' (errno: %d - %s)", nil), + ErrCantFindSystemRec: Message("Can't read record in system table", nil), + ErrCantGetStat: Message("Can't get status of '%-.200s' (errno: %d - %s)", nil), + ErrCantGetWd: Message("Can't get working directory (errno: %d - %s)", nil), + ErrCantLock: Message("Can't lock file (errno: %d - %s)", nil), + ErrCantOpenFile: Message("Can't open file: '%-.200s' (errno: %d - %s)", nil), + ErrFileNotFound: Message("Can't find file: '%-.200s' (errno: %d - %s)", nil), + ErrCantReadDir: Message("Can't read dir of '%-.192s' (errno: %d - %s)", nil), + ErrCantSetWd: Message("Can't change dir to '%-.192s' (errno: %d - %s)", nil), + ErrCheckread: Message("Record has changed since last read in table '%-.192s'", nil), + ErrDiskFull: Message("Disk full (%s); waiting for someone to free some space... (errno: %d - %s)", nil), + ErrDupKey: Message("Can't write; duplicate key in table '%-.192s'", nil), + ErrErrorOnClose: Message("Error on close of '%-.192s' (errno: %d - %s)", nil), + ErrErrorOnRead: Message("Error reading file '%-.200s' (errno: %d - %s)", nil), + ErrErrorOnRename: Message("Error on rename of '%-.210s' to '%-.210s' (errno: %d - %s)", nil), + ErrErrorOnWrite: Message("Error writing file '%-.200s' (errno: %d - %s)", nil), + ErrFileUsed: Message("'%-.192s' is locked against change", nil), + ErrFilsortAbort: Message("Sort aborted", nil), + ErrFormNotFound: Message("View '%-.192s' doesn't exist for '%-.192s'", nil), + ErrGetErrno: Message("Got error %d from storage engine", nil), + ErrIllegalHa: Message("Table storage engine for '%-.192s' doesn't have this option", nil), + ErrKeyNotFound: Message("Can't find record in '%-.192s'", nil), + ErrNotFormFile: Message("Incorrect information in file: '%-.200s'", nil), + ErrNotKeyFile: Message("Incorrect key file for table '%-.200s'; try to repair it", nil), + ErrOldKeyFile: Message("Old key file for table '%-.192s'; repair it!", nil), + ErrOpenAsReadonly: Message("Table '%-.192s' is read only", nil), + ErrOutofMemory: Message("Out of memory; restart server and try again (needed %d bytes)", nil), + ErrOutOfSortMemory: Message("Out of sort memory, consider increasing server sort buffer size", nil), + ErrUnexpectedEOF: Message("Unexpected EOF found when reading file '%-.192s' (errno: %d - %s)", nil), + ErrConCount: Message("Too many connections", nil), + ErrOutOfResources: Message("Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space", nil), + ErrBadHost: Message("Can't get hostname for your address", nil), + ErrHandshake: Message("Bad handshake", nil), + ErrDBaccessDenied: Message("Access denied for user '%-.48s'@'%-.64s' to database '%-.192s'", nil), + ErrAccessDenied: Message("Access denied for user '%-.48s'@'%-.64s' (using password: %s)", nil), + ErrNoDB: Message("No database selected", nil), + ErrUnknownCom: Message("Unknown command", nil), + ErrBadNull: Message("Column '%-.192s' cannot be null", nil), + ErrBadDB: Message("Unknown database '%-.192s'", nil), + ErrTableExists: Message("Table '%-.192s' already exists", nil), + ErrBadTable: Message("Unknown table '%-.100s'", nil), + ErrNonUniq: Message("Column '%-.192s' in %-.192s is ambiguous", nil), + ErrServerShutdown: Message("Server shutdown in progress", nil), + ErrBadField: Message("Unknown column '%-.192s' in '%-.192s'", nil), + ErrFieldNotInGroupBy: Message("Expression #%d of %s is not in GROUP BY clause and contains nonaggregated column '%s' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by", nil), + ErrWrongGroupField: Message("Can't group on '%-.192s'", nil), + ErrWrongSumSelect: Message("Statement has sum functions and columns in same statement", nil), + ErrWrongValueCount: Message("Column count doesn't match value count", nil), + ErrTooLongIdent: Message("Identifier name '%-.100s' is too long", nil), + ErrDupFieldName: Message("Duplicate column name '%-.192s'", nil), + ErrDupKeyName: Message("Duplicate key name '%-.192s'", nil), + ErrDupEntry: Message("Duplicate entry '%-.64s' for key '%-.192s'", nil), + ErrWrongFieldSpec: Message("Incorrect column specifier for column '%-.192s'", nil), + ErrParse: Message("%s %s", nil), + ErrEmptyQuery: Message("Query was empty", nil), + ErrNonuniqTable: Message("Not unique table/alias: '%-.192s'", nil), + ErrInvalidDefault: Message("Invalid default value for '%-.192s'", nil), + ErrMultiplePriKey: Message("Multiple primary key defined", nil), + ErrTooManyKeys: Message("Too many keys specified; max %d keys allowed", nil), + ErrTooManyKeyParts: Message("Too many key parts specified; max %d parts allowed", nil), + ErrTooLongKey: Message("Specified key was too long; max key length is %d bytes", nil), + ErrKeyColumnDoesNotExits: Message("Key column '%-.192s' doesn't exist in table", nil), + ErrBlobUsedAsKey: Message("BLOB column '%-.192s' can't be used in key specification with the used table type", nil), + ErrTooBigFieldlength: Message("Column length too big for column '%-.192s' (max = %d); use BLOB or TEXT instead", nil), + ErrWrongAutoKey: Message("Incorrect table definition; there can be only one auto column and it must be defined as a key", nil), + ErrReady: Message("%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d", nil), + ErrNormalShutdown: Message("%s: Normal shutdown\n", nil), + ErrGotSignal: Message("%s: Got signal %d. Aborting!\n", nil), + ErrShutdownComplete: Message("%s: Shutdown complete\n", nil), + ErrForcingClose: Message("%s: Forcing close of thread %d user: '%-.48s'\n", nil), + ErrIpsock: Message("Can't create IP socket", nil), + ErrNoSuchIndex: Message("Table '%-.192s' has no index like the one used in CREATE INDEX; recreate the table", nil), + ErrWrongFieldTerminators: Message("Field separator argument is not what is expected; check the manual", nil), + ErrBlobsAndNoTerminated: Message("You can't use fixed rowlength with BLOBs; please use 'fields terminated by'", nil), + ErrTextFileNotReadable: Message("The file '%-.128s' must be in the database directory or be readable by all", nil), + ErrFileExists: Message("File '%-.200s' already exists", nil), + ErrLoadInfo: Message("Records: %d Deleted: %d Skipped: %d Warnings: %d", nil), + ErrAlterInfo: Message("Records: %d Duplicates: %d", nil), + ErrWrongSubKey: Message("Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys", nil), + ErrCantRemoveAllFields: Message("You can't delete all columns with ALTER TABLE; use DROP TABLE instead", nil), + ErrCantDropFieldOrKey: Message("Can't DROP '%-.192s'; check that column/key exists", nil), + ErrInsertInfo: Message("Records: %d Duplicates: %d Warnings: %d", nil), + ErrUpdateTableUsed: Message("You can't specify target table '%-.192s' for update in FROM clause", nil), + ErrNoSuchThread: Message("Unknown thread id: %d", nil), + ErrKillDenied: Message("You are not owner of thread %d", nil), + ErrNoTablesUsed: Message("No tables used", nil), + ErrTooBigSet: Message("Too many strings for column %-.192s and SET", nil), + ErrNoUniqueLogFile: Message("Can't generate a unique log-filename %-.200s.(1-999)\n", nil), + ErrTableNotLockedForWrite: Message("Table '%-.192s' was locked with a READ lock and can't be updated", nil), + ErrTableNotLocked: Message("Table '%-.192s' was not locked with LOCK TABLES", nil), + ErrBlobCantHaveDefault: Message("BLOB/TEXT/JSON column '%-.192s' can't have a default value", nil), + ErrWrongDBName: Message("Incorrect database name '%-.100s'", nil), + ErrWrongTableName: Message("Incorrect table name '%-.100s'", nil), + ErrTooBigSelect: Message("The SELECT would examine more than MAXJOINSIZE rows; check your WHERE and use SET SQLBIGSELECTS=1 or SET MAXJOINSIZE=# if the SELECT is okay", nil), + ErrUnknown: Message("Unknown error", nil), + ErrUnknownProcedure: Message("Unknown procedure '%-.192s'", nil), + ErrWrongParamcountToProcedure: Message("Incorrect parameter count to procedure '%-.192s'", nil), + ErrWrongParametersToProcedure: Message("Incorrect parameters to procedure '%-.192s'", nil), + ErrUnknownTable: Message("Unknown table '%-.192s' in %-.32s", nil), + ErrFieldSpecifiedTwice: Message("Column '%-.192s' specified twice", nil), + ErrInvalidGroupFuncUse: Message("Invalid use of group function", nil), + ErrUnsupportedExtension: Message("Table '%-.192s' uses an extension that doesn't exist in this MySQL version", nil), + ErrTableMustHaveColumns: Message("A table must have at least 1 column", nil), + ErrRecordFileFull: Message("The table '%-.192s' is full", nil), + ErrUnknownCharacterSet: Message("Unknown character set: '%-.64s'", nil), + ErrTooManyTables: Message("Too many tables; MySQL can only use %d tables in a join", nil), + ErrTooManyFields: Message("Too many columns", nil), + ErrTooBigRowsize: Message("Row size too large. The maximum row size for the used table type, not counting BLOBs, is %d. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", nil), + ErrStackOverrun: Message("Thread stack overrun: Used: %d of a %d stack. Use 'mysqld --threadStack=#' to specify a bigger stack if needed", nil), + ErrWrongOuterJoin: Message("Cross dependency found in OUTER JOIN; examine your ON conditions", nil), + ErrNullColumnInIndex: Message("Table handler doesn't support NULL in given index. Please change column '%-.192s' to be NOT NULL or use another handler", nil), + ErrCantFindUdf: Message("Can't load function '%-.192s'", nil), + ErrCantInitializeUdf: Message("Can't initialize function '%-.192s'; %-.80s", nil), + ErrUdfNoPaths: Message("No paths allowed for shared library", nil), + ErrUdfExists: Message("Function '%-.192s' already exists", nil), + ErrCantOpenLibrary: Message("Can't open shared library '%-.192s' (errno: %d %-.128s)", nil), + ErrCantFindDlEntry: Message("Can't find symbol '%-.128s' in library", nil), + ErrFunctionNotDefined: Message("Function '%-.192s' is not defined", nil), + ErrHostIsBlocked: Message("Host '%-.64s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'", nil), + ErrHostNotPrivileged: Message("Host '%-.64s' is not allowed to connect to this MySQL server", nil), + ErrPasswordAnonymousUser: Message("You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords", nil), + ErrPasswordNotAllowed: Message("You must have privileges to update tables in the mysql database to be able to change passwords for others", nil), + ErrPasswordNoMatch: Message("Can't find any matching row in the user table", nil), + ErrUpdateInfo: Message("Rows matched: %d Changed: %d Warnings: %d", nil), + ErrCantCreateThread: Message("Can't create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug", nil), + ErrWrongValueCountOnRow: Message("Column count doesn't match value count at row %d", nil), + ErrCantReopenTable: Message("Can't reopen table: '%-.192s'", nil), + ErrInvalidUseOfNull: Message("Invalid use of NULL value", nil), + ErrRegexp: Message("Got error '%-.64s' from regexp", nil), + ErrMixOfGroupFuncAndFields: Message("Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause", nil), + ErrNonexistingGrant: Message("There is no such grant defined for user '%-.48s' on host '%-.64s'", nil), + ErrTableaccessDenied: Message("%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s'", nil), + ErrColumnaccessDenied: Message("%-.16s command denied to user '%-.48s'@'%-.64s' for column '%-.192s' in table '%-.192s'", nil), + ErrIllegalGrantForTable: Message("Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used", nil), + ErrGrantWrongHostOrUser: Message("The host or user argument to GRANT is too long", nil), + ErrNoSuchTable: Message("Table '%-.192s.%-.192s' doesn't exist", nil), + ErrNonexistingTableGrant: Message("There is no such grant defined for user '%-.48s' on host '%-.64s' on table '%-.192s'", nil), + ErrNotAllowedCommand: Message("The used command is not allowed with this MySQL version", nil), + ErrSyntax: Message("You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use", nil), + ErrDelayedCantChangeLock: Message("Delayed insert thread couldn't get requested lock for table %-.192s", nil), + ErrTooManyDelayedThreads: Message("Too many delayed threads in use", nil), + ErrAbortingConnection: Message("Aborted connection %d to db: '%-.192s' user: '%-.48s' (%-.64s)", nil), + ErrNetPacketTooLarge: Message("Got a packet bigger than 'maxAllowedPacket' bytes", nil), + ErrNetReadErrorFromPipe: Message("Got a read error from the connection pipe", nil), + ErrNetFcntl: Message("Got an error from fcntl()", nil), + ErrNetPacketsOutOfOrder: Message("Got packets out of order", nil), + ErrNetUncompress: Message("Couldn't uncompress communication packet", nil), + ErrNetRead: Message("Got an error reading communication packets", nil), + ErrNetReadInterrupted: Message("Got timeout reading communication packets", nil), + ErrNetErrorOnWrite: Message("Got an error writing communication packets", nil), + ErrNetWriteInterrupted: Message("Got timeout writing communication packets", nil), + ErrTooLongString: Message("Result string is longer than 'maxAllowedPacket' bytes", nil), + ErrTableCantHandleBlob: Message("The used table type doesn't support BLOB/TEXT columns", nil), + ErrTableCantHandleAutoIncrement: Message("The used table type doesn't support AUTOINCREMENT columns", nil), + ErrDelayedInsertTableLocked: Message("INSERT DELAYED can't be used with table '%-.192s' because it is locked with LOCK TABLES", nil), + ErrWrongColumnName: Message("Incorrect column name '%-.100s'", nil), + ErrWrongKeyColumn: Message("The used storage engine can't index column '%-.192s'", nil), + ErrWrongMrgTable: Message("Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist", nil), + ErrDupUnique: Message("Can't write, because of unique constraint, to table '%-.192s'", nil), + ErrBlobKeyWithoutLength: Message("BLOB/TEXT column '%-.192s' used in key specification without a key length", nil), + ErrPrimaryCantHaveNull: Message("All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead", nil), + ErrTooManyRows: Message("Result consisted of more than one row", nil), + ErrRequiresPrimaryKey: Message("This table type requires a primary key", nil), + ErrNoRaidCompiled: Message("This version of MySQL is not compiled with RAID support", nil), + ErrUpdateWithoutKeyInSafeMode: Message("You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", nil), + ErrKeyDoesNotExist: Message("Key '%-.192s' doesn't exist in table '%-.192s'", nil), + ErrCheckNoSuchTable: Message("Can't open table", nil), + ErrCheckNotImplemented: Message("The storage engine for the table doesn't support %s", nil), + ErrCantDoThisDuringAnTransaction: Message("You are not allowed to execute this command in a transaction", nil), + ErrErrorDuringCommit: Message("Got error %d during COMMIT", nil), + ErrErrorDuringRollback: Message("Got error %d during ROLLBACK", nil), + ErrErrorDuringFlushLogs: Message("Got error %d during FLUSHLOGS", nil), + ErrErrorDuringCheckpoint: Message("Got error %d during CHECKPOINT", nil), + ErrNewAbortingConnection: Message("Aborted connection %d to db: '%-.192s' user: '%-.48s' host: '%-.64s' (%-.64s)", nil), + ErrDumpNotImplemented: Message("The storage engine for the table does not support binary table dump", nil), + ErrFlushMasterBinlogClosed: Message("Binlog closed, cannot RESET MASTER", nil), + ErrIndexRebuild: Message("Failed rebuilding the index of dumped table '%-.192s'", nil), + ErrMaster: Message("Error from master: '%-.64s'", nil), + ErrMasterNetRead: Message("Net error reading from master", nil), + ErrMasterNetWrite: Message("Net error writing to master", nil), + ErrFtMatchingKeyNotFound: Message("Can't find FULLTEXT index matching the column list", nil), + ErrLockOrActiveTransaction: Message("Can't execute the given command because you have active locked tables or an active transaction", nil), + ErrUnknownSystemVariable: Message("Unknown system variable '%-.64s'", nil), + ErrCrashedOnUsage: Message("Table '%-.192s' is marked as crashed and should be repaired", nil), + ErrCrashedOnRepair: Message("Table '%-.192s' is marked as crashed and last (automatic?) repair failed", nil), + ErrWarningNotCompleteRollback: Message("Some non-transactional changed tables couldn't be rolled back", nil), + ErrTransCacheFull: Message("Multi-statement transaction required more than 'maxBinlogCacheSize' bytes of storage; increase this mysqld variable and try again", nil), + ErrSlaveMustStop: Message("This operation cannot be performed with a running slave; run STOP SLAVE first", nil), + ErrSlaveNotRunning: Message("This operation requires a running slave; configure slave and do START SLAVE", nil), + ErrBadSlave: Message("The server is not configured as slave; fix in config file or with CHANGE MASTER TO", nil), + ErrMasterInfo: Message("Could not initialize master info structure; more error messages can be found in the MySQL error log", nil), + ErrSlaveThread: Message("Could not create slave thread; check system resources", nil), + ErrTooManyUserConnections: Message("User %-.64s already has more than 'maxUserConnections' active connections", nil), + ErrSetConstantsOnly: Message("You may only use constant expressions with SET", nil), + ErrLockWaitTimeout: Message("Lock wait timeout exceeded; try restarting transaction", nil), + ErrLockTableFull: Message("The total number of locks exceeds the lock table size", nil), + ErrReadOnlyTransaction: Message("Update locks cannot be acquired during a READ UNCOMMITTED transaction", nil), + ErrDropDBWithReadLock: Message("DROP DATABASE not allowed while thread is holding global read lock", nil), + ErrCreateDBWithReadLock: Message("CREATE DATABASE not allowed while thread is holding global read lock", nil), + ErrWrongArguments: Message("Incorrect arguments to %s", nil), + ErrNoPermissionToCreateUser: Message("'%-.48s'@'%-.64s' is not allowed to create new users", nil), + ErrUnionTablesInDifferentDir: Message("Incorrect table definition; all MERGE tables must be in the same database", nil), + ErrLockDeadlock: Message("Deadlock found when trying to get lock; try restarting transaction", nil), + ErrTableCantHandleFt: Message("The used table type doesn't support FULLTEXT indexes", nil), + ErrCannotAddForeign: Message("Cannot add foreign key constraint", nil), + ErrNoReferencedRow: Message("Cannot add or update a child row: a foreign key constraint fails", nil), + ErrRowIsReferenced: Message("Cannot delete or update a parent row: a foreign key constraint fails", nil), + ErrConnectToMaster: Message("Error connecting to master: %-.128s", nil), + ErrQueryOnMaster: Message("Error running query on master: %-.128s", nil), + ErrErrorWhenExecutingCommand: Message("Error when executing command %s: %-.128s", nil), + ErrWrongUsage: Message("Incorrect usage of %s and %s", nil), + ErrWrongNumberOfColumnsInSelect: Message("The used SELECT statements have a different number of columns", nil), + ErrCantUpdateWithReadlock: Message("Can't execute the query because you have a conflicting read lock", nil), + ErrMixingNotAllowed: Message("Mixing of transactional and non-transactional tables is disabled", nil), + ErrDupArgument: Message("Option '%s' used twice in statement", nil), + ErrUserLimitReached: Message("User '%-.64s' has exceeded the '%s' resource (current value: %d)", nil), + ErrSpecificAccessDenied: Message("Access denied; you need (at least one of) the %-.128s privilege(s) for this operation", nil), + ErrLocalVariable: Message("Variable '%-.64s' is a SESSION variable and can't be used with SET GLOBAL", nil), + ErrGlobalVariable: Message("Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", nil), + ErrNoDefault: Message("Variable '%-.64s' doesn't have a default value", nil), + ErrWrongValueForVar: Message("Variable '%-.64s' can't be set to the value of '%-.200s'", nil), + ErrWrongTypeForVar: Message("Incorrect argument type to variable '%-.64s'", nil), + ErrVarCantBeRead: Message("Variable '%-.64s' can only be set, not read", nil), + ErrCantUseOptionHere: Message("Incorrect usage/placement of '%s'", nil), + ErrNotSupportedYet: Message("This version of TiDB doesn't yet support '%s'", nil), + ErrMasterFatalErrorReadingBinlog: Message("Got fatal error %d from master when reading data from binary log: '%-.320s'", nil), + ErrSlaveIgnoredTable: Message("Slave SQL thread ignored the query because of replicate-*-table rules", nil), + ErrIncorrectGlobalLocalVar: Message("Variable '%-.192s' is a %s variable", nil), + ErrWrongFkDef: Message("Incorrect foreign key definition for '%-.192s': %s", nil), + ErrKeyRefDoNotMatchTableRef: Message("Key reference and table reference don't match", nil), + ErrOperandColumns: Message("Operand should contain %d column(s)", nil), + ErrSubqueryNo1Row: Message("Subquery returns more than 1 row", nil), + ErrUnknownStmtHandler: Message("Unknown prepared statement handler (%.*s) given to %s", nil), + ErrCorruptHelpDB: Message("Help database is corrupt or does not exist", nil), + ErrCyclicReference: Message("Cyclic reference on subqueries", nil), + ErrAutoConvert: Message("Converting column '%s' from %s to %s", nil), + ErrIllegalReference: Message("Reference '%-.64s' not supported (%s)", nil), + ErrDerivedMustHaveAlias: Message("Every derived table must have its own alias", nil), + ErrSelectReduced: Message("Select %d was reduced during optimization", nil), + ErrTablenameNotAllowedHere: Message("Table '%s' from one of the %ss cannot be used in %s", nil), + ErrNotSupportedAuthMode: Message("Client does not support authentication protocol requested by server; consider upgrading MySQL client", nil), + ErrSpatialCantHaveNull: Message("All parts of a SPATIAL index must be NOT NULL", nil), + ErrCollationCharsetMismatch: Message("COLLATION '%s' is not valid for CHARACTER SET '%s'", nil), + ErrSlaveWasRunning: Message("Slave is already running", nil), + ErrSlaveWasNotRunning: Message("Slave already has been stopped", nil), + ErrTooBigForUncompress: Message("Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)", nil), + ErrZlibZMem: Message("ZLIB: Not enough memory", nil), + ErrZlibZBuf: Message("ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)", nil), + ErrZlibZData: Message("ZLIB: Input data corrupted", nil), + ErrCutValueGroupConcat: Message("Some rows were cut by GROUPCONCAT(%s)", nil), + ErrWarnTooFewRecords: Message("Row %d doesn't contain data for all columns", nil), + ErrWarnTooManyRecords: Message("Row %d was truncated; it contained more data than there were input columns", nil), + ErrWarnNullToNotnull: Message("Column set to default value; NULL supplied to NOT NULL column '%s' at row %d", nil), + ErrWarnDataOutOfRange: Message("Out of range value for column '%s' at row %d", nil), + WarnDataTruncated: Message("Data truncated for column '%s' at row %d", nil), + ErrWarnUsingOtherHandler: Message("Using storage engine %s for table '%s'", nil), + ErrCantAggregate2collations: Message("Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", nil), + ErrDropUser: Message("Cannot drop one or more of the requested users", nil), + ErrRevokeGrants: Message("Can't revoke all privileges for one or more of the requested users", nil), + ErrCantAggregate3collations: Message("Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", nil), + ErrCantAggregateNcollations: Message("Illegal mix of collations for operation '%s'", nil), + ErrVariableIsNotStruct: Message("Variable '%-.64s' is not a variable component (can't be used as XXXX.variableName)", nil), + ErrUnknownCollation: Message("Unknown collation: '%-.64s'", nil), + ErrSlaveIgnoredSslParams: Message("SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later if MySQL slave with SSL is started", nil), + ErrServerIsInSecureAuthMode: Message("Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format", nil), + ErrWarnFieldResolved: Message("Field or reference '%-.192s%s%-.192s%s%-.192s' of SELECT #%d was resolved in SELECT #%d", nil), + ErrBadSlaveUntilCond: Message("Incorrect parameter or combination of parameters for START SLAVE UNTIL", nil), + ErrMissingSkipSlave: Message("It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart", nil), + ErrUntilCondIgnored: Message("SQL thread is not to be started so UNTIL options are ignored", nil), + ErrWrongNameForIndex: Message("Incorrect index name '%-.100s'", nil), + ErrWrongNameForCatalog: Message("Incorrect catalog name '%-.100s'", nil), + ErrWarnQcResize: Message("Query cache failed to set size %d; new query cache size is %d", nil), + ErrBadFtColumn: Message("Column '%-.192s' cannot be part of FULLTEXT index", nil), + ErrUnknownKeyCache: Message("Unknown key cache '%-.100s'", nil), + ErrWarnHostnameWontWork: Message("MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work", nil), + ErrUnknownStorageEngine: Message("Unknown storage engine '%s'", nil), + ErrWarnDeprecatedSyntax: Message("'%s' is deprecated and will be removed in a future release. Please use %s instead", nil), + ErrNonUpdatableTable: Message("The target table %-.100s of the %s is not updatable", nil), + ErrFeatureDisabled: Message("The '%s' feature is disabled; you need MySQL built with '%s' to have it working", nil), + ErrOptionPreventsStatement: Message("The MySQL server is running with the %s option so it cannot execute this statement", nil), + ErrDuplicatedValueInType: Message("Column '%-.100s' has duplicated value '%-.64s' in %s", nil), + ErrTruncatedWrongValue: Message("Truncated incorrect %-.64s value: '%-.128s'", nil), + ErrTooMuchAutoTimestampCols: Message("Incorrect table definition; there can be only one TIMESTAMP column with CURRENTTIMESTAMP in DEFAULT or ON UPDATE clause", nil), + ErrInvalidOnUpdate: Message("Invalid ON UPDATE clause for '%-.192s' column", nil), + ErrUnsupportedPs: Message("This command is not supported in the prepared statement protocol yet", nil), + ErrGetErrmsg: Message("Got error %d '%-.100s' from %s", nil), + ErrGetTemporaryErrmsg: Message("Got temporary error %d '%-.100s' from %s", nil), + ErrUnknownTimeZone: Message("Unknown or incorrect time zone: '%-.64s'", nil), + ErrWarnInvalidTimestamp: Message("Invalid TIMESTAMP value in column '%s' at row %d", nil), + ErrInvalidCharacterString: Message("Invalid %s character string: '%.64s'", nil), + ErrWarnAllowedPacketOverflowed: Message("Result of %s() was larger than max_allowed_packet (%d) - truncated", nil), + ErrConflictingDeclarations: Message("Conflicting declarations: '%s%s' and '%s%s'", nil), + ErrSpNoRecursiveCreate: Message("Can't create a %s from within another stored routine", nil), + ErrSpAlreadyExists: Message("%s %s already exists", nil), + ErrSpDoesNotExist: Message("%s %s does not exist", nil), + ErrSpDropFailed: Message("Failed to DROP %s %s", nil), + ErrSpStoreFailed: Message("Failed to CREATE %s %s", nil), + ErrSpLilabelMismatch: Message("%s with no matching label: %s", nil), + ErrSpLabelRedefine: Message("Redefining label %s", nil), + ErrSpLabelMismatch: Message("End-label %s without match", nil), + ErrSpUninitVar: Message("Referring to uninitialized variable %s", nil), + ErrSpBadselect: Message("PROCEDURE %s can't return a result set in the given context", nil), + ErrSpBadreturn: Message("RETURN is only allowed in a FUNCTION", nil), + ErrSpBadstatement: Message("%s is not allowed in stored procedures", nil), + ErrUpdateLogDeprecatedIgnored: Message("The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been ignored.", nil), + ErrUpdateLogDeprecatedTranslated: Message("The update log is deprecated and replaced by the binary log; SET SQLLOGUPDATE has been translated to SET SQLLOGBIN.", nil), + ErrQueryInterrupted: Message("Query execution was interrupted", nil), + ErrSpWrongNoOfArgs: Message("Incorrect number of arguments for %s %s; expected %d, got %d", nil), + ErrSpCondMismatch: Message("Undefined CONDITION: %s", nil), + ErrSpNoreturn: Message("No RETURN found in FUNCTION %s", nil), + ErrSpNoreturnend: Message("FUNCTION %s ended without RETURN", nil), + ErrSpBadCursorQuery: Message("Cursor statement must be a SELECT", nil), + ErrSpBadCursorSelect: Message("Cursor SELECT must not have INTO", nil), + ErrSpCursorMismatch: Message("Undefined CURSOR: %s", nil), + ErrSpCursorAlreadyOpen: Message("Cursor is already open", nil), + ErrSpCursorNotOpen: Message("Cursor is not open", nil), + ErrSpUndeclaredVar: Message("Undeclared variable: %s", nil), + ErrSpWrongNoOfFetchArgs: Message("Incorrect number of FETCH variables", nil), + ErrSpFetchNoData: Message("No data - zero rows fetched, selected, or processed", nil), + ErrSpDupParam: Message("Duplicate parameter: %s", nil), + ErrSpDupVar: Message("Duplicate variable: %s", nil), + ErrSpDupCond: Message("Duplicate condition: %s", nil), + ErrSpDupCurs: Message("Duplicate cursor: %s", nil), + ErrSpCantAlter: Message("Failed to ALTER %s %s", nil), + ErrSpSubselectNyi: Message("Subquery value not supported", nil), + ErrStmtNotAllowedInSfOrTrg: Message("%s is not allowed in stored function or trigger", nil), + ErrSpVarcondAfterCurshndlr: Message("Variable or condition declaration after cursor or handler declaration", nil), + ErrSpCursorAfterHandler: Message("Cursor declaration after handler declaration", nil), + ErrSpCaseNotFound: Message("Case not found for CASE statement", nil), + ErrFparserTooBigFile: Message("Configuration file '%-.192s' is too big", nil), + ErrFparserBadHeader: Message("Malformed file type header in file '%-.192s'", nil), + ErrFparserEOFInComment: Message("Unexpected end of file while parsing comment '%-.200s'", nil), + ErrFparserErrorInParameter: Message("Error while parsing parameter '%-.192s' (line: '%-.192s')", nil), + ErrFparserEOFInUnknownParameter: Message("Unexpected end of file while skipping unknown parameter '%-.192s'", nil), + ErrViewNoExplain: Message("EXPLAIN/SHOW can not be issued; lacking privileges for underlying table", nil), + ErrFrmUnknownType: Message("File '%-.192s' has unknown type '%-.64s' in its header", nil), + ErrWrongObject: Message("'%-.192s.%-.192s' is not %s", nil), + ErrNonupdateableColumn: Message("Column '%-.192s' is not updatable", nil), + ErrViewSelectDerived: Message("View's SELECT contains a subquery in the FROM clause", nil), + ErrViewSelectClause: Message("View's SELECT contains a '%s' clause", nil), + ErrViewSelectVariable: Message("View's SELECT contains a variable or parameter", nil), + ErrViewSelectTmptable: Message("View's SELECT refers to a temporary table '%-.192s'", nil), + ErrViewWrongList: Message("View's SELECT and view's field list have different column counts", nil), + ErrWarnViewMerge: Message("View merge algorithm can't be used here for now (assumed undefined algorithm)", nil), + ErrWarnViewWithoutKey: Message("View being updated does not have complete key of underlying table in it", nil), + ErrViewInvalid: Message("View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them", nil), + ErrSpNoDropSp: Message("Can't drop or alter a %s from within another stored routine", nil), + ErrSpGotoInHndlr: Message("GOTO is not allowed in a stored procedure handler", nil), + ErrTrgAlreadyExists: Message("Trigger already exists", nil), + ErrTrgDoesNotExist: Message("Trigger does not exist", nil), + ErrTrgOnViewOrTempTable: Message("Trigger's '%-.192s' is view or temporary table", nil), + ErrTrgCantChangeRow: Message("Updating of %s row is not allowed in %strigger", nil), + ErrTrgNoSuchRowInTrg: Message("There is no %s row in %s trigger", nil), + ErrNoDefaultForField: Message("Field '%-.192s' doesn't have a default value", nil), + ErrDivisionByZero: Message("Division by 0", nil), + ErrTruncatedWrongValueForField: Message("Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d", nil), + ErrIllegalValueForType: Message("Illegal %s '%-.192s' value found during parsing", nil), + ErrViewNonupdCheck: Message("CHECK OPTION on non-updatable view '%-.192s.%-.192s'", nil), + ErrViewCheckFailed: Message("CHECK OPTION failed '%-.192s.%-.192s'", nil), + ErrProcaccessDenied: Message("%-.16s command denied to user '%-.48s'@'%-.64s' for routine '%-.192s'", nil), + ErrRelayLogFail: Message("Failed purging old relay logs: %s", nil), + ErrPasswdLength: Message("Password hash should be a %d-digit hexadecimal number", nil), + ErrUnknownTargetBinlog: Message("Target log not found in binlog index", nil), + ErrIoErrLogIndexRead: Message("I/O error reading log index file", nil), + ErrBinlogPurgeProhibited: Message("Server configuration does not permit binlog purge", nil), + ErrFseekFail: Message("Failed on fseek()", nil), + ErrBinlogPurgeFatalErr: Message("Fatal error during log purge", nil), + ErrLogInUse: Message("A purgeable log is in use, will not purge", nil), + ErrLogPurgeUnknownErr: Message("Unknown error during log purge", nil), + ErrRelayLogInit: Message("Failed initializing relay log position: %s", nil), + ErrNoBinaryLogging: Message("You are not using binary logging", nil), + ErrReservedSyntax: Message("The '%-.64s' syntax is reserved for purposes internal to the MySQL server", nil), + ErrWsasFailed: Message("WSAStartup Failed", nil), + ErrDiffGroupsProc: Message("Can't handle procedures with different groups yet", nil), + ErrNoGroupForProc: Message("Select must have a group with this procedure", nil), + ErrOrderWithProc: Message("Can't use ORDER clause with this procedure", nil), + ErrLoggingProhibitChangingOf: Message("Binary logging and replication forbid changing the global server %s", nil), + ErrNoFileMapping: Message("Can't map file: %-.200s, errno: %d", nil), + ErrWrongMagic: Message("Wrong magic in %-.64s", nil), + ErrPsManyParam: Message("Prepared statement contains too many placeholders", nil), + ErrKeyPart0: Message("Key part '%-.192s' length cannot be 0", nil), + ErrViewChecksum: Message("View text checksum failed", nil), + ErrViewMultiupdate: Message("Can not modify more than one base table through a join view '%-.192s.%-.192s'", nil), + ErrViewNoInsertFieldList: Message("Can not insert into join view '%-.192s.%-.192s' without fields list", nil), + ErrViewDeleteMergeView: Message("Can not delete from join view '%-.192s.%-.192s'", nil), + ErrCannotUser: Message("Operation %s failed for %.256s", nil), + ErrXaerNota: Message("XAERNOTA: Unknown XID", nil), + ErrXaerInval: Message("XAERINVAL: Invalid arguments (or unsupported command)", nil), + ErrXaerRmfail: Message("XAERRMFAIL: The command cannot be executed when global transaction is in the %.64s state", nil), + ErrXaerOutside: Message("XAEROUTSIDE: Some work is done outside global transaction", nil), + ErrXaerRmerr: Message("XAERRMERR: Fatal error occurred in the transaction branch - check your data for consistency", nil), + ErrXaRbrollback: Message("XARBROLLBACK: Transaction branch was rolled back", nil), + ErrNonexistingProcGrant: Message("There is no such grant defined for user '%-.48s' on host '%-.64s' on routine '%-.192s'", nil), + ErrProcAutoGrantFail: Message("Failed to grant EXECUTE and ALTER ROUTINE privileges", nil), + ErrProcAutoRevokeFail: Message("Failed to revoke all privileges to dropped routine", nil), + ErrDataTooLong: Message("Data too long for column '%s' at row %d", nil), + ErrSpBadSQLstate: Message("Bad SQLSTATE: '%s'", nil), + ErrStartup: Message("%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s", nil), + ErrLoadFromFixedSizeRowsToVar: Message("Can't load value from file with fixed size rows to variable", nil), + ErrCantCreateUserWithGrant: Message("You are not allowed to create a user with GRANT", nil), + ErrWrongValueForType: Message("Incorrect %-.32s value: '%-.128s' for function %-.32s", nil), + ErrTableDefChanged: Message("Table definition has changed, please retry transaction", nil), + ErrSpDupHandler: Message("Duplicate handler declared in the same block", nil), + ErrSpNotVarArg: Message("OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger", nil), + ErrSpNoRetset: Message("Not allowed to return a result set from a %s", nil), + ErrCantCreateGeometryObject: Message("Cannot get geometry object from data you send to the GEOMETRY field", nil), + ErrFailedRoutineBreakBinlog: Message("A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes", nil), + ErrBinlogUnsafeRoutine: Message("This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", nil), + ErrBinlogCreateRoutineNeedSuper: Message("You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe logBinTrustFunctionCreators variable)", nil), + ErrExecStmtWithOpenCursor: Message("You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it.", nil), + ErrStmtHasNoOpenCursor: Message("The statement (%d) has no open cursor.", nil), + ErrCommitNotAllowedInSfOrTrg: Message("Explicit or implicit commit is not allowed in stored function or trigger.", nil), + ErrNoDefaultForViewField: Message("Field of view '%-.192s.%-.192s' underlying table doesn't have a default value", nil), + ErrSpNoRecursion: Message("Recursive stored functions and triggers are not allowed.", nil), + ErrTooBigScale: Message("Too big scale %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrTooBigPrecision: Message("Too big precision %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrMBiggerThanD: Message("For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s').", nil), + ErrWrongLockOfSystemTable: Message("You can't combine write-locking of system tables with other tables or lock types", nil), + ErrConnectToForeignDataSource: Message("Unable to connect to foreign data source: %.64s", nil), + ErrQueryOnForeignDataSource: Message("There was a problem processing the query on the foreign data source. Data source : %-.64s", nil), + ErrForeignDataSourceDoesntExist: Message("The foreign data source you are trying to reference does not exist. Data source : %-.64s", nil), + ErrForeignDataStringInvalidCantCreate: Message("Can't create federated table. The data source connection string '%-.64s' is not in the correct format", nil), + ErrForeignDataStringInvalid: Message("The data source connection string '%-.64s' is not in the correct format", nil), + ErrCantCreateFederatedTable: Message("Can't create federated table. Foreign data src : %-.64s", nil), + ErrTrgInWrongSchema: Message("Trigger in wrong schema", nil), + ErrStackOverrunNeedMore: Message("Thread stack overrun: %d bytes used of a %d byte stack, and %d bytes needed. Use 'mysqld --threadStack=#' to specify a bigger stack.", nil), + ErrTooLongBody: Message("Routine body for '%-.100s' is too long", nil), + ErrWarnCantDropDefaultKeycache: Message("Cannot drop default keycache", nil), + ErrTooBigDisplaywidth: Message("Display width out of range for column '%-.192s' (max = %d)", nil), + ErrXaerDupid: Message("XAERDUPID: The XID already exists", nil), + ErrDatetimeFunctionOverflow: Message("Datetime function: %-.32s field overflow", nil), + ErrCantUpdateUsedTableInSfOrTrg: Message("Can't update table '%-.192s' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.", nil), + ErrViewPreventUpdate: Message("The definition of table '%-.192s' prevents operation %.192s on table '%-.192s'.", nil), + ErrPsNoRecursion: Message("The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner", nil), + ErrSpCantSetAutocommit: Message("Not allowed to set autocommit from a stored function or trigger", nil), + ErrMalformedDefiner: Message("Definer is not fully qualified", nil), + ErrViewFrmNoUser: Message("View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!", nil), + ErrViewOtherUser: Message("You need the SUPER privilege for creation view with '%-.192s'@'%-.192s' definer", nil), + ErrNoSuchUser: Message("The user specified as a definer ('%-.64s'@'%-.64s') does not exist", nil), + ErrForbidSchemaChange: Message("Changing schema from '%-.192s' to '%-.192s' is not allowed.", nil), + ErrRowIsReferenced2: Message("Cannot delete or update a parent row: a foreign key constraint fails (%.192s)", nil), + ErrNoReferencedRow2: Message("Cannot add or update a child row: a foreign key constraint fails (%.192s)", nil), + ErrSpBadVarShadow: Message("Variable '%-.64s' must be quoted with `...`, or renamed", nil), + ErrTrgNoDefiner: Message("No definer attribute for trigger '%-.192s'.'%-.192s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.", nil), + ErrOldFileFormat: Message("'%-.192s' has an old format, you should re-create the '%s' object(s)", nil), + ErrSpRecursionLimit: Message("Recursive limit %d (as set by the maxSpRecursionDepth variable) was exceeded for routine %.192s", nil), + ErrSpProcTableCorrupt: Message("Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)", nil), + ErrSpWrongName: Message("Incorrect routine name '%-.192s'", nil), + ErrTableNeedsUpgrade: Message("Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\"", nil), + ErrSpNoAggregate: Message("AGGREGATE is not supported for stored functions", nil), + ErrMaxPreparedStmtCountReached: Message("Can't create more than maxPreparedStmtCount statements (current value: %d)", nil), + ErrViewRecursive: Message("`%-.192s`.`%-.192s` contains view recursion", nil), + ErrNonGroupingFieldUsed: Message("Non-grouping field '%-.192s' is used in %-.64s clause", nil), + ErrTableCantHandleSpkeys: Message("The used table type doesn't support SPATIAL indexes", nil), + ErrNoTriggersOnSystemSchema: Message("Triggers can not be created on system tables", nil), + ErrRemovedSpaces: Message("Leading spaces are removed from name '%s'", nil), + ErrAutoincReadFailed: Message("Failed to read auto-increment value from storage engine", nil), + ErrUsername: Message("user name", nil), + ErrHostname: Message("host name", nil), + ErrWrongStringLength: Message("String '%-.70s' is too long for %s (should be no longer than %d)", nil), + ErrNonInsertableTable: Message("The target table %-.100s of the %s is not insertable-into", nil), + ErrAdminWrongMrgTable: Message("Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist", nil), + ErrTooHighLevelOfNestingForSelect: Message("Too high level of nesting for select", nil), + ErrNameBecomesEmpty: Message("Name '%-.64s' has become ''", nil), + ErrAmbiguousFieldTerm: Message("First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY", nil), + ErrForeignServerExists: Message("The foreign server, %s, you are trying to create already exists.", nil), + ErrForeignServerDoesntExist: Message("The foreign server name you are trying to reference does not exist. Data source : %-.64s", nil), + ErrIllegalHaCreateOption: Message("Table storage engine '%-.64s' does not support the create option '%.64s'", nil), + ErrPartitionRequiresValues: Message("Syntax : %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition", nil), + ErrPartitionWrongValues: Message("Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition", nil), + ErrPartitionMaxvalue: Message("MAXVALUE can only be used in last partition definition", nil), + ErrPartitionSubpartition: Message("Subpartitions can only be hash partitions and by key", nil), + ErrPartitionSubpartMix: Message("Must define subpartitions on all partitions if on one partition", nil), + ErrPartitionWrongNoPart: Message("Wrong number of partitions defined, mismatch with previous setting", nil), + ErrPartitionWrongNoSubpart: Message("Wrong number of subpartitions defined, mismatch with previous setting", nil), + ErrWrongExprInPartitionFunc: Message("Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed", nil), + ErrNoConstExprInRangeOrList: Message("Expression in RANGE/LIST VALUES must be constant", nil), + ErrFieldNotFoundPart: Message("Field in list of fields for partition function not found in table", nil), + ErrListOfFieldsOnlyInHash: Message("List of fields is only allowed in KEY partitions", nil), + ErrInconsistentPartitionInfo: Message("The partition info in the frm file is not consistent with what can be written into the frm file", nil), + ErrPartitionFuncNotAllowed: Message("The %-.192s function returns the wrong type", nil), + ErrPartitionsMustBeDefined: Message("For %-.64s partitions each partition must be defined", nil), + ErrRangeNotIncreasing: Message("VALUES LESS THAN value must be strictly increasing for each partition", nil), + ErrInconsistentTypeOfFunctions: Message("VALUES value must be of same type as partition function", nil), + ErrMultipleDefConstInListPart: Message("Multiple definition of same constant in list partitioning", nil), + ErrPartitionEntry: Message("Partitioning can not be used stand-alone in query", nil), + ErrMixHandler: Message("The mix of handlers in the partitions is not allowed in this version of MySQL", nil), + ErrPartitionNotDefined: Message("For the partitioned engine it is necessary to define all %-.64s", nil), + ErrTooManyPartitions: Message("Too many partitions (including subpartitions) were defined", nil), + ErrSubpartition: Message("It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning", nil), + ErrCantCreateHandlerFile: Message("Failed to create specific handler file", nil), + ErrBlobFieldInPartFunc: Message("A BLOB field is not allowed in partition function", nil), + ErrUniqueKeyNeedAllFieldsInPf: Message("A %-.192s must include all columns in the table's partitioning function", nil), + ErrNoParts: Message("Number of %-.64s = 0 is not an allowed value", nil), + ErrPartitionMgmtOnNonpartitioned: Message("Partition management on a not partitioned table is not possible", nil), + ErrForeignKeyOnPartitioned: Message("Foreign key clause is not yet supported in conjunction with partitioning", nil), + ErrDropPartitionNonExistent: Message("Error in list of partitions to %-.64s", nil), + ErrDropLastPartition: Message("Cannot remove all partitions, use DROP TABLE instead", nil), + ErrCoalesceOnlyOnHashPartition: Message("COALESCE PARTITION can only be used on HASH/KEY partitions", nil), + ErrReorgHashOnlyOnSameNo: Message("REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers", nil), + ErrReorgNoParam: Message("REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs", nil), + ErrOnlyOnRangeListPartition: Message("%-.64s PARTITION can only be used on RANGE/LIST partitions", nil), + ErrAddPartitionSubpart: Message("Trying to Add partition(s) with wrong number of subpartitions", nil), + ErrAddPartitionNoNewPartition: Message("At least one partition must be added", nil), + ErrCoalescePartitionNoPartition: Message("At least one partition must be coalesced", nil), + ErrReorgPartitionNotExist: Message("More partitions to reorganize than there are partitions", nil), + ErrSameNamePartition: Message("Duplicate partition name %-.192s", nil), + ErrNoBinlog: Message("It is not allowed to shut off binlog on this command", nil), + ErrConsecutiveReorgPartitions: Message("When reorganizing a set of partitions they must be in consecutive order", nil), + ErrReorgOutsideRange: Message("Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range", nil), + ErrPartitionFunctionFailure: Message("Partition function not supported in this version for this handler", nil), + ErrPartState: Message("Partition state cannot be defined from CREATE/ALTER TABLE", nil), + ErrLimitedPartRange: Message("The %-.64s handler only supports 32 bit integers in VALUES", nil), + ErrPluginIsNotLoaded: Message("Plugin '%-.192s' is not loaded", nil), + ErrWrongValue: Message("Incorrect %-.32s value: '%-.128s'", nil), + ErrNoPartitionForGivenValue: Message("Table has no partition for value %-.64s", nil), + ErrFilegroupOptionOnlyOnce: Message("It is not allowed to specify %s more than once", nil), + ErrCreateFilegroupFailed: Message("Failed to create %s", nil), + ErrDropFilegroupFailed: Message("Failed to drop %s", nil), + ErrTablespaceAutoExtend: Message("The handler doesn't support autoextend of tablespaces", nil), + ErrWrongSizeNumber: Message("A size parameter was incorrectly specified, either number or on the form 10M", nil), + ErrSizeOverflow: Message("The size number was correct but we don't allow the digit part to be more than 2 billion", nil), + ErrAlterFilegroupFailed: Message("Failed to alter: %s", nil), + ErrBinlogRowLoggingFailed: Message("Writing one row to the row-based binary log failed", nil), + ErrBinlogRowWrongTableDef: Message("Table definition on master and slave does not match: %s", nil), + ErrBinlogRowRbrToSbr: Message("Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events", nil), + ErrEventAlreadyExists: Message("Event '%-.192s' already exists", nil), + ErrEventStoreFailed: Message("Failed to store event %s. Error code %d from storage engine.", nil), + ErrEventDoesNotExist: Message("Unknown event '%-.192s'", nil), + ErrEventCantAlter: Message("Failed to alter event '%-.192s'", nil), + ErrEventDropFailed: Message("Failed to drop %s", nil), + ErrEventIntervalNotPositiveOrTooBig: Message("INTERVAL is either not positive or too big", nil), + ErrEventEndsBeforeStarts: Message("ENDS is either invalid or before STARTS", nil), + ErrEventExecTimeInThePast: Message("Event execution time is in the past. Event has been disabled", nil), + ErrEventOpenTableFailed: Message("Failed to open mysql.event", nil), + ErrEventNeitherMExprNorMAt: Message("No datetime expression provided", nil), + ErrObsoleteColCountDoesntMatchCorrupted: Message("Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted", nil), + ErrObsoleteCannotLoadFromTable: Message("Cannot load from mysql.%s. The table is probably corrupted", nil), + ErrEventCannotDelete: Message("Failed to delete the event from mysql.event", nil), + ErrEventCompile: Message("Error during compilation of event's body", nil), + ErrEventSameName: Message("Same old and new event name", nil), + ErrEventDataTooLong: Message("Data for column '%s' too long", nil), + ErrDropIndexFk: Message("Cannot drop index '%-.192s': needed in a foreign key constraint", nil), + ErrWarnDeprecatedSyntaxWithVer: Message("The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead", nil), + ErrCantWriteLockLogTable: Message("You can't write-lock a log table. Only read access is possible", nil), + ErrCantLockLogTable: Message("You can't use locks with log tables.", nil), + ErrForeignDuplicateKeyOldUnused: Message("Upholding foreign key constraints for table '%.192s', entry '%-.192s', key %d would lead to a duplicate entry", nil), + ErrColCountDoesntMatchPleaseUpdate: Message("Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysqlUpgrade to fix this error.", nil), + ErrTempTablePreventsSwitchOutOfRbr: Message("Cannot switch out of the row-based binary log format when the session has open temporary tables", nil), + ErrStoredFunctionPreventsSwitchBinlogFormat: Message("Cannot change the binary logging format inside a stored function or trigger", nil), + ErrNdbCantSwitchBinlogFormat: Message("The NDB cluster engine does not support changing the binlog format on the fly yet", nil), + ErrPartitionNoTemporary: Message("Cannot create temporary table with partitions", nil), + ErrPartitionConstDomain: Message("Partition constant is out of partition function domain", nil), + ErrPartitionFunctionIsNotAllowed: Message("This partition function is not allowed", nil), + ErrDdlLog: Message("Error in DDL log", nil), + ErrNullInValuesLessThan: Message("Not allowed to use NULL value in VALUES LESS THAN", nil), + ErrWrongPartitionName: Message("Incorrect partition name", nil), + ErrCantChangeTxCharacteristics: Message("Transaction characteristics can't be changed while a transaction is in progress", nil), + ErrDupEntryAutoincrementCase: Message("ALTER TABLE causes autoIncrement resequencing, resulting in duplicate entry '%-.192s' for key '%-.192s'", nil), + ErrEventModifyQueue: Message("Internal scheduler error %d", nil), + ErrEventSetVar: Message("Error during starting/stopping of the scheduler. Error code %d", nil), + ErrPartitionMerge: Message("Engine cannot be used in partitioned tables", nil), + ErrCantActivateLog: Message("Cannot activate '%-.64s' log", nil), + ErrRbrNotAvailable: Message("The server was not built with row-based replication", nil), + ErrBase64Decode: Message("Decoding of base64 string failed", nil), + ErrEventRecursionForbidden: Message("Recursion of EVENT DDL statements is forbidden when body is present", nil), + ErrEventsDB: Message("Cannot proceed because system tables used by Event Scheduler were found damaged at server start", nil), + ErrOnlyIntegersAllowed: Message("Only integers allowed as number here", nil), + ErrUnsuportedLogEngine: Message("This storage engine cannot be used for log tables\"", nil), + ErrBadLogStatement: Message("You cannot '%s' a log table if logging is enabled", nil), + ErrCantRenameLogTable: Message("Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to '%s'", nil), + ErrWrongParamcountToNativeFct: Message("Incorrect parameter count in the call to native function '%-.192s'", nil), + ErrWrongParametersToNativeFct: Message("Incorrect parameters in the call to native function '%-.192s'", nil), + ErrWrongParametersToStoredFct: Message("Incorrect parameters in the call to stored function '%-.192s'", nil), + ErrNativeFctNameCollision: Message("This function '%-.192s' has the same name as a native function", nil), + ErrDupEntryWithKeyName: Message("Duplicate entry '%-.64s' for key '%-.192s'", nil), + ErrBinlogPurgeEmFile: Message("Too many files opened, please execute the command again", nil), + ErrEventCannotCreateInThePast: Message("Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.", nil), + ErrEventCannotAlterInThePast: Message("Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.", nil), + ErrSlaveIncident: Message("The incident %s occurred on the master. Message: %-.64s", nil), + ErrNoPartitionForGivenValueSilent: Message("Table has no partition for some existing values", nil), + ErrBinlogUnsafeStatement: Message("Unsafe statement written to the binary log using statement format since BINLOGFORMAT = STATEMENT. %s", nil), + ErrSlaveFatal: Message("Fatal : %s", nil), + ErrSlaveRelayLogReadFailure: Message("Relay log read failure: %s", nil), + ErrSlaveRelayLogWriteFailure: Message("Relay log write failure: %s", nil), + ErrSlaveCreateEventFailure: Message("Failed to create %s", nil), + ErrSlaveMasterComFailure: Message("Master command %s failed: %s", nil), + ErrBinlogLoggingImpossible: Message("Binary logging not possible. Message: %s", nil), + ErrViewNoCreationCtx: Message("View `%-.64s`.`%-.64s` has no creation context", nil), + ErrViewInvalidCreationCtx: Message("Creation context of view `%-.64s`.`%-.64s' is invalid", nil), + ErrSrInvalidCreationCtx: Message("Creation context of stored routine `%-.64s`.`%-.64s` is invalid", nil), + ErrTrgCorruptedFile: Message("Corrupted TRG file for table `%-.64s`.`%-.64s`", nil), + ErrTrgNoCreationCtx: Message("Triggers for table `%-.64s`.`%-.64s` have no creation context", nil), + ErrTrgInvalidCreationCtx: Message("Trigger creation context of table `%-.64s`.`%-.64s` is invalid", nil), + ErrEventInvalidCreationCtx: Message("Creation context of event `%-.64s`.`%-.64s` is invalid", nil), + ErrTrgCantOpenTable: Message("Cannot open table for trigger `%-.64s`.`%-.64s`", nil), + ErrCantCreateSroutine: Message("Cannot create stored routine `%-.64s`. Check warnings", nil), + ErrNeverUsed: Message("Ambiguous slave modes combination. %s", nil), + ErrNoFormatDescriptionEventBeforeBinlogStatement: Message("The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement.", nil), + ErrSlaveCorruptEvent: Message("Corrupted replication event was detected", nil), + ErrLoadDataInvalidColumn: Message("Invalid column reference (%-.64s) in LOAD DATA", nil), + ErrLogPurgeNoFile: Message("Being purged log %s was not found", nil), + ErrXaRbtimeout: Message("XARBTIMEOUT: Transaction branch was rolled back: took too long", nil), + ErrXaRbdeadlock: Message("XARBDEADLOCK: Transaction branch was rolled back: deadlock was detected", nil), + ErrNeedReprepare: Message("Prepared statement needs to be re-prepared", nil), + ErrDelayedNotSupported: Message("DELAYED option not supported for table '%-.192s'", nil), + WarnNoMasterInfo: Message("The master info structure does not exist", nil), + WarnOptionIgnored: Message("<%-.64s> option ignored", nil), + WarnPluginDeleteBuiltin: Message("Built-in plugins cannot be deleted", nil), + WarnPluginBusy: Message("Plugin is busy and will be uninstalled on shutdown", nil), + ErrVariableIsReadonly: Message("%s variable '%s' is read-only. Use SET %s to assign the value", nil), + ErrWarnEngineTransactionRollback: Message("Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted", nil), + ErrSlaveHeartbeatFailure: Message("Unexpected master's heartbeat data: %s", nil), + ErrSlaveHeartbeatValueOutOfRange: Message("The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds).", nil), + ErrNdbReplicationSchema: Message("Bad schema for mysql.ndbReplication table. Message: %-.64s", nil), + ErrConflictFnParse: Message("Error in parsing conflict function. Message: %-.64s", nil), + ErrExceptionsWrite: Message("Write to exceptions table failed. Message: %-.128s\"", nil), + ErrTooLongTableComment: Message("Comment for table '%-.64s' is too long (max = %d)", nil), + ErrTooLongFieldComment: Message("Comment for field '%-.64s' is too long (max = %d)", nil), + ErrFuncInexistentNameCollision: Message("FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual", nil), + ErrDatabaseName: Message("Database", nil), + ErrTableName: Message("Table", nil), + ErrPartitionName: Message("Partition", nil), + ErrSubpartitionName: Message("Subpartition", nil), + ErrTemporaryName: Message("Temporary", nil), + ErrRenamedName: Message("Renamed", nil), + ErrTooManyConcurrentTrxs: Message("Too many active concurrent transactions", nil), + WarnNonASCIISeparatorNotImplemented: Message("Non-ASCII separator arguments are not fully supported", nil), + ErrDebugSyncTimeout: Message("debug sync point wait timed out", nil), + ErrDebugSyncHitLimit: Message("debug sync point hit limit reached", nil), + ErrDupSignalSet: Message("Duplicate condition information item '%s'", nil), + ErrSignalWarn: Message("Unhandled user-defined warning condition", nil), + ErrSignalNotFound: Message("Unhandled user-defined not found condition", nil), + ErrSignalException: Message("Unhandled user-defined exception condition", nil), + ErrResignalWithoutActiveHandler: Message("RESIGNAL when handler not active", nil), + ErrSignalBadConditionType: Message("SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE", nil), + WarnCondItemTruncated: Message("Data truncated for condition item '%s'", nil), + ErrCondItemTooLong: Message("Data too long for condition item '%s'", nil), + ErrUnknownLocale: Message("Unknown locale: '%-.64s'", nil), + ErrSlaveIgnoreServerIds: Message("The requested server id %d clashes with the slave startup option --replicate-same-server-id", nil), + ErrQueryCacheDisabled: Message("Query cache is disabled; restart the server with queryCacheType=1 to enable it", nil), + ErrSameNamePartitionField: Message("Duplicate partition field name '%-.192s'", nil), + ErrPartitionColumnList: Message("Inconsistency in usage of column lists for partitioning", nil), + ErrWrongTypeColumnValue: Message("Partition column values of incorrect type", nil), + ErrTooManyPartitionFuncFields: Message("Too many fields in '%-.192s'", nil), + ErrMaxvalueInValuesIn: Message("Cannot use MAXVALUE as value in VALUES IN", nil), + ErrTooManyValues: Message("Cannot have more than one value for this type of %-.64s partitioning", nil), + ErrRowSinglePartitionField: Message("Row expressions in VALUES IN only allowed for multi-field column partitioning", nil), + ErrFieldTypeNotAllowedAsPartitionField: Message("Field '%-.192s' is of a not allowed type for this type of partitioning", nil), + ErrPartitionFieldsTooLong: Message("The total length of the partitioning fields is too large", nil), + ErrBinlogRowEngineAndStmtEngine: Message("Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved.", nil), + ErrBinlogRowModeAndStmtEngine: Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = ROW and at least one table uses a storage engine limited to statement-based logging.", nil), + ErrBinlogUnsafeAndStmtEngine: Message("Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOGFORMAT = MIXED. %s", nil), + ErrBinlogRowInjectionAndStmtEngine: Message("Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging.", nil), + ErrBinlogStmtModeAndRowEngine: Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s", nil), + ErrBinlogRowInjectionAndStmtMode: Message("Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOGFORMAT = STATEMENT.", nil), + ErrBinlogMultipleEnginesAndSelfLoggingEngine: Message("Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.", nil), + ErrBinlogUnsafeLimit: Message("The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.", nil), + ErrBinlogUnsafeInsertDelayed: Message("The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.", nil), + ErrBinlogUnsafeSystemTable: Message("The statement is unsafe because it uses the general log, slow query log, or performanceSchema table(s). This is unsafe because system tables may differ on slaves.", nil), + ErrBinlogUnsafeAutoincColumns: Message("Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTOINCREMENT column. Inserted values cannot be logged correctly.", nil), + ErrBinlogUnsafeUdf: Message("Statement is unsafe because it uses a UDF which may not return the same value on the slave.", nil), + ErrBinlogUnsafeSystemVariable: Message("Statement is unsafe because it uses a system variable that may have a different value on the slave.", nil), + ErrBinlogUnsafeSystemFunction: Message("Statement is unsafe because it uses a system function that may return a different value on the slave.", nil), + ErrBinlogUnsafeNontransAfterTrans: Message("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.", nil), + ErrMessageAndStatement: Message("%s Statement: %s", nil), + ErrSlaveConversionFailed: Message("Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'", nil), + ErrSlaveCantCreateConversion: Message("Can't create conversion table for table '%-.192s.%-.192s'", nil), + ErrInsideTransactionPreventsSwitchBinlogFormat: Message("Cannot modify @@session.binlogFormat inside a transaction", nil), + ErrPathLength: Message("The path specified for %.64s is too long.", nil), + ErrWarnDeprecatedSyntaxNoReplacement: Message("'%s' is deprecated and will be removed in a future release.", nil), + ErrWrongNativeTableStructure: Message("Native table '%-.64s'.'%-.64s' has the wrong structure", nil), + ErrWrongPerfSchemaUsage: Message("Invalid performanceSchema usage.", nil), + ErrWarnISSkippedTable: Message("Table '%s'.'%s' was skipped since its definition is being modified by concurrent DDL statement", nil), + ErrInsideTransactionPreventsSwitchBinlogDirect: Message("Cannot modify @@session.binlogDirectNonTransactionalUpdates inside a transaction", nil), + ErrStoredFunctionPreventsSwitchBinlogDirect: Message("Cannot change the binlog direct flag inside a stored function or trigger", nil), + ErrSpatialMustHaveGeomCol: Message("A SPATIAL index may only contain a geometrical type column", nil), + ErrTooLongIndexComment: Message("Comment for index '%-.64s' is too long (max = %d)", nil), + ErrLockAborted: Message("Wait on a lock was aborted due to a pending exclusive lock", nil), + ErrDataOutOfRange: Message("%s value is out of range in '%s'", nil), + ErrWrongSpvarTypeInLimit: Message("A variable of a non-integer based type in LIMIT clause", nil), + ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine: Message("Mixing self-logging and non-self-logging engines in a statement is unsafe.", nil), + ErrBinlogUnsafeMixedStatement: Message("Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.", nil), + ErrInsideTransactionPreventsSwitchSQLLogBin: Message("Cannot modify @@session.sqlLogBin inside a transaction", nil), + ErrStoredFunctionPreventsSwitchSQLLogBin: Message("Cannot change the sqlLogBin inside a stored function or trigger", nil), + ErrFailedReadFromParFile: Message("Failed to read from the .par file", nil), + ErrValuesIsNotIntType: Message("VALUES value for partition '%-.64s' must have type INT", nil), + ErrAccessDeniedNoPassword: Message("Access denied for user '%-.48s'@'%-.64s'", nil), + ErrSetPasswordAuthPlugin: Message("SET PASSWORD has no significance for users authenticating via plugins", nil), + ErrGrantPluginUserExists: Message("GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists", nil), + ErrTruncateIllegalFk: Message("Cannot truncate a table referenced in a foreign key constraint (%.192s)", nil), + ErrPluginIsPermanent: Message("Plugin '%s' is forcePlusPermanent and can not be unloaded", nil), + ErrSlaveHeartbeatValueOutOfRangeMin: Message("The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled.", nil), + ErrSlaveHeartbeatValueOutOfRangeMax: Message("The requested value for the heartbeat period exceeds the value of `slaveNetTimeout' seconds. A sensible value for the period should be less than the timeout.", nil), + ErrStmtCacheFull: Message("Multi-row statements required more than 'maxBinlogStmtCacheSize' bytes of storage; increase this mysqld variable and try again", nil), + ErrMultiUpdateKeyConflict: Message("Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'.", nil), + ErrTableNeedsRebuild: Message("Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!", nil), + WarnOptionBelowLimit: Message("The value of '%s' should be no less than the value of '%s'", nil), + ErrIndexColumnTooLong: Message("Index column size too large. The maximum column size is %d bytes.", nil), + ErrErrorInTriggerBody: Message("Trigger '%-.64s' has an error in its body: '%-.256s'", nil), + ErrErrorInUnknownTriggerBody: Message("Unknown trigger has an error in its body: '%-.256s'", nil), + ErrIndexCorrupt: Message("Index %s is corrupted", nil), + ErrUndoRecordTooBig: Message("Undo log record is too big.", nil), + ErrBinlogUnsafeInsertIgnoreSelect: Message("INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeInsertSelectUpdate: Message("INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeReplaceSelect: Message("REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeCreateIgnoreSelect: Message("CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeCreateReplaceSelect: Message("CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeUpdateIgnore: Message("UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.", nil), + ErrPluginNoUninstall: Message("Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it.", nil), + ErrPluginNoInstall: Message("Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it.", nil), + ErrBinlogUnsafeWriteAutoincSelect: Message("Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeCreateSelectAutoinc: Message("CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave.", nil), + ErrBinlogUnsafeInsertTwoKeys: Message("INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe", nil), + ErrTableInFkCheck: Message("Table is being used in foreign key check.", nil), + ErrUnsupportedEngine: Message("Storage engine '%s' does not support system tables. [%s.%s]", nil), + ErrBinlogUnsafeAutoincNotFirst: Message("INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.", nil), + ErrCannotLoadFromTableV2: Message("Cannot load from %s.%s. The table is probably corrupted", nil), + ErrMasterDelayValueOutOfRange: Message("The requested value %d for the master delay exceeds the maximum %d", nil), + ErrOnlyFdAndRbrEventsAllowedInBinlogStatement: Message("Only FormatDescriptionLogEvent and row events are allowed in BINLOG statements (but %s was provided)", nil), + ErrPartitionExchangeDifferentOption: Message("Non matching attribute '%-.64s' between partition and table", nil), + ErrPartitionExchangePartTable: Message("Table to exchange with partition is partitioned: '%-.64s'", nil), + ErrPartitionExchangeTempTable: Message("Table to exchange with partition is temporary: '%-.64s'", nil), + ErrPartitionInsteadOfSubpartition: Message("Subpartitioned table, use subpartition instead of partition", nil), + ErrUnknownPartition: Message("Unknown partition '%-.64s' in table '%-.64s'", nil), + ErrTablesDifferentMetadata: Message("Tables have different definitions", nil), + ErrRowDoesNotMatchPartition: Message("Found a row that does not match the partition", nil), + ErrBinlogCacheSizeGreaterThanMax: Message("Option binlogCacheSize (%d) is greater than maxBinlogCacheSize (%d); setting binlogCacheSize equal to maxBinlogCacheSize.", nil), + ErrWarnIndexNotApplicable: Message("Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'", nil), + ErrPartitionExchangeForeignKey: Message("Table to exchange with partition has foreign key references: '%-.64s'", nil), + ErrNoSuchKeyValue: Message("Key value '%-.192s' was not found in table '%-.192s.%-.192s'", nil), + ErrRplInfoDataTooLong: Message("Data for column '%s' too long", nil), + ErrNetworkReadEventChecksumFailure: Message("Replication event checksum verification failed while reading from network.", nil), + ErrBinlogReadEventChecksumFailure: Message("Replication event checksum verification failed while reading from a log file.", nil), + ErrBinlogStmtCacheSizeGreaterThanMax: Message("Option binlogStmtCacheSize (%d) is greater than maxBinlogStmtCacheSize (%d); setting binlogStmtCacheSize equal to maxBinlogStmtCacheSize.", nil), + ErrCantUpdateTableInCreateTableSelect: Message("Can't update table '%-.192s' while '%-.192s' is being created.", nil), + ErrPartitionClauseOnNonpartitioned: Message("PARTITION () clause on non partitioned table", nil), + ErrRowDoesNotMatchGivenPartitionSet: Message("Found a row not matching the given partition set", nil), + ErrNoSuchPartitionunused: Message("partition '%-.64s' doesn't exist", nil), + ErrChangeRplInfoRepositoryFailure: Message("Failure while changing the type of replication repository: %s.", nil), + ErrWarningNotCompleteRollbackWithCreatedTempTable: Message("The creation of some temporary tables could not be rolled back.", nil), + ErrWarningNotCompleteRollbackWithDroppedTempTable: Message("Some temporary tables were dropped, but these operations could not be rolled back.", nil), + ErrMtsFeatureIsNotSupported: Message("%s is not supported in multi-threaded slave mode. %s", nil), + ErrMtsUpdatedDBsGreaterMax: Message("The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata.", nil), + ErrMtsCantParallel: Message("Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s.", nil), + ErrMtsInconsistentData: Message("%s", nil), + ErrFulltextNotSupportedWithPartitioning: Message("FULLTEXT index is not supported for partitioned tables.", nil), + ErrDaInvalidConditionNumber: Message("Invalid condition number", nil), + ErrInsecurePlainText: Message("Sending passwords in plain text without SSL/TLS is extremely insecure.", nil), + ErrInsecureChangeMaster: Message("Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.", nil), + ErrForeignDuplicateKeyWithChildInfo: Message("Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in table '%.192s', key '%.192s'", nil), + ErrForeignDuplicateKeyWithoutChildInfo: Message("Foreign key constraint for table '%.192s', record '%-.192s' would lead to a duplicate entry in a child table", nil), + ErrSQLthreadWithSecureSlave: Message("Setting authentication options is not possible when only the Slave SQL Thread is being started.", nil), + ErrTableHasNoFt: Message("The table does not have FULLTEXT index to support this query", nil), + ErrVariableNotSettableInSfOrTrigger: Message("The system variable %.200s cannot be set in stored functions or triggers.", nil), + ErrVariableNotSettableInTransaction: Message("The system variable %.200s cannot be set when there is an ongoing transaction.", nil), + ErrGtidNextIsNotInGtidNextList: Message("The system variable @@SESSION.GTIDNEXT has the value %.200s, which is not listed in @@SESSION.GTIDNEXTLIST.", nil), + ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull: Message("When @@SESSION.GTIDNEXTLIST == NULL, the system variable @@SESSION.GTIDNEXT cannot change inside a transaction.", nil), + ErrSetStatementCannotInvokeFunction: Message("The statement 'SET %.200s' cannot invoke a stored function.", nil), + ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull: Message("The system variable @@SESSION.GTIDNEXT cannot be 'AUTOMATIC' when @@SESSION.GTIDNEXTLIST is non-NULL.", nil), + ErrSkippingLoggedTransaction: Message("Skipping transaction %.200s because it has already been executed and logged.", nil), + ErrMalformedGtidSetSpecification: Message("Malformed GTID set specification '%.200s'.", nil), + ErrMalformedGtidSetEncoding: Message("Malformed GTID set encoding.", nil), + ErrMalformedGtidSpecification: Message("Malformed GTID specification '%.200s'.", nil), + ErrGnoExhausted: Message("Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new serverUuid.", nil), + ErrBadSlaveAutoPosition: Message("Parameters MASTERLOGFILE, MASTERLOGPOS, RELAYLOGFILE and RELAYLOGPOS cannot be set when MASTERAUTOPOSITION is active.", nil), + ErrAutoPositionRequiresGtidModeOn: Message("CHANGE MASTER TO MASTERAUTOPOSITION = 1 can only be executed when @@GLOBAL.GTIDMODE = ON.", nil), + ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet: Message("Cannot execute statements with implicit commit inside a transaction when @@SESSION.GTIDNEXT != AUTOMATIC or @@SESSION.GTIDNEXTLIST != NULL.", nil), + ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn: Message("@@GLOBAL.GTIDMODE = ON or UPGRADESTEP2 requires @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", nil), + ErrGtidModeRequiresBinlog: Message("@@GLOBAL.GTIDMODE = ON or UPGRADESTEP1 or UPGRADESTEP2 requires --log-bin and --log-slave-updates.", nil), + ErrCantSetGtidNextToGtidWhenGtidModeIsOff: Message("@@SESSION.GTIDNEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn: Message("@@SESSION.GTIDNEXT cannot be set to ANONYMOUS when @@GLOBAL.GTIDMODE = ON.", nil), + ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff: Message("@@SESSION.GTIDNEXTLIST cannot be set to a non-NULL value when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrFoundGtidEventWhenGtidModeIsOff: Message("Found a GtidLogEvent or PreviousGtidsLogEvent when @@GLOBAL.GTIDMODE = OFF.", nil), + ErrGtidUnsafeNonTransactionalTable: Message("When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.", nil), + ErrGtidUnsafeCreateSelect: Message("CREATE TABLE ... SELECT is forbidden when @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1.", nil), + ErrGtidUnsafeCreateDropTemporaryTableInTransaction: Message("When @@GLOBAL.ENFORCEGTIDCONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.", nil), + ErrGtidModeCanOnlyChangeOneStepAtATime: Message("The value of @@GLOBAL.GTIDMODE can only change one step at a time: OFF <-> UPGRADESTEP1 <-> UPGRADESTEP2 <-> ON. Also note that this value must be stepped up or down simultaneously on all servers; see the Manual for instructions.", nil), + ErrMasterHasPurgedRequiredGtids: Message("The slave is connecting using CHANGE MASTER TO MASTERAUTOPOSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.", nil), + ErrCantSetGtidNextWhenOwningGtid: Message("@@SESSION.GTIDNEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK.", nil), + ErrUnknownExplainFormat: Message("Unknown EXPLAIN format name: '%s'", nil), + ErrCantExecuteInReadOnlyTransaction: Message("Cannot execute statement in a READ ONLY transaction.", nil), + ErrTooLongTablePartitionComment: Message("Comment for table partition '%-.64s' is too long (max = %d)", nil), + ErrSlaveConfiguration: Message("Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.", nil), + ErrInnodbFtLimit: Message("InnoDB presently supports one FULLTEXT index creation at a time", nil), + ErrInnodbNoFtTempTable: Message("Cannot create FULLTEXT index on temporary InnoDB table", nil), + ErrInnodbFtWrongDocidColumn: Message("Column '%-.192s' is of wrong type for an InnoDB FULLTEXT index", nil), + ErrInnodbFtWrongDocidIndex: Message("Index '%-.192s' is of wrong type for an InnoDB FULLTEXT index", nil), + ErrInnodbOnlineLogTooBig: Message("Creating index '%-.192s' required more than 'innodbOnlineAlterLogMaxSize' bytes of modification log. Please try again.", nil), + ErrUnknownAlterAlgorithm: Message("Unknown ALGORITHM '%s'", nil), + ErrUnknownAlterLock: Message("Unknown LOCK type '%s'", nil), + ErrMtsChangeMasterCantRunWithGaps: Message("CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL.", nil), + ErrMtsRecoveryFailure: Message("Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MySQL error log.", nil), + ErrMtsResetWorkers: Message("Cannot clean up worker info tables. Additional error messages can be found in the MySQL error log.", nil), + ErrColCountDoesntMatchCorruptedV2: Message("Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted", nil), + ErrSlaveSilentRetryTransaction: Message("Slave must silently retry current transaction", nil), + ErrDiscardFkChecksRunning: Message("There is a foreign key check running on table '%-.192s'. Cannot discard the table.", nil), + ErrTableSchemaMismatch: Message("Schema mismatch (%s)", nil), + ErrTableInSystemTablespace: Message("Table '%-.192s' in system tablespace", nil), + ErrIoRead: Message("IO Read : (%d, %s) %s", nil), + ErrIoWrite: Message("IO Write : (%d, %s) %s", nil), + ErrTablespaceMissing: Message("Tablespace is missing for table '%-.192s'", nil), + ErrTablespaceExists: Message("Tablespace for table '%-.192s' exists. Please DISCARD the tablespace before IMPORT.", nil), + ErrTablespaceDiscarded: Message("Tablespace has been discarded for table '%-.192s'", nil), + ErrInternal: Message("Internal : %s", nil), + ErrInnodbImport: Message("ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %d : '%s'", nil), + ErrInnodbIndexCorrupt: Message("Index corrupt: %s", nil), + ErrInvalidYearColumnLength: Message("Supports only YEAR or YEAR(4) column", nil), + ErrNotValidPassword: Message("Your password does not satisfy the current policy requirements", nil), + ErrMustChangePassword: Message("You must SET PASSWORD before executing this statement", nil), + ErrFkNoIndexChild: Message("Failed to add the foreign key constaint. Missing index for constraint '%s' in the foreign table '%s'", nil), + ErrFkNoIndexParent: Message("Failed to add the foreign key constaint. Missing index for constraint '%s' in the referenced table '%s'", nil), + ErrFkFailAddSystem: Message("Failed to add the foreign key constraint '%s' to system tables", nil), + ErrFkCannotOpenParent: Message("Failed to open the referenced table '%s'", nil), + ErrFkIncorrectOption: Message("Failed to add the foreign key constraint on table '%s'. Incorrect options in FOREIGN KEY constraint '%s'", nil), + ErrFkDupName: Message("Duplicate foreign key constraint name '%s'", nil), + ErrPasswordFormat: Message("The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.", nil), + ErrFkColumnCannotDrop: Message("Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s'", nil), + ErrFkColumnCannotDropChild: Message("Cannot drop column '%-.192s': needed in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrFkColumnNotNull: Message("Column '%-.192s' cannot be NOT NULL: needed in a foreign key constraint '%-.192s' SET NULL", nil), + ErrDupIndex: Message("Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release.", nil), + ErrFkColumnCannotChange: Message("Cannot change column '%-.192s': used in a foreign key constraint '%-.192s'", nil), + ErrFkColumnCannotChangeChild: Message("Cannot change column '%-.192s': used in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrFkCannotDeleteParent: Message("Cannot delete rows from table which is parent in a foreign key constraint '%-.192s' of table '%-.192s'", nil), + ErrMalformedPacket: Message("Malformed communication packet.", nil), + ErrReadOnlyMode: Message("Running in read-only mode", nil), + ErrGtidNextTypeUndefinedGroup: Message("When @@SESSION.GTIDNEXT is set to a GTID, you must explicitly set it again after a COMMIT or ROLLBACK. If you see this error message in the slave SQL thread, it means that a table in the current transaction is transactional on the master and non-transactional on the slave. In a client connection, it means that you executed SET @@SESSION.GTIDNEXT before a transaction and forgot to set @@SESSION.GTIDNEXT to a different identifier or to 'AUTOMATIC' after COMMIT or ROLLBACK. Current @@SESSION.GTIDNEXT is '%s'.", nil), + ErrVariableNotSettableInSp: Message("The system variable %.200s cannot be set in stored procedures.", nil), + ErrCantSetGtidPurgedWhenGtidModeIsOff: Message("@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDMODE = ON.", nil), + ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty: Message("@@GLOBAL.GTIDPURGED can only be set when @@GLOBAL.GTIDEXECUTED is empty.", nil), + ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty: Message("@@GLOBAL.GTIDPURGED can only be set when there are no ongoing transactions (not even in other clients).", nil), + ErrGtidPurgedWasChanged: Message("@@GLOBAL.GTIDPURGED was changed from '%s' to '%s'.", nil), + ErrGtidExecutedWasChanged: Message("@@GLOBAL.GTIDEXECUTED was changed from '%s' to '%s'.", nil), + ErrBinlogStmtModeAndNoReplTables: Message("Cannot execute statement: impossible to write to binary log since BINLOGFORMAT = STATEMENT, and both replicated and non replicated tables are written to.", nil), + ErrAlterOperationNotSupported: Message("%s is not supported for this operation. Try %s.", nil), + ErrAlterOperationNotSupportedReason: Message("%s is not supported. Reason: %s. Try %s.", nil), + ErrAlterOperationNotSupportedReasonCopy: Message("COPY algorithm requires a lock", nil), + ErrAlterOperationNotSupportedReasonPartition: Message("Partition specific operations do not yet support LOCK/ALGORITHM", nil), + ErrAlterOperationNotSupportedReasonFkRename: Message("Columns participating in a foreign key are renamed", nil), + ErrAlterOperationNotSupportedReasonColumnType: Message("Cannot change column type INPLACE", nil), + ErrAlterOperationNotSupportedReasonFkCheck: Message("Adding foreign keys needs foreignKeyChecks=OFF", nil), + ErrAlterOperationNotSupportedReasonIgnore: Message("Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows", nil), + ErrAlterOperationNotSupportedReasonNopk: Message("Dropping a primary key is not allowed without also adding a new primary key", nil), + ErrAlterOperationNotSupportedReasonAutoinc: Message("Adding an auto-increment column requires a lock", nil), + ErrAlterOperationNotSupportedReasonHiddenFts: Message("Cannot replace hidden FTSDOCID with a user-visible one", nil), + ErrAlterOperationNotSupportedReasonChangeFts: Message("Cannot drop or rename FTSDOCID", nil), + ErrAlterOperationNotSupportedReasonFts: Message("Fulltext index creation requires a lock", nil), + ErrSQLSlaveSkipCounterNotSettableInGtidMode: Message("sqlSlaveSkipCounter can not be set when the server is running with @@GLOBAL.GTIDMODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction", nil), + ErrDupUnknownInIndex: Message("Duplicate entry for key '%-.192s'", nil), + ErrIdentCausesTooLongPath: Message("Long database name and identifier for object resulted in path length exceeding %d characters. Path: '%s'.", nil), + ErrAlterOperationNotSupportedReasonNotNull: Message("cannot silently convert NULL values, as required in this SQLMODE", nil), + ErrMustChangePasswordLogin: Message("Your password has expired. To log in you must change it using a client that supports expired passwords.", nil), + ErrRowInWrongPartition: Message("Found a row in wrong partition %s", nil), + ErrGeneratedColumnFunctionIsNotAllowed: Message("Expression of generated column '%s' contains a disallowed function.", nil), + ErrUnsupportedAlterInplaceOnVirtualColumn: Message("INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions.", nil), + ErrWrongFKOptionForGeneratedColumn: Message("Cannot define foreign key with %s clause on a generated column.", nil), + ErrBadGeneratedColumn: Message("The value specified for generated column '%s' in table '%s' is not allowed.", nil), + ErrUnsupportedOnGeneratedColumn: Message("'%s' is not supported for generated columns.", nil), + ErrGeneratedColumnNonPrior: Message("Generated column can refer only to generated columns defined prior to it.", nil), + ErrDependentByGeneratedColumn: Message("Column '%s' has a generated column dependency.", nil), + ErrGeneratedColumnRefAutoInc: Message("Generated column '%s' cannot refer to auto-increment column.", nil), + ErrInvalidFieldSize: Message("Invalid size for column '%s'.", nil), + ErrIncorrectType: Message("Incorrect type for argument %s in function %s.", nil), + ErrInvalidJSONData: Message("Invalid JSON data provided to function %s: %s", nil), + ErrInvalidJSONText: Message("Invalid JSON text: %-.192s", nil), + ErrInvalidJSONPath: Message("Invalid JSON path expression %s.", nil), + ErrInvalidTypeForJSON: Message("Invalid data type for JSON data in argument %d to function %s; a JSON string or JSON type is required.", nil), + ErrInvalidJSONPathWildcard: Message("In this situation, path expressions may not contain the * and ** tokens.", nil), + ErrInvalidJSONContainsPathType: Message("The second argument can only be either 'one' or 'all'.", nil), + ErrJSONUsedAsKey: Message("JSON column '%-.192s' cannot be used in key specification.", nil), + ErrJSONDocumentNULLKey: Message("JSON documents may not contain NULL member names.", nil), + ErrBadUser: Message("User %s does not exist.", nil), + ErrUserAlreadyExists: Message("User %s already exists.", nil), + ErrInvalidJSONPathArrayCell: Message("A path expression is not a path to a cell in an array.", nil), + ErrInvalidEncryptionOption: Message("Invalid encryption option.", nil), + ErrWindowNoSuchWindow: Message("Window name '%s' is not defined.", nil), + ErrWindowCircularityInWindowGraph: Message("There is a circularity in the window dependency graph.", nil), + ErrWindowNoChildPartitioning: Message("A window which depends on another cannot define partitioning.", nil), + ErrWindowNoInherentFrame: Message("Window '%s' has a frame definition, so cannot be referenced by another window.", nil), + ErrWindowNoRedefineOrderBy: Message("Window '%s' cannot inherit '%s' since both contain an ORDER BY clause.", nil), + ErrWindowFrameStartIllegal: Message("Window '%s': frame start cannot be UNBOUNDED FOLLOWING.", nil), + ErrWindowFrameEndIllegal: Message("Window '%s': frame end cannot be UNBOUNDED PRECEDING.", nil), + ErrWindowFrameIllegal: Message("Window '%s': frame start or end is negative, NULL or of non-integral type", nil), + ErrWindowRangeFrameOrderType: Message("Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type", nil), + ErrWindowRangeFrameTemporalType: Message("Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed.", nil), + ErrWindowRangeFrameNumericType: Message("Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed.", nil), + ErrWindowRangeBoundNotConstant: Message("Window '%s' has a non-constant frame bound.", nil), + ErrWindowDuplicateName: Message("Window '%s' is defined twice.", nil), + ErrWindowIllegalOrderBy: Message("Window '%s': ORDER BY or PARTITION BY uses legacy position indication which is not supported, use expression.", nil), + ErrWindowInvalidWindowFuncUse: Message("You cannot use the window function '%s' in this context.'", nil), + ErrWindowInvalidWindowFuncAliasUse: Message("You cannot use the alias '%s' of an expression containing a window function in this context.'", nil), + ErrWindowNestedWindowFuncUseInWindowSpec: Message("You cannot nest a window function in the specification of window '%s'.", nil), + ErrWindowRowsIntervalUse: Message("Window '%s': INTERVAL can only be used with RANGE frames.", nil), + ErrWindowNoGroupOrderUnused: Message("ASC or DESC with GROUP BY isn't allowed with window functions; put ASC or DESC in ORDER BY", nil), + ErrWindowExplainJson: Message("To get information about window functions use EXPLAIN FORMAT=JSON", nil), + ErrWindowFunctionIgnoresFrame: Message("Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition", nil), + ErrRoleNotGranted: Message("%s is is not granted to %s", nil), + ErrMaxExecTimeExceeded: Message("Query execution was interrupted, max_execution_time exceeded.", nil), + ErrLockAcquireFailAndNoWaitSet: Message("Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.", nil), + ErrDataTruncatedFunctionalIndex: Message("Data truncated for functional index '%s' at row %d", nil), + ErrDataOutOfRangeFunctionalIndex: Message("Value is out of range for functional index '%s' at row %d", nil), + ErrFunctionalIndexOnJsonOrGeometryFunction: Message("Cannot create a functional index on a function that returns a JSON or GEOMETRY value", nil), + ErrFunctionalIndexRefAutoIncrement: Message("Functional index '%s' cannot refer to an auto-increment column", nil), + ErrCannotDropColumnFunctionalIndex: Message("Cannot drop column '%s' because it is used by a functional index. In order to drop the column, you must remove the functional index", nil), + ErrFunctionalIndexPrimaryKey: Message("The primary key cannot be a functional index", nil), + ErrFunctionalIndexOnLob: Message("Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST", nil), + ErrFunctionalIndexFunctionIsNotAllowed: Message("Expression of functional index '%s' contains a disallowed function", nil), + ErrFulltextFunctionalIndex: Message("Fulltext functional index is not supported", nil), + ErrSpatialFunctionalIndex: Message("Spatial functional index is not supported", nil), + ErrWrongKeyColumnFunctionalIndex: Message("The used storage engine cannot index the expression '%s'", nil), + ErrFunctionalIndexOnField: Message("Functional index on a column is not supported. Consider using a regular index instead", nil), + ErrFKIncompatibleColumns: Message("Referencing column '%s' in foreign key constraint '%s' are incompatible", nil), + ErrFunctionalIndexRowValueIsNotAllowed: Message("Expression of functional index '%s' cannot refer to a row value", nil), + ErrDependentByFunctionalIndex: Message("Column '%s' has a functional index dependency and cannot be dropped or renamed", nil), + ErrInvalidJsonValueForFuncIndex: Message("Invalid JSON value for CAST for functional index '%s'", nil), + ErrJsonValueOutOfRangeForFuncIndex: Message("Out of range JSON value for CAST for functional index '%s'", nil), + ErrFunctionalIndexDataIsTooLong: Message("Data too long for functional index '%s'", nil), + ErrFunctionalIndexNotApplicable: Message("Cannot use functional index '%s' due to type or collation conversion", nil), + + // MariaDB errors. + ErrOnlyOneDefaultPartionAllowed: Message("Only one DEFAULT partition allowed", nil), + ErrWrongPartitionTypeExpectedSystemTime: Message("Wrong partitioning type, expected type: `SYSTEM_TIME`", nil), + ErrSystemVersioningWrongPartitions: Message("Wrong Partitions: must have at least one HISTORY and exactly one last CURRENT", nil), + ErrSequenceRunOut: Message("Sequence '%-.64s.%-.64s' has run out", nil), + ErrSequenceInvalidData: Message("Sequence '%-.64s.%-.64s' values are conflicting", nil), + ErrSequenceAccessFail: Message("Sequence '%-.64s.%-.64s' access error", nil), + ErrNotSequence: Message("'%-.64s.%-.64s' is not a SEQUENCE", nil), + ErrUnknownSequence: Message("Unknown SEQUENCE: '%-.300s'", nil), + ErrWrongInsertIntoSequence: Message("Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a sequence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead.", nil), + ErrSequenceInvalidTableStructure: Message("Sequence '%-.64s.%-.64s' table structure is invalid (%s)", nil), + + // TiDB errors. + ErrWarnOptimizerHintInvalidInteger: Message("integer value is out of range in '%s'", nil), + ErrWarnOptimizerHintUnsupportedHint: Message("Optimizer hint %s is not supported by TiDB and is ignored", nil), + ErrWarnOptimizerHintInvalidToken: Message("Cannot use %s '%s' (tok = %d) in an optimizer hint", nil), + ErrWarnMemoryQuotaOverflow: Message("Max value of MEMORY_QUOTA is %d bytes, ignore this invalid limit", nil), + ErrWarnOptimizerHintParseError: Message("Optimizer hint syntax error at %v", nil), +} diff --git a/parser/mysql/error.go b/parser/mysql/error.go new file mode 100644 index 000000000..4d58d9fe2 --- /dev/null +++ b/parser/mysql/error.go @@ -0,0 +1,74 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +import ( + "fmt" + + "github.com/pingcap/errors" +) + +// Portable analogs of some common call errors. +var ( + ErrBadConn = errors.New("connection was bad") + ErrMalformPacket = errors.New("malform packet error") +) + +// SQLError records an error information, from executing SQL. +type SQLError struct { + Code uint16 + Message string + State string +} + +// Error prints errors, with a formatted string. +func (e *SQLError) Error() string { + return fmt.Sprintf("ERROR %d (%s): %s", e.Code, e.State, e.Message) +} + +// NewErr generates a SQL error, with an error code and default format specifier defined in MySQLErrName. +func NewErr(errCode uint16, args ...interface{}) *SQLError { + e := &SQLError{Code: errCode} + + if s, ok := MySQLState[errCode]; ok { + e.State = s + } else { + e.State = DefaultMySQLState + } + + if sqlErr, ok := MySQLErrName[errCode]; ok { + errors.RedactErrorArg(args, sqlErr.RedactArgPos) + e.Message = fmt.Sprintf(sqlErr.Raw, args...) + } else { + e.Message = fmt.Sprint(args...) + } + + return e +} + +// NewErrf creates a SQL error, with an error code and a format specifier. +func NewErrf(errCode uint16, format string, redactArgPos []int, args ...interface{}) *SQLError { + e := &SQLError{Code: errCode} + + if s, ok := MySQLState[errCode]; ok { + e.State = s + } else { + e.State = DefaultMySQLState + } + + errors.RedactErrorArg(args, redactArgPos) + e.Message = fmt.Sprintf(format, args...) + + return e +} diff --git a/parser/mysql/state.go b/parser/mysql/state.go new file mode 100644 index 000000000..2592d37bd --- /dev/null +++ b/parser/mysql/state.go @@ -0,0 +1,260 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package mysql + +const ( + // DefaultMySQLState is default state of the mySQL + DefaultMySQLState = "HY000" +) + +// MySQLState maps error code to MySQL SQLSTATE value. +// The values are taken from ANSI SQL and ODBC and are more standardized. +var MySQLState = map[uint16]string{ + ErrDupKey: "23000", + ErrOutofMemory: "HY001", + ErrOutOfSortMemory: "HY001", + ErrConCount: "08004", + ErrBadHost: "08S01", + ErrHandshake: "08S01", + ErrDBaccessDenied: "42000", + ErrAccessDenied: "28000", + ErrNoDB: "3D000", + ErrUnknownCom: "08S01", + ErrBadNull: "23000", + ErrBadDB: "42000", + ErrTableExists: "42S01", + ErrBadTable: "42S02", + ErrNonUniq: "23000", + ErrServerShutdown: "08S01", + ErrBadField: "42S22", + ErrFieldNotInGroupBy: "42000", + ErrWrongSumSelect: "42000", + ErrWrongGroupField: "42000", + ErrWrongValueCount: "21S01", + ErrTooLongIdent: "42000", + ErrDupFieldName: "42S21", + ErrDupKeyName: "42000", + ErrDupEntry: "23000", + ErrWrongFieldSpec: "42000", + ErrParse: "42000", + ErrEmptyQuery: "42000", + ErrNonuniqTable: "42000", + ErrInvalidDefault: "42000", + ErrMultiplePriKey: "42000", + ErrTooManyKeys: "42000", + ErrTooManyKeyParts: "42000", + ErrTooLongKey: "42000", + ErrKeyColumnDoesNotExits: "42000", + ErrBlobUsedAsKey: "42000", + ErrTooBigFieldlength: "42000", + ErrWrongAutoKey: "42000", + ErrForcingClose: "08S01", + ErrIpsock: "08S01", + ErrNoSuchIndex: "42S12", + ErrWrongFieldTerminators: "42000", + ErrBlobsAndNoTerminated: "42000", + ErrCantRemoveAllFields: "42000", + ErrCantDropFieldOrKey: "42000", + ErrBlobCantHaveDefault: "42000", + ErrWrongDBName: "42000", + ErrWrongTableName: "42000", + ErrTooBigSelect: "42000", + ErrUnknownProcedure: "42000", + ErrWrongParamcountToProcedure: "42000", + ErrUnknownTable: "42S02", + ErrFieldSpecifiedTwice: "42000", + ErrUnsupportedExtension: "42000", + ErrTableMustHaveColumns: "42000", + ErrUnknownCharacterSet: "42000", + ErrTooBigRowsize: "42000", + ErrWrongOuterJoin: "42000", + ErrNullColumnInIndex: "42000", + ErrPasswordAnonymousUser: "42000", + ErrPasswordNotAllowed: "42000", + ErrPasswordNoMatch: "42000", + ErrWrongValueCountOnRow: "21S01", + ErrInvalidUseOfNull: "22004", + ErrRegexp: "42000", + ErrMixOfGroupFuncAndFields: "42000", + ErrNonexistingGrant: "42000", + ErrTableaccessDenied: "42000", + ErrColumnaccessDenied: "42000", + ErrIllegalGrantForTable: "42000", + ErrGrantWrongHostOrUser: "42000", + ErrNoSuchTable: "42S02", + ErrNonexistingTableGrant: "42000", + ErrNotAllowedCommand: "42000", + ErrSyntax: "42000", + ErrAbortingConnection: "08S01", + ErrNetPacketTooLarge: "08S01", + ErrNetReadErrorFromPipe: "08S01", + ErrNetFcntl: "08S01", + ErrNetPacketsOutOfOrder: "08S01", + ErrNetUncompress: "08S01", + ErrNetRead: "08S01", + ErrNetReadInterrupted: "08S01", + ErrNetErrorOnWrite: "08S01", + ErrNetWriteInterrupted: "08S01", + ErrTooLongString: "42000", + ErrTableCantHandleBlob: "42000", + ErrTableCantHandleAutoIncrement: "42000", + ErrWrongColumnName: "42000", + ErrWrongKeyColumn: "42000", + ErrDupUnique: "23000", + ErrBlobKeyWithoutLength: "42000", + ErrPrimaryCantHaveNull: "42000", + ErrTooManyRows: "42000", + ErrRequiresPrimaryKey: "42000", + ErrKeyDoesNotExist: "42000", + ErrCheckNoSuchTable: "42000", + ErrCheckNotImplemented: "42000", + ErrCantDoThisDuringAnTransaction: "25000", + ErrNewAbortingConnection: "08S01", + ErrMasterNetRead: "08S01", + ErrMasterNetWrite: "08S01", + ErrTooManyUserConnections: "42000", + ErrReadOnlyTransaction: "25000", + ErrNoPermissionToCreateUser: "42000", + ErrLockDeadlock: "40001", + ErrNoReferencedRow: "23000", + ErrRowIsReferenced: "23000", + ErrConnectToMaster: "08S01", + ErrWrongNumberOfColumnsInSelect: "21000", + ErrUserLimitReached: "42000", + ErrSpecificAccessDenied: "42000", + ErrNoDefault: "42000", + ErrWrongValueForVar: "42000", + ErrWrongTypeForVar: "42000", + ErrCantUseOptionHere: "42000", + ErrNotSupportedYet: "42000", + ErrWrongFkDef: "42000", + ErrOperandColumns: "21000", + ErrSubqueryNo1Row: "21000", + ErrIllegalReference: "42S22", + ErrDerivedMustHaveAlias: "42000", + ErrSelectReduced: "01000", + ErrTablenameNotAllowedHere: "42000", + ErrNotSupportedAuthMode: "08004", + ErrSpatialCantHaveNull: "42000", + ErrCollationCharsetMismatch: "42000", + ErrWarnTooFewRecords: "01000", + ErrWarnTooManyRecords: "01000", + ErrWarnNullToNotnull: "22004", + ErrWarnDataOutOfRange: "22003", + WarnDataTruncated: "01000", + ErrWrongNameForIndex: "42000", + ErrWrongNameForCatalog: "42000", + ErrUnknownStorageEngine: "42000", + ErrTruncatedWrongValue: "22007", + ErrSpNoRecursiveCreate: "2F003", + ErrSpAlreadyExists: "42000", + ErrSpDoesNotExist: "42000", + ErrSpLilabelMismatch: "42000", + ErrSpLabelRedefine: "42000", + ErrSpLabelMismatch: "42000", + ErrSpUninitVar: "01000", + ErrSpBadselect: "0A000", + ErrSpBadreturn: "42000", + ErrSpBadstatement: "0A000", + ErrUpdateLogDeprecatedIgnored: "42000", + ErrUpdateLogDeprecatedTranslated: "42000", + ErrQueryInterrupted: "70100", + ErrSpWrongNoOfArgs: "42000", + ErrSpCondMismatch: "42000", + ErrSpNoreturn: "42000", + ErrSpNoreturnend: "2F005", + ErrSpBadCursorQuery: "42000", + ErrSpBadCursorSelect: "42000", + ErrSpCursorMismatch: "42000", + ErrSpCursorAlreadyOpen: "24000", + ErrSpCursorNotOpen: "24000", + ErrSpUndeclaredVar: "42000", + ErrSpFetchNoData: "02000", + ErrSpDupParam: "42000", + ErrSpDupVar: "42000", + ErrSpDupCond: "42000", + ErrSpDupCurs: "42000", + ErrSpSubselectNyi: "0A000", + ErrStmtNotAllowedInSfOrTrg: "0A000", + ErrSpVarcondAfterCurshndlr: "42000", + ErrSpCursorAfterHandler: "42000", + ErrSpCaseNotFound: "20000", + ErrDivisionByZero: "22012", + ErrIllegalValueForType: "22007", + ErrProcaccessDenied: "42000", + ErrXaerNota: "XAE04", + ErrXaerInval: "XAE05", + ErrXaerRmfail: "XAE07", + ErrXaerOutside: "XAE09", + ErrXaerRmerr: "XAE03", + ErrXaRbrollback: "XA100", + ErrNonexistingProcGrant: "42000", + ErrDataTooLong: "22001", + ErrSpBadSQLstate: "42000", + ErrCantCreateUserWithGrant: "42000", + ErrSpDupHandler: "42000", + ErrSpNotVarArg: "42000", + ErrSpNoRetset: "0A000", + ErrCantCreateGeometryObject: "22003", + ErrTooBigScale: "42000", + ErrTooBigPrecision: "42000", + ErrMBiggerThanD: "42000", + ErrTooLongBody: "42000", + ErrTooBigDisplaywidth: "42000", + ErrXaerDupid: "XAE08", + ErrDatetimeFunctionOverflow: "22008", + ErrRowIsReferenced2: "23000", + ErrNoReferencedRow2: "23000", + ErrSpBadVarShadow: "42000", + ErrSpWrongName: "42000", + ErrSpNoAggregate: "42000", + ErrMaxPreparedStmtCountReached: "42000", + ErrNonGroupingFieldUsed: "42000", + ErrForeignDuplicateKeyOldUnused: "23000", + ErrCantChangeTxCharacteristics: "25001", + ErrWrongParamcountToNativeFct: "42000", + ErrWrongParametersToNativeFct: "42000", + ErrWrongParametersToStoredFct: "42000", + ErrDupEntryWithKeyName: "23000", + ErrXaRbtimeout: "XA106", + ErrXaRbdeadlock: "XA102", + ErrFuncInexistentNameCollision: "42000", + ErrDupSignalSet: "42000", + ErrSignalWarn: "01000", + ErrSignalNotFound: "02000", + ErrSignalException: "HY000", + ErrResignalWithoutActiveHandler: "0K000", + ErrSpatialMustHaveGeomCol: "42000", + ErrDataOutOfRange: "22003", + ErrAccessDeniedNoPassword: "28000", + ErrTruncateIllegalFk: "42000", + ErrDaInvalidConditionNumber: "35000", + ErrForeignDuplicateKeyWithChildInfo: "23000", + ErrForeignDuplicateKeyWithoutChildInfo: "23000", + ErrCantExecuteInReadOnlyTransaction: "25006", + ErrAlterOperationNotSupported: "0A000", + ErrAlterOperationNotSupportedReason: "0A000", + ErrDupUnknownInIndex: "23000", + ErrBadGeneratedColumn: "HY000", + ErrUnsupportedOnGeneratedColumn: "HY000", + ErrGeneratedColumnNonPrior: "HY000", + ErrDependentByGeneratedColumn: "HY000", + ErrInvalidJSONText: "22032", + ErrInvalidJSONPath: "42000", + ErrInvalidJSONData: "22032", + ErrInvalidJSONPathWildcard: "42000", + ErrJSONUsedAsKey: "42000", + ErrJSONDocumentNULLKey: "22032", + ErrInvalidJSONPathArrayCell: "42000", +} diff --git a/parser/terror/terror.go b/parser/terror/terror.go new file mode 100644 index 000000000..16b398c43 --- /dev/null +++ b/parser/terror/terror.go @@ -0,0 +1,303 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package terror + +import ( + "fmt" + "strconv" + "strings" + "sync" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + "go.uber.org/zap" + "tinysql/parser/mysql" +) + +// ErrCode represents a specific error type in a error class. +// Same error code can be used in different error classes. +type ErrCode int + +const ( + // Executor error codes. + + // CodeUnknown is for errors of unknown reason. + CodeUnknown ErrCode = -1 + // CodeExecResultIsEmpty indicates execution result is empty. + CodeExecResultIsEmpty ErrCode = 3 + + // Expression error codes. + + // CodeMissConnectionID indicates connection id is missing. + CodeMissConnectionID ErrCode = 1 + + // Special error codes. + + // CodeResultUndetermined indicates the sql execution result is undetermined. + CodeResultUndetermined ErrCode = 2 +) + +// ErrClass represents a class of errors. +type ErrClass int + +type Error = errors.Error + +// Error classes. +var ( + ClassAutoid = RegisterErrorClass(1, "autoid") + ClassDDL = RegisterErrorClass(2, "ddl") + ClassDomain = RegisterErrorClass(3, "domain") + ClassEvaluator = RegisterErrorClass(4, "evaluator") + ClassExecutor = RegisterErrorClass(5, "executor") + ClassExpression = RegisterErrorClass(6, "expression") + ClassAdmin = RegisterErrorClass(7, "admin") + ClassKV = RegisterErrorClass(8, "kv") + ClassMeta = RegisterErrorClass(9, "meta") + ClassOptimizer = RegisterErrorClass(10, "planner") + ClassParser = RegisterErrorClass(11, "parser") + ClassPerfSchema = RegisterErrorClass(12, "perfschema") + ClassPrivilege = RegisterErrorClass(13, "privilege") + ClassSchema = RegisterErrorClass(14, "schema") + ClassServer = RegisterErrorClass(15, "server") + ClassStructure = RegisterErrorClass(16, "structure") + ClassVariable = RegisterErrorClass(17, "variable") + ClassXEval = RegisterErrorClass(18, "xeval") + ClassTable = RegisterErrorClass(19, "table") + ClassTypes = RegisterErrorClass(20, "types") + ClassGlobal = RegisterErrorClass(21, "global") + ClassMockTikv = RegisterErrorClass(22, "mocktikv") + ClassJSON = RegisterErrorClass(23, "json") + ClassTiKV = RegisterErrorClass(24, "tikv") + ClassSession = RegisterErrorClass(25, "session") + ClassPlugin = RegisterErrorClass(26, "plugin") + ClassUtil = RegisterErrorClass(27, "util") + // Add more as needed. +) + +var errClass2Desc = make(map[ErrClass]string) +var rfcCode2errClass = newCode2ErrClassMap() + +type code2ErrClassMap struct { + data sync.Map +} + +func newCode2ErrClassMap() *code2ErrClassMap { + return &code2ErrClassMap{ + data: sync.Map{}, + } +} + +func (m *code2ErrClassMap) Get(key string) (ErrClass, bool) { + ret, have := m.data.Load(key) + return ret.(ErrClass), have +} + +func (m *code2ErrClassMap) Put(key string, err ErrClass) { + m.data.Store(key, err) +} + +// RegisterErrorClass registers new error class for terror. +func RegisterErrorClass(classCode int, desc string) ErrClass { + errClass := ErrClass(classCode) + if _, exists := errClass2Desc[errClass]; exists { + panic(fmt.Sprintf("duplicate register ClassCode %d - %s", classCode, desc)) + } + errClass2Desc[errClass] = desc + return errClass +} + +// String implements fmt.Stringer interface. +func (ec ErrClass) String() string { + if s, exists := errClass2Desc[ec]; exists { + return s + } + return strconv.Itoa(int(ec)) +} + +// EqualClass returns true if err is *Error with the same class. +func (ec ErrClass) EqualClass(err error) bool { + e := errors.Cause(err) + if e == nil { + return false + } + if te, ok := e.(*Error); ok { + rfcCode := te.RFCCode() + if index := strings.Index(string(rfcCode), ":"); index > 0 { + if class, has := rfcCode2errClass.Get(string(rfcCode)[:index]); has { + return class == ec + } + } + } + return false +} + +// NotEqualClass returns true if err is not *Error with the same class. +func (ec ErrClass) NotEqualClass(err error) bool { + return !ec.EqualClass(err) +} + +func (ec ErrClass) initError(code ErrCode) string { + clsMap, ok := ErrClassToMySQLCodes[ec] + if !ok { + clsMap = make(map[ErrCode]struct{}) + ErrClassToMySQLCodes[ec] = clsMap + } + clsMap[code] = struct{}{} + class := errClass2Desc[ec] + rfcCode := fmt.Sprintf("%s:%d", class, code) + rfcCode2errClass.Put(class, ec) + return rfcCode +} + +// New defines an *Error with an error code and an error message. +// Usually used to create base *Error. +// Attention: +// this method is not goroutine-safe and +// usually be used in global variable initializer +// +// Deprecated: use NewStd or NewStdErr instead. +func (ec ErrClass) New(code ErrCode, message string) *Error { + rfcCode := ec.initError(code) + err := errors.Normalize(message, errors.MySQLErrorCode(int(code)), errors.RFCCodeText(rfcCode)) + return err +} + +// NewStdErr defines an *Error with an error code, an error +// message and workaround to create standard error. +func (ec ErrClass) NewStdErr(code ErrCode, message *mysql.ErrMessage) *Error { + rfcCode := ec.initError(code) + err := errors.Normalize(message.Raw, errors.RedactArgs(message.RedactArgPos), errors.MySQLErrorCode(int(code)), errors.RFCCodeText(rfcCode)) + return err +} + +// NewStd calls New using the standard message for the error code +// Attention: +// this method is not goroutine-safe and +// usually be used in global variable initializer +func (ec ErrClass) NewStd(code ErrCode) *Error { + return ec.NewStdErr(code, mysql.MySQLErrName[uint16(code)]) +} + +// Synthesize synthesizes an *Error in the air +// it didn't register error into ErrClassToMySQLCodes +// so it's goroutine-safe +// and often be used to create Error came from other systems like TiKV. +func (ec ErrClass) Synthesize(code ErrCode, message string) *Error { + return errors.Normalize(message, errors.MySQLErrorCode(int(code)), errors.RFCCodeText(fmt.Sprintf("%s:%d", errClass2Desc[ec], code))) +} + +// ToSQLError convert Error to mysql.SQLError. +func ToSQLError(e *Error) *mysql.SQLError { + code := getMySQLErrorCode(e) + return mysql.NewErrf(code, "%s", nil, e.GetMsg()) +} + +var defaultMySQLErrorCode uint16 + +func getMySQLErrorCode(e *Error) uint16 { + rfcCode := e.RFCCode() + var class ErrClass + if index := strings.Index(string(rfcCode), ":"); index > 0 { + if ec, has := rfcCode2errClass.Get(string(rfcCode)[:index]); has { + class = ec + } else { + log.Warn("Unknown error class", zap.String("class", string(rfcCode)[:index])) + return defaultMySQLErrorCode + } + } + codeMap, ok := ErrClassToMySQLCodes[class] + if !ok { + log.Warn("Unknown error class", zap.Int("class", int(class))) + return defaultMySQLErrorCode + } + _, ok = codeMap[ErrCode(e.Code())] + if !ok { + log.Debug("Unknown error code", zap.Int("class", int(class)), zap.Int("code", int(e.Code()))) + return defaultMySQLErrorCode + } + return uint16(e.Code()) +} + +var ( + // ErrClassToMySQLCodes is the map of ErrClass to code-set. + ErrClassToMySQLCodes = make(map[ErrClass]map[ErrCode]struct{}) + ErrCritical = ClassGlobal.NewStdErr(CodeExecResultIsEmpty, mysql.Message("critical error %v", nil)) + ErrResultUndetermined = ClassGlobal.NewStdErr(CodeResultUndetermined, mysql.Message("execution result undetermined", nil)) +) + +func init() { + defaultMySQLErrorCode = mysql.ErrUnknown +} + +// ErrorEqual returns a boolean indicating whether err1 is equal to err2. +func ErrorEqual(err1, err2 error) bool { + e1 := errors.Cause(err1) + e2 := errors.Cause(err2) + + if e1 == e2 { + return true + } + + if e1 == nil || e2 == nil { + return e1 == e2 + } + + te1, ok1 := e1.(*Error) + te2, ok2 := e2.(*Error) + if ok1 && ok2 { + return te1.RFCCode() == te2.RFCCode() + } + + return e1.Error() == e2.Error() +} + +// ErrorNotEqual returns a boolean indicating whether err1 isn't equal to err2. +func ErrorNotEqual(err1, err2 error) bool { + return !ErrorEqual(err1, err2) +} + +// MustNil cleans up and fatals if err is not nil. +func MustNil(err error, closeFuns ...func()) { + if err != nil { + for _, f := range closeFuns { + f() + } + log.Fatal("unexpected error", zap.Error(err), zap.Stack("stack")) + } +} + +// Call executes a function and checks the returned err. +func Call(fn func() error) { + err := fn() + if err != nil { + log.Error("function call errored", zap.Error(err), zap.Stack("stack")) + } +} + +// Log logs the error if it is not nil. +func Log(err error) { + if err != nil { + log.Error("encountered error", zap.Error(err), zap.Stack("stack")) + } +} + +func GetErrClass(e *Error) ErrClass { + rfcCode := e.RFCCode() + if index := strings.Index(string(rfcCode), ":"); index > 0 { + if class, has := rfcCode2errClass.Get(string(rfcCode)[:index]); has { + return class + } + } + return ErrClass(-1) +} diff --git a/server/buffered_read_conn.go b/server/buffered_read_conn.go new file mode 100644 index 000000000..cbd932ff7 --- /dev/null +++ b/server/buffered_read_conn.go @@ -0,0 +1,39 @@ +// Copyright 2017 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server + +import ( + "bufio" + "net" +) + +const defaultReaderSize = 16 * 1024 + +// bufferedReadConn is a net.Conn compatible structure that reads from bufio.Reader. +type bufferedReadConn struct { + net.Conn + rb *bufio.Reader +} + +func (conn bufferedReadConn) Read(b []byte) (n int, err error) { + return conn.rb.Read(b) +} + +func newBufferedReadConn(conn net.Conn) *bufferedReadConn { + return &bufferedReadConn{ + Conn: conn, + rb: bufio.NewReaderSize(conn, defaultReaderSize), + } +} diff --git a/server/conn.go b/server/conn.go new file mode 100644 index 000000000..454bbde3c --- /dev/null +++ b/server/conn.go @@ -0,0 +1,969 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// The MIT License (MIT) +// +// Copyright (c) 2014 wandoulabs +// Copyright (c) 2014 siddontang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +package server + +import ( + "bytes" + "context" + "crypto/tls" + "encoding/binary" + "fmt" + "io" + "net" + "runtime" + "runtime/trace" + "strings" + "sync" + "sync/atomic" + "time" + + "tinysql/parser/mysql" + "tinysql/parser/terror" + "tinysql/session" + "tinysql/util/arena" + "tinysql/util/hack" + "tinysql/util/logutil" + "github.com/pingcap/errors" + "go.uber.org/zap" +) + +const ( + connStatusDispatching int32 = iota + connStatusReading + connStatusShutdown // Closed by server. + connStatusWaitShutdown // Notified by server to close. +) + +// newClientConn creates a *clientConn object. +func newClientConn(s *Server) *clientConn { + return &clientConn{ + server: s, + connectionID: s.globalConnID.NextID(), + collation: mysql.DefaultCollationID, + alloc: arena.NewAllocator(32 * 1024), + status: connStatusDispatching, + lastActive: time.Now(), + authPlugin: mysql.AuthNativePassword, + } +} + +// clientConn represents a connection between server and client, it maintains connection specific state, +// handles client query. +type clientConn struct { + pkt *packetIO // a helper to read and write data in packet format. + bufReadConn *bufferedReadConn // a buffered-read net.Conn or buffered-read tls.Conn. + tlsConn *tls.Conn // TLS connection, nil if not TLS. + server *Server // a reference of server instance. + capability uint32 // client capability affects the way server handles client request. + connectionID uint64 // atomically allocated by a global variable, unique in process scope. + user string // user of the client. + dbname string // default database name. + salt []byte // random bytes used for authentication. + alloc arena.Allocator // an memory allocator for reducing memory allocation. + lastPacket []byte // latest sql query string, currently used for logging error. + ctx *TiDBContext // an interface to execute sql statements. + attrs map[string]string // attributes parsed from client handshake response, not used for now. + peerHost string // peer host + peerPort string // peer port + status int32 // dispatching/reading/shutdown/waitshutdown + lastCode uint16 // last error code + collation uint8 // collation used by client, may be different from the collation used by database. + lastActive time.Time // last active time + authPlugin string // default authentication plugin + isUnixSocket bool // connection is Unix Socket file + + // mu is used for cancelling the execution of current transaction. + mu struct { + sync.RWMutex + cancelFunc context.CancelFunc + } +} + +func (cc *clientConn) String() string { + // collationStr := mysql.Collations[cc.collation] + // return fmt.Sprintf("id:%d, addr:%s status:%b, collation:%s, user:%s", + // cc.connectionID, cc.bufReadConn.RemoteAddr(), cc.ctx.Status(), collationStr, cc.user, + // ) + return "TODO" +} + +// authSwitchRequest is used by the server to ask the client to switch to a different authentication +// plugin. MySQL 8.0 libmysqlclient based clients by default always try `caching_sha2_password`, even +// when the server advertises the its default to be `mysql_native_password`. In addition to this switching +// may be needed on a per user basis as the authentication method is set per user. +// https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest +// https://bugs.mysql.com/bug.php?id=93044 +func (cc *clientConn) authSwitchRequest(ctx context.Context, plugin string) ([]byte, error) { + enclen := 1 + len(plugin) + 1 + len(cc.salt) + 1 + data := cc.alloc.AllocWithLen(4, enclen) + data = append(data, mysql.AuthSwitchRequest) // switch request + data = append(data, []byte(plugin)...) + data = append(data, byte(0x00)) // requires null + data = append(data, cc.salt...) + data = append(data, 0) + err := cc.writePacket(data) + if err != nil { + logutil.Logger(ctx).Debug("write response to client failed", zap.Error(err)) + return nil, err + } + err = cc.flush(ctx) + if err != nil { + logutil.Logger(ctx).Debug("flush response to client failed", zap.Error(err)) + return nil, err + } + resp, err := cc.readPacket() + if err != nil { + err = errors.SuspendStack(err) + if errors.Cause(err) == io.EOF { + logutil.Logger(ctx).Warn("authSwitchRequest response fail due to connection has be closed by client-side") + } else { + logutil.Logger(ctx).Warn("authSwitchRequest response fail", zap.Error(err)) + } + return nil, err + } + cc.authPlugin = plugin + return resp, nil +} + +// handshake works like TCP handshake, but in a higher level, it first writes initial packet to client, +// during handshake, client and server negotiate compatible features and do authentication. +// After handshake, client can send sql query to server. +func (cc *clientConn) handshake(ctx context.Context) error { + if err := cc.writeInitialHandshake(ctx); err != nil { + if errors.Cause(err) == io.EOF { + logutil.Logger(ctx).Debug("Could not send handshake due to connection has be closed by client-side") + } else { + logutil.Logger(ctx).Debug("Write init handshake to client fail", zap.Error(errors.SuspendStack(err))) + } + return err + } + if err := cc.readOptionalSSLRequestAndHandshakeResponse(ctx); err != nil { + err1 := cc.writeError(ctx, err) + if err1 != nil { + logutil.Logger(ctx).Debug("writeError failed", zap.Error(err1)) + } + return err + } + + data := cc.alloc.AllocWithLen(4, 32) + data = append(data, mysql.OKHeader) + data = append(data, 0, 0) + if cc.capability&mysql.ClientProtocol41 > 0 { + data = dumpUint16(data, mysql.ServerStatusAutocommit) + data = append(data, 0, 0) + } + + err := cc.writePacket(data) + cc.pkt.sequence = 0 + if err != nil { + err = errors.SuspendStack(err) + logutil.Logger(ctx).Debug("write response to client failed", zap.Error(err)) + return err + } + + err = cc.flush(ctx) + if err != nil { + err = errors.SuspendStack(err) + logutil.Logger(ctx).Debug("flush response to client failed", zap.Error(err)) + return err + } + return err +} + +func (cc *clientConn) Close() error { + cc.server.rwlock.Lock() + delete(cc.server.clients, cc.connectionID) + connections := len(cc.server.clients) + cc.server.rwlock.Unlock() + return closeConn(cc, connections) +} + +func closeConn(cc *clientConn, connections int) error { + err := cc.bufReadConn.Close() + terror.Log(err) + return nil +} + +func (cc *clientConn) closeWithoutLock() error { + delete(cc.server.clients, cc.connectionID) + return closeConn(cc, len(cc.server.clients)) +} + +// writeInitialHandshake sends server version, connection ID, server capability, collation, server status +// and auth salt to the client. +func (cc *clientConn) writeInitialHandshake(ctx context.Context) error { + data := make([]byte, 4, 128) + + // min version 10 + data = append(data, 10) + // server version[00] + data = append(data, mysql.ServerVersion...) + data = append(data, 0) + // connection id + data = append(data, byte(cc.connectionID), byte(cc.connectionID>>8), byte(cc.connectionID>>16), byte(cc.connectionID>>24)) + // auth-plugin-data-part-1 + data = append(data, cc.salt[0:8]...) + // filler [00] + data = append(data, 0) + // capability flag lower 2 bytes, using default capability here + data = append(data, byte(cc.server.capability), byte(cc.server.capability>>8)) + // charset + if cc.collation == 0 { + cc.collation = uint8(mysql.DefaultCollationID) + } + data = append(data, cc.collation) + // status + data = dumpUint16(data, mysql.ServerStatusAutocommit) + // below 13 byte may not be used + // capability flag upper 2 bytes, using default capability here + data = append(data, byte(cc.server.capability>>16), byte(cc.server.capability>>24)) + // length of auth-plugin-data + data = append(data, byte(len(cc.salt)+1)) + // reserved 10 [00] + data = append(data, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + // auth-plugin-data-part-2 + data = append(data, cc.salt[8:]...) + data = append(data, 0) + // auth-plugin name + if cc.ctx == nil { + err := cc.openSession() + if err != nil { + return err + } + } + + defAuthPlugin := "mysql_native_password" + cc.authPlugin = defAuthPlugin + data = append(data, []byte(defAuthPlugin)...) + data = append(data, 0) + err := cc.writePacket(data) + if err != nil { + return err + } + return cc.flush(ctx) +} + +func (cc *clientConn) readPacket() ([]byte, error) { + return cc.pkt.readPacket() +} + +func (cc *clientConn) writePacket(data []byte) error { + return cc.pkt.writePacket(data) +} + +// getSessionVarsWaitTimeout get session variable wait_timeout +func (cc *clientConn) getSessionVarsWaitTimeout(ctx context.Context) uint64 { + // Let’s simply set it to 0 now. + return 0 +} + +type handshakeResponse41 struct { + Capability uint32 + Collation uint8 + User string + DBName string + Auth []byte + AuthPlugin string + Attrs map[string]string +} + +// parseOldHandshakeResponseHeader parses the old version handshake header HandshakeResponse320 +func parseOldHandshakeResponseHeader(ctx context.Context, packet *handshakeResponse41, data []byte) (parsedBytes int, err error) { + // Ensure there are enough data to read: + // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse320 + logutil.Logger(ctx).Debug("try to parse hanshake response as Protocol::HandshakeResponse320", zap.ByteString("packetData", data)) + if len(data) < 2+3 { + logutil.Logger(ctx).Error("got malformed handshake response", zap.ByteString("packetData", data)) + return 0, mysql.ErrMalformPacket + } + offset := 0 + // capability + capability := binary.LittleEndian.Uint16(data[:2]) + packet.Capability = uint32(capability) + + // be compatible with Protocol::HandshakeResponse41 + packet.Capability |= mysql.ClientProtocol41 + + offset += 2 + // skip max packet size + offset += 3 + // usa default CharsetID + packet.Collation = mysql.CollationNames["utf8mb4_general_ci"] + + return offset, nil +} + +// parseOldHandshakeResponseBody parse the HandshakeResponse for Protocol::HandshakeResponse320 (except the common header part). +func parseOldHandshakeResponseBody(ctx context.Context, packet *handshakeResponse41, data []byte, offset int) (err error) { + defer func() { + // Check malformat packet cause out of range is disgusting, but don't panic! + if r := recover(); r != nil { + logutil.Logger(ctx).Error("handshake panic", zap.ByteString("packetData", data), zap.Stack("stack")) + err = mysql.ErrMalformPacket + } + }() + // user name + packet.User = string(data[offset : offset+bytes.IndexByte(data[offset:], 0)]) + offset += len(packet.User) + 1 + + if packet.Capability&mysql.ClientConnectWithDB > 0 { + if len(data[offset:]) > 0 { + idx := bytes.IndexByte(data[offset:], 0) + packet.DBName = string(data[offset : offset+idx]) + offset = offset + idx + 1 + } + if len(data[offset:]) > 0 { + packet.Auth = data[offset : offset+bytes.IndexByte(data[offset:], 0)] + } + } else { + packet.Auth = data[offset : offset+bytes.IndexByte(data[offset:], 0)] + } + + return nil +} + +// parseHandshakeResponseHeader parses the common header of SSLRequest and HandshakeResponse41. +func parseHandshakeResponseHeader(ctx context.Context, packet *handshakeResponse41, data []byte) (parsedBytes int, err error) { + // Ensure there are enough data to read: + // http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest + if len(data) < 4+4+1+23 { + logutil.Logger(ctx).Error("got malformed handshake response", zap.ByteString("packetData", data)) + return 0, mysql.ErrMalformPacket + } + + offset := 0 + // capability + capability := binary.LittleEndian.Uint32(data[:4]) + packet.Capability = capability + offset += 4 + // skip max packet size + offset += 4 + // charset, skip, if you want to use another charset, use set names + packet.Collation = data[offset] + offset++ + // skip reserved 23[00] + offset += 23 + + return offset, nil +} + +// parseHandshakeResponseBody parse the HandshakeResponse (except the common header part). +func parseHandshakeResponseBody(ctx context.Context, packet *handshakeResponse41, data []byte, offset int) (err error) { + defer func() { + // Check malformat packet cause out of range is disgusting, but don't panic! + if r := recover(); r != nil { + logutil.Logger(ctx).Error("handshake panic", zap.ByteString("packetData", data)) + err = mysql.ErrMalformPacket + } + }() + // user name + packet.User = string(data[offset : offset+bytes.IndexByte(data[offset:], 0)]) + offset += len(packet.User) + 1 + + if packet.Capability&mysql.ClientPluginAuthLenencClientData > 0 { + // MySQL client sets the wrong capability, it will set this bit even server doesn't + // support ClientPluginAuthLenencClientData. + // https://github.com/mysql/mysql-server/blob/5.7/sql-common/client.c#L3478 + if data[offset] == 0x1 { // No auth data + offset += 2 + } else { + num, null, off := parseLengthEncodedInt(data[offset:]) + offset += off + if !null { + packet.Auth = data[offset : offset+int(num)] + offset += int(num) + } + } + } else if packet.Capability&mysql.ClientSecureConnection > 0 { + // auth length and auth + authLen := int(data[offset]) + offset++ + packet.Auth = data[offset : offset+authLen] + offset += authLen + } else { + packet.Auth = data[offset : offset+bytes.IndexByte(data[offset:], 0)] + offset += len(packet.Auth) + 1 + } + + if packet.Capability&mysql.ClientConnectWithDB > 0 { + if len(data[offset:]) > 0 { + idx := bytes.IndexByte(data[offset:], 0) + packet.DBName = string(data[offset : offset+idx]) + offset += idx + 1 + } + } + + if packet.Capability&mysql.ClientPluginAuth > 0 { + idx := bytes.IndexByte(data[offset:], 0) + s := offset + f := offset + idx + if s < f { // handle unexpected bad packets + packet.AuthPlugin = string(data[s:f]) + } + offset += idx + 1 + } + + if packet.Capability&mysql.ClientConnectAtts > 0 { + if len(data[offset:]) == 0 { + // Defend some ill-formated packet, connection attribute is not important and can be ignored. + return nil + } + if num, null, off := parseLengthEncodedInt(data[offset:]); !null { + offset += off + row := data[offset : offset+int(num)] + attrs, err := parseAttrs(row) + if err != nil { + logutil.Logger(ctx).Warn("parse attrs failed", zap.Error(err)) + return nil + } + packet.Attrs = attrs + } + } + + return nil +} + +func parseAttrs(data []byte) (map[string]string, error) { + attrs := make(map[string]string) + pos := 0 + for pos < len(data) { + key, _, off, err := parseLengthEncodedBytes(data[pos:]) + if err != nil { + return attrs, err + } + pos += off + value, _, off, err := parseLengthEncodedBytes(data[pos:]) + if err != nil { + return attrs, err + } + pos += off + + attrs[string(key)] = string(value) + } + return attrs, nil +} + +func (cc *clientConn) readOptionalSSLRequestAndHandshakeResponse(ctx context.Context) error { + // Read a packet. It may be a SSLRequest or HandshakeResponse. + data, err := cc.readPacket() + if err != nil { + err = errors.SuspendStack(err) + if errors.Cause(err) == io.EOF { + logutil.Logger(ctx).Debug("wait handshake response fail due to connection has be closed by client-side") + } else { + logutil.Logger(ctx).Debug("wait handshake response fail", zap.Error(err)) + } + return err + } + + isOldVersion := false + + var resp handshakeResponse41 + var pos int + + if len(data) < 2 { + logutil.Logger(ctx).Error("got malformed handshake response", zap.ByteString("packetData", data)) + return mysql.ErrMalformPacket + } + + capability := uint32(binary.LittleEndian.Uint16(data[:2])) + if capability&mysql.ClientProtocol41 > 0 { + pos, err = parseHandshakeResponseHeader(ctx, &resp, data) + } else { + pos, err = parseOldHandshakeResponseHeader(ctx, &resp, data) + isOldVersion = true + } + + if err != nil { + terror.Log(err) + return err + } + + if resp.Capability&mysql.ClientSSL > 0 { + err := errSecureTransportRequired.FastGenByArgs() + terror.Log(err) + return err + } + + // Read the remaining part of the packet. + if isOldVersion { + err = parseOldHandshakeResponseBody(ctx, &resp, data, pos) + } else { + err = parseHandshakeResponseBody(ctx, &resp, data, pos) + } + if err != nil { + terror.Log(err) + return err + } + + cc.capability = resp.Capability & cc.server.capability + cc.user = resp.User + cc.dbname = resp.DBName + cc.collation = resp.Collation + cc.attrs = resp.Attrs + + newAuth, err := cc.checkAuthPlugin(ctx, &resp.AuthPlugin) + if err != nil { + logutil.Logger(ctx).Warn("failed to check the user authplugin", zap.Error(err)) + } + if len(newAuth) > 0 { + resp.Auth = newAuth + } + + err = cc.openSessionAndDoAuth(resp.Auth) + if err != nil { + logutil.Logger(ctx).Warn("open new session or authentication failure", zap.Error(err)) + } + return err +} + +func (cc *clientConn) authSha(ctx context.Context) ([]byte, error) { + + const ( + ShaCommand = 1 + RequestRsaPubKey = 2 + FastAuthOk = 3 + FastAuthFail = 4 + ) + + err := cc.writePacket([]byte{0, 0, 0, 0, ShaCommand, FastAuthFail}) + if err != nil { + logutil.Logger(ctx).Error("authSha packet write failed", zap.Error(err)) + return nil, err + } + err = cc.flush(ctx) + if err != nil { + logutil.Logger(ctx).Error("authSha packet flush failed", zap.Error(err)) + return nil, err + } + + data, err := cc.readPacket() + if err != nil { + logutil.Logger(ctx).Error("authSha packet read failed", zap.Error(err)) + return nil, err + } + return bytes.Trim(data, "\x00"), nil +} + +func (cc *clientConn) SessionStatusToString() string { + return "session status" +} + +func (cc *clientConn) openSession() error { + se, err := session.CreateSession() + if err != nil { + return err + } + cc.ctx = &TiDBContext{ + Session: se, + } + return nil +} + +func (cc *clientConn) openSessionAndDoAuth(authData []byte) error { + return nil +} + +// Check if the Authentication Plugin of the server, client and user configuration matches +func (cc *clientConn) checkAuthPlugin(ctx context.Context, authPlugin *string) ([]byte, error) { + return nil, nil +} + +func (cc *clientConn) PeerHost(hasPassword string) (host, port string, err error) { + if len(cc.peerHost) > 0 { + return cc.peerHost, "", nil + } + // host = variable.DefHostname + host = "localhost" + if cc.isUnixSocket { + cc.peerHost = host + return + } + addr := cc.bufReadConn.RemoteAddr().String() + host, port, err = net.SplitHostPort(addr) + if err != nil { + err = errAccessDenied.GenWithStackByArgs(cc.user, addr, hasPassword) + return + } + cc.peerHost = host + cc.peerPort = port + return +} + +// skipInitConnect follows MySQL's rules of when init-connect should be skipped. +// In 5.7 it is any user with SUPER privilege, but in 8.0 it is: +// - SUPER or the CONNECTION_ADMIN dynamic privilege. +// - (additional exception) users with expired passwords (not yet supported) +// In TiDB CONNECTION_ADMIN is satisfied by SUPER, so we only need to check once. +func (cc *clientConn) skipInitConnect() bool { + // checker := privilege.GetPrivilegeManager(cc.ctx.Session) + // activeRoles := cc.ctx.GetSessionVars().ActiveRoles + // return checker != nil && checker.RequestDynamicVerification(activeRoles, "CONNECTION_ADMIN", false) + return false +} + +// Run reads client query and writes query result to client in for loop, if there is a panic during query handling, +// it will be recovered and log the panic error. +// This function returns and the connection is closed if there is an IO error or there is a panic. +func (cc *clientConn) Run(ctx context.Context) { + const size = 4096 + defer func() { + r := recover() + if r != nil { + buf := make([]byte, size) + stackSize := runtime.Stack(buf, false) + buf = buf[:stackSize] + logutil.Logger(ctx).Error("connection running loop panic", + // zap.Stringer("lastSQL", getLastStmtInConn{cc}), + zap.String("err", fmt.Sprintf("%v", r)), + zap.String("stack", string(buf)), + ) + err := cc.writeError(ctx, errors.New(fmt.Sprintf("%v", r))) + terror.Log(err) + // metrics.PanicCounter.WithLabelValues(metrics.LabelSession).Inc() + } + if atomic.LoadInt32(&cc.status) != connStatusShutdown { + err := cc.Close() + terror.Log(err) + } + }() + // Usually, client connection status changes between [dispatching] <=> [reading]. + // When some event happens, server may notify this client connection by setting + // the status to special values, for example: kill or graceful shutdown. + // The client connection would detect the events when it fails to change status + // by CAS operation, it would then take some actions accordingly. + for { + if !atomic.CompareAndSwapInt32(&cc.status, connStatusDispatching, connStatusReading) || + // The judge below will not be hit by all means, + // But keep it stayed as a reminder and for the code reference for connStatusWaitShutdown. + atomic.LoadInt32(&cc.status) == connStatusWaitShutdown { + return + } + + cc.alloc.Reset() + // close connection when idle time is more than wait_timeout + waitTimeout := cc.getSessionVarsWaitTimeout(ctx) + cc.pkt.setReadTimeout(time.Duration(waitTimeout) * time.Second) + start := time.Now() + data, err := cc.readPacket() + if err != nil { + if terror.ErrorNotEqual(err, io.EOF) { + if netErr, isNetErr := errors.Cause(err).(net.Error); isNetErr && netErr.Timeout() { + idleTime := time.Since(start) + logutil.Logger(ctx).Info("read packet timeout, close this connection", + zap.Duration("idle", idleTime), + zap.Uint64("waitTimeout", waitTimeout), + zap.Error(err), + ) + } else { + errStack := errors.ErrorStack(err) + if !strings.Contains(errStack, "use of closed network connection") { + logutil.Logger(ctx).Warn("read packet failed, close this connection", + zap.Error(errors.SuspendStack(err))) + } + } + } + return + } + + if !atomic.CompareAndSwapInt32(&cc.status, connStatusReading, connStatusDispatching) { + return + } + + if err = cc.dispatch(ctx, data); err != nil { + if terror.ErrorEqual(err, io.EOF) { + return + } else if terror.ErrResultUndetermined.Equal(err) { + logutil.Logger(ctx).Error("result undetermined, close this connection", zap.Error(err)) + return + } else if terror.ErrCritical.Equal(err) { + logutil.Logger(ctx).Fatal("critical error, stop the server", zap.Error(err)) + } + var txnMode string + logutil.Logger(ctx).Info("command dispatched failed", + zap.String("connInfo", cc.String()), + zap.String("command", mysql.Command2Str[data[0]]), + zap.String("status", cc.SessionStatusToString()), + zap.String("txn_mode", txnMode), + ) + err1 := cc.writeError(ctx, err) + terror.Log(err1) + } + cc.pkt.sequence = 0 + } +} + +// ShutdownOrNotify will Shutdown this client connection, or do its best to notify. +func (cc *clientConn) ShutdownOrNotify() bool { + if (cc.ctx.Status() & mysql.ServerStatusInTrans) > 0 { + return false + } + // If the client connection status is reading, it's safe to shutdown it. + if atomic.CompareAndSwapInt32(&cc.status, connStatusReading, connStatusShutdown) { + return true + } + // If the client connection status is dispatching, we can't shutdown it immediately, + // so set the status to WaitShutdown as a notification, the loop in clientConn.Run + // will detect it and then exit. + atomic.StoreInt32(&cc.status, connStatusWaitShutdown) + return false +} + +// dispatch handles client request based on command which is the first byte of the data. +// It also gets a token from server which is used to limit the concurrently handling clients. +// The most frequently used command is ComQuery. +func (cc *clientConn) dispatch(ctx context.Context, data []byte) error { + defer func() { + // reset killed for each request + atomic.StoreUint32(&cc.ctx.GetSessionVars().Killed, 0) + }() + + var cancelFunc context.CancelFunc + ctx, cancelFunc = context.WithCancel(ctx) + cc.mu.Lock() + cc.mu.cancelFunc = cancelFunc + cc.mu.Unlock() + + cc.lastPacket = data + cmd := data[0] + data = data[1:] + + vars := cc.ctx.GetSessionVars() + // reset killed for each request + atomic.StoreUint32(&vars.Killed, 0) + + dataStr := string(hack.String(data)) + + switch cmd { + case mysql.ComSleep: + // TODO: According to mysql document, this command is supposed to be used only internally. + // So it's just a temp fix, not sure if it's done right. + // Investigate this command and write test case later. + return nil + case mysql.ComQuit: + return io.EOF + case mysql.ComInitDB: + return cc.writeOK(ctx) + case mysql.ComQuery: // Most frequently used command. + // For issue 1989 + // Input payload may end with byte '\0', we didn't find related mysql document about it, but mysql + // implementation accept that case. So trim the last '\0' here as if the payload an EOF string. + // See http://dev.mysql.com/doc/internals/en/com-query.html + if len(data) > 0 && data[len(data)-1] == 0 { + data = data[:len(data)-1] + dataStr = string(hack.String(data)) + } + return cc.handleQuery(ctx, dataStr) + case mysql.ComShutdown: // redirect to SQL + if err := cc.handleQuery(ctx, "SHUTDOWN"); err != nil { + return err + } + return cc.writeOK(ctx) + case mysql.ComStatistics: + return cc.writeStats(ctx) + // ComProcessInfo, ComConnect, ComProcessKill, ComDebug + case mysql.ComPing: + return cc.writeOK(ctx) + default: + return mysql.NewErrf(mysql.ErrUnknown, "command %d not supported now", nil, cmd) + } +} + +func (cc *clientConn) writeStats(ctx context.Context) error { + msg := []byte("Uptime: 0 Threads: 0 Questions: 0 Slow queries: 0 Opens: 0 Flush tables: 0 Open tables: 0 Queries per second avg: 0.000") + data := cc.alloc.AllocWithLen(4, len(msg)) + data = append(data, msg...) + + err := cc.writePacket(data) + if err != nil { + return err + } + + return cc.flush(ctx) +} + +func (cc *clientConn) flush(ctx context.Context) error { + defer func() { + trace.StartRegion(ctx, "FlushClientConn").End() + }() + return cc.pkt.flush() +} + +func (cc *clientConn) writeOK(ctx context.Context) error { + // msg := cc.ctx.LastMessage() + msg := "Welcome TinySQL" + return cc.writeOkWith(ctx, msg, 0, 0, cc.ctx.Status(), 0) +} + +func (cc *clientConn) writeOkWith(ctx context.Context, msg string, affectedRows, lastInsertID uint64, status, warnCnt uint16) error { + enclen := 0 + if len(msg) > 0 { + enclen = lengthEncodedIntSize(uint64(len(msg))) + len(msg) + } + + data := cc.alloc.AllocWithLen(4, 32+enclen) + data = append(data, mysql.OKHeader) + data = dumpLengthEncodedInt(data, affectedRows) + data = dumpLengthEncodedInt(data, lastInsertID) + if cc.capability&mysql.ClientProtocol41 > 0 { + data = dumpUint16(data, status) + data = dumpUint16(data, warnCnt) + } + if enclen > 0 { + // although MySQL manual says the info message is string(https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html), + // it is actually string + data = dumpLengthEncodedString(data, []byte(msg)) + } + + err := cc.writePacket(data) + if err != nil { + return err + } + + return cc.flush(ctx) +} + +func (cc *clientConn) writeError(ctx context.Context, e error) error { + var ( + m *mysql.SQLError + te *terror.Error + ok bool + ) + originErr := errors.Cause(e) + if te, ok = originErr.(*terror.Error); ok { + m = terror.ToSQLError(te) + } else { + e := errors.Cause(originErr) + switch y := e.(type) { + case *terror.Error: + m = terror.ToSQLError(y) + default: + m = mysql.NewErrf(mysql.ErrUnknown, "%s", nil, e.Error()) + } + } + + cc.lastCode = m.Code + // defer errno.IncrementError(m.Code, cc.user, cc.peerHost) + data := cc.alloc.AllocWithLen(4, 16+len(m.Message)) + data = append(data, mysql.ErrHeader) + data = append(data, byte(m.Code), byte(m.Code>>8)) + if cc.capability&mysql.ClientProtocol41 > 0 { + data = append(data, '#') + data = append(data, m.State...) + } + + data = append(data, m.Message...) + + err := cc.writePacket(data) + if err != nil { + return err + } + return cc.flush(ctx) +} + +// writeEOF writes an EOF packet. +// Note this function won't flush the stream because maybe there are more +// packets following it. +// serverStatus, a flag bit represents server information +// in the packet. +func (cc *clientConn) writeEOF(serverStatus uint16) error { + data := cc.alloc.AllocWithLen(4, 9) + + data = append(data, mysql.EOFHeader) + if cc.capability&mysql.ClientProtocol41 > 0 { + //data = dumpUint16(data, cc.ctx.WarningCount()) + data = dumpUint16(data, 0) + status := cc.ctx.Status() + status |= serverStatus + data = dumpUint16(data, status) + } + + err := cc.writePacket(data) + return err +} + +func (cc *clientConn) writeReq(ctx context.Context, filePath string) error { + data := cc.alloc.AllocWithLen(4, 5+len(filePath)) + data = append(data, mysql.LocalInFileHeader) + data = append(data, filePath...) + + err := cc.writePacket(data) + if err != nil { + return err + } + + return cc.flush(ctx) +} + +// getDataFromPath gets file contents from file path. +func (cc *clientConn) getDataFromPath(ctx context.Context, path string) ([]byte, error) { + err := cc.writeReq(ctx, path) + if err != nil { + return nil, err + } + var prevData, curData []byte + for { + curData, err = cc.readPacket() + if err != nil && terror.ErrorNotEqual(err, io.EOF) { + return nil, err + } + if len(curData) == 0 { + break + } + prevData = append(prevData, curData...) + } + return prevData, nil +} + +// handleQuery executes the sql query string and writes result set or result ok to the client. +// As the execution time of this function represents the performance of TiDB, we do time log and metrics here. +// There is a special query `load data` that does not return result, which is handled differently. +// Query `load stats` does not return result either. +func (cc *clientConn) handleQuery(ctx context.Context, sql string) (err error) { + // Now just simply call `writeOK`. + // In the subsequent lab, we will gradually improve the logic here. + return cc.writeOK(ctx) +} + +func (cc *clientConn) setConn(conn net.Conn) { + cc.bufReadConn = newBufferedReadConn(conn) + if cc.pkt == nil { + cc.pkt = newPacketIO(cc.bufReadConn) + } else { + // Preserve current sequence number. + cc.pkt.setBufferedReadConn(cc.bufReadConn) + } +} diff --git a/server/driver_tidb.go b/server/driver_tidb.go new file mode 100644 index 000000000..3a2969ca4 --- /dev/null +++ b/server/driver_tidb.go @@ -0,0 +1,25 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server + +import ( + "tinysql/session" +) + +// TiDBContext implements QueryCtx. +type TiDBContext struct { + session.Session + currentDB string +} diff --git a/server/packetio.go b/server/packetio.go new file mode 100644 index 000000000..0e2d61031 --- /dev/null +++ b/server/packetio.go @@ -0,0 +1,184 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// The MIT License (MIT) +// +// Copyright (c) 2014 wandoulabs +// Copyright (c) 2014 siddontang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +package server + +import ( + "bufio" + "io" + "time" + + "github.com/pingcap/errors" + "tinysql/parser/mysql" + "tinysql/parser/terror" +) + +const defaultWriterSize = 16 * 1024 + +// packetIO is a helper to read and write data in packet format. +type packetIO struct { + bufReadConn *bufferedReadConn + bufWriter *bufio.Writer + sequence uint8 + readTimeout time.Duration +} + +func newPacketIO(bufReadConn *bufferedReadConn) *packetIO { + p := &packetIO{sequence: 0} + p.setBufferedReadConn(bufReadConn) + return p +} + +func (p *packetIO) setBufferedReadConn(bufReadConn *bufferedReadConn) { + p.bufReadConn = bufReadConn + p.bufWriter = bufio.NewWriterSize(bufReadConn, defaultWriterSize) +} + +func (p *packetIO) setReadTimeout(timeout time.Duration) { + p.readTimeout = timeout +} + +func (p *packetIO) readOnePacket() ([]byte, error) { + var header [4]byte + if p.readTimeout > 0 { + if err := p.bufReadConn.SetReadDeadline(time.Now().Add(p.readTimeout)); err != nil { + return nil, err + } + } + if _, err := io.ReadFull(p.bufReadConn, header[:]); err != nil { + return nil, errors.Trace(err) + } + + sequence := header[3] + if sequence != p.sequence { + return nil, errInvalidSequence.GenWithStack("invalid sequence %d != %d", sequence, p.sequence) + } + + p.sequence++ + + length := int(uint32(header[0]) | uint32(header[1])<<8 | uint32(header[2])<<16) + + data := make([]byte, length) + if p.readTimeout > 0 { + if err := p.bufReadConn.SetReadDeadline(time.Now().Add(p.readTimeout)); err != nil { + return nil, err + } + } + if _, err := io.ReadFull(p.bufReadConn, data); err != nil { + return nil, errors.Trace(err) + } + return data, nil +} + +func (p *packetIO) readPacket() ([]byte, error) { + if p.readTimeout == 0 { + if err := p.bufReadConn.SetReadDeadline(time.Time{}); err != nil { + return nil, errors.Trace(err) + } + } + data, err := p.readOnePacket() + if err != nil { + return nil, errors.Trace(err) + } + + if len(data) < mysql.MaxPayloadLen { + // readPacketBytes.Observe(float64(len(data))) + return data, nil + } + + // handle multi-packet + for { + buf, err := p.readOnePacket() + if err != nil { + return nil, errors.Trace(err) + } + + data = append(data, buf...) + + if len(buf) < mysql.MaxPayloadLen { + break + } + } + + // readPacketBytes.Observe(float64(len(data))) + return data, nil +} + +// writePacket writes data that already have header +func (p *packetIO) writePacket(data []byte) error { + length := len(data) - 4 + // writePacketBytes.Observe(float64(len(data))) + + for length >= mysql.MaxPayloadLen { + data[0] = 0xff + data[1] = 0xff + data[2] = 0xff + + data[3] = p.sequence + + if n, err := p.bufWriter.Write(data[:4+mysql.MaxPayloadLen]); err != nil { + return errors.Trace(mysql.ErrBadConn) + } else if n != (4 + mysql.MaxPayloadLen) { + return errors.Trace(mysql.ErrBadConn) + } else { + p.sequence++ + length -= mysql.MaxPayloadLen + data = data[mysql.MaxPayloadLen:] + } + } + + data[0] = byte(length) + data[1] = byte(length >> 8) + data[2] = byte(length >> 16) + data[3] = p.sequence + + if n, err := p.bufWriter.Write(data); err != nil { + terror.Log(errors.Trace(err)) + return errors.Trace(mysql.ErrBadConn) + } else if n != len(data) { + return errors.Trace(mysql.ErrBadConn) + } else { + p.sequence++ + return nil + } +} + +func (p *packetIO) flush() error { + err := p.bufWriter.Flush() + if err != nil { + return errors.Trace(err) + } + return err +} diff --git a/server/server.go b/server/server.go new file mode 100644 index 000000000..eff5ee3a8 --- /dev/null +++ b/server/server.go @@ -0,0 +1,184 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server + +import ( + "context" + "flag" + "net" + "os" + "os/user" + "sync" + + proxyprotocol "github.com/blacktear23/go-proxyprotocol" + "github.com/pingcap/errors" + "go.uber.org/zap" + "tinysql/config" + "tinysql/dbterror" + "tinysql/errno" + "tinysql/parser/mysql" + "tinysql/parser/terror" + "tinysql/util" + "tinysql/util/fastrand" + "tinysql/util/logutil" +) + +var ( + serverPID int + osUser string + osVersion string + runInGoTest bool +) + +func init() { + serverPID = os.Getpid() + currentUser, err := user.Current() + if err != nil { + osUser = "" + } else { + osUser = currentUser.Name + } + osVersion = "" + runInGoTest = flag.Lookup("test.v") != nil || flag.Lookup("check.v") != nil +} + +var ( + errUnknownFieldType = dbterror.ClassServer.NewStd(errno.ErrUnknownFieldType) + errInvalidSequence = dbterror.ClassServer.NewStd(errno.ErrInvalidSequence) + errInvalidType = dbterror.ClassServer.NewStd(errno.ErrInvalidType) + errNotAllowedCommand = dbterror.ClassServer.NewStd(errno.ErrNotAllowedCommand) + errAccessDenied = dbterror.ClassServer.NewStd(errno.ErrAccessDenied) + errConCount = dbterror.ClassServer.NewStd(errno.ErrConCount) + errSecureTransportRequired = dbterror.ClassServer.NewStd(errno.ErrSecureTransportRequired) + errMultiStatementDisabled = dbterror.ClassServer.NewStd(errno.ErrMultiStatementDisabled) + errNewAbortingConnection = dbterror.ClassServer.NewStd(errno.ErrNewAbortingConnection) +) + +// DefaultCapability is the capability of the server when it is created using the default configuration. +// When server is configured with SSL, the server will have extra capabilities compared to DefaultCapability. +const defaultCapability = mysql.ClientLongPassword | mysql.ClientLongFlag | + mysql.ClientConnectWithDB | mysql.ClientProtocol41 | + mysql.ClientTransactions | mysql.ClientSecureConnection | mysql.ClientFoundRows | + mysql.ClientMultiStatements | mysql.ClientMultiResults | mysql.ClientLocalFiles | + mysql.ClientConnectAtts | mysql.ClientPluginAuth | mysql.ClientInteractive + +// Server is the MySQL protocol server +type Server struct { + cfg *config.Config + listener net.Listener + inShutdownMode bool + globalConnID util.GlobalConnID + rwlock sync.RWMutex + clients map[uint64]*clientConn + capability uint32 +} + +func NewServer() (*Server, error) { + s := &Server{ + globalConnID: util.GlobalConnID{ServerID: 0, Is64bits: true}, + clients: make(map[uint64]*clientConn), + } + + s.capability = defaultCapability + + var err error + addr := "127.0.0.1:4000" + tcpProto := "tcp" + if s.listener, err = net.Listen(tcpProto, addr); err != nil { + return nil, errors.Trace(err) + } + + return s, nil +} + +func (s *Server) Run() error { + // If error should be reported and exit the server it can be sent on this + // channel. Otherwise end with sending a nil error to signal "done" + errChan := make(chan error) + go s.startNetworkListener(s.listener, errChan) + err := <-errChan + if err != nil { + return err + } + return <-errChan + +} + +func (s *Server) startNetworkListener(listener net.Listener, errChan chan error) { + if listener == nil { + errChan <- nil + return + } + for { + conn, err := listener.Accept() + if err != nil { + if opErr, ok := err.(*net.OpError); ok { + if opErr.Err.Error() == "use of closed network connection" { + if s.inShutdownMode { + errChan <- nil + } else { + errChan <- err + } + return + } + } + + // If we got PROXY protocol error, we should continue accept. + if proxyprotocol.IsProxyProtocolError(err) { + logutil.BgLogger().Error("PROXY protocol failed", zap.Error(err)) + continue + } + + logutil.BgLogger().Error("accept failed", zap.Error(err)) + errChan <- err + return + } + + clientConn := s.newConn(conn) + go s.onConn(clientConn) + } +} + +// onConn runs in its own goroutine, handles queries from this connection. +func (s *Server) onConn(conn *clientConn) { + ctx := logutil.WithConnID(context.Background(), conn.connectionID) + if err := conn.handshake(ctx); err != nil { + // Some keep alive services will send request to TiDB and disconnect immediately. + // So we only log errors here. + terror.Log(errors.Trace(err)) + terror.Log(errors.Trace(conn.Close())) + return + } + + logutil.Logger(ctx).Debug("new connection", zap.String("remoteAddr", conn.bufReadConn.RemoteAddr().String())) + + defer func() { + logutil.Logger(ctx).Debug("connection closed") + }() + s.rwlock.Lock() + s.clients[conn.connectionID] = conn + s.rwlock.Unlock() + + conn.Run(ctx) +} + +// newConn creates a new *clientConn from a net.Conn. +// It allocates a connection ID and random salt data for authentication. +func (s *Server) newConn(conn net.Conn) *clientConn { + cc := newClientConn(s) + cc.setConn(conn) + cc.salt = fastrand.Buf(20) + return cc +} diff --git a/server/util.go b/server/util.go new file mode 100644 index 000000000..19e163a16 --- /dev/null +++ b/server/util.go @@ -0,0 +1,141 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// The MIT License (MIT) +// +// Copyright (c) 2014 wandoulabs +// Copyright (c) 2014 siddontang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +package server + +import ( + "io" +) + +func dumpUint16(buffer []byte, n uint16) []byte { + buffer = append(buffer, byte(n)) + buffer = append(buffer, byte(n>>8)) + return buffer +} + +func parseLengthEncodedInt(b []byte) (num uint64, isNull bool, n int) { + switch b[0] { + // 251: NULL + case 0xfb: + n = 1 + isNull = true + return + + // 252: value of following 2 + case 0xfc: + num = uint64(b[1]) | uint64(b[2])<<8 + n = 3 + return + + // 253: value of following 3 + case 0xfd: + num = uint64(b[1]) | uint64(b[2])<<8 | uint64(b[3])<<16 + n = 4 + return + + // 254: value of following 8 + case 0xfe: + num = uint64(b[1]) | uint64(b[2])<<8 | uint64(b[3])<<16 | + uint64(b[4])<<24 | uint64(b[5])<<32 | uint64(b[6])<<40 | + uint64(b[7])<<48 | uint64(b[8])<<56 + n = 9 + return + } + + // https://dev.mysql.com/doc/internals/en/integer.html#length-encoded-integer: If the first byte of a packet is a length-encoded integer and its byte value is 0xfe, you must check the length of the packet to verify that it has enough space for a 8-byte integer. + // TODO: 0xff is undefined + + // 0-250: value of first byte + num = uint64(b[0]) + n = 1 + return +} + +func parseLengthEncodedBytes(b []byte) ([]byte, bool, int, error) { + // Get length + num, isNull, n := parseLengthEncodedInt(b) + if num < 1 { + return nil, isNull, n, nil + } + + n += int(num) + + // Check data length + if len(b) >= n { + return b[n-int(num) : n], false, n, nil + } + + return nil, false, n, io.EOF +} + +func lengthEncodedIntSize(n uint64) int { + switch { + case n <= 250: + return 1 + + case n <= 0xffff: + return 3 + + case n <= 0xffffff: + return 4 + } + + return 9 +} + +func dumpLengthEncodedInt(buffer []byte, n uint64) []byte { + switch { + case n <= 250: + return append(buffer, byte(n)) + + case n <= 0xffff: + return append(buffer, 0xfc, byte(n), byte(n>>8)) + + case n <= 0xffffff: + return append(buffer, 0xfd, byte(n), byte(n>>8), byte(n>>16)) + + case n <= 0xffffffffffffffff: + return append(buffer, 0xfe, byte(n), byte(n>>8), byte(n>>16), byte(n>>24), + byte(n>>32), byte(n>>40), byte(n>>48), byte(n>>56)) + } + + return buffer +} + +func dumpLengthEncodedString(buffer []byte, bytes []byte) []byte { + buffer = dumpLengthEncodedInt(buffer, uint64(len(bytes))) + buffer = append(buffer, bytes...) + return buffer +} diff --git a/session/session.go b/session/session.go new file mode 100644 index 000000000..d6bf4d152 --- /dev/null +++ b/session/session.go @@ -0,0 +1,55 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copyright 2013 The ql Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSES/QL-LICENSE file. + +package session + +import ( + "tinysql/sessionctx" + "tinysql/sessionctx/variable" +) + +// Session context, it is consistent with the lifecycle of a client connection. +type Session interface { + sessionctx.Context + Status() uint16 // Flag of current status, such as autocommit. + Close() +} + +type session struct { + sessionVars *variable.SessionVars +} + +// GetSessionVars implements the context.Context interface. +func (s *session) GetSessionVars() *variable.SessionVars { + return s.sessionVars +} + +// CreateSession creates a new session environment. +func CreateSession() (Session, error) { + s := &session{ + sessionVars: variable.NewSessionVars(), + } + return s, nil +} + +func (s *session) Close() { +} + +func (s *session) Status() uint16 { + return s.sessionVars.Status +} diff --git a/sessionctx/context.go b/sessionctx/context.go new file mode 100644 index 000000000..222491634 --- /dev/null +++ b/sessionctx/context.go @@ -0,0 +1,24 @@ +// Copyright 2018 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sessionctx + +import ( + "tinysql/sessionctx/variable" +) + +// Context is an interface for transaction and executive args environment. +type Context interface { + GetSessionVars() *variable.SessionVars +} diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go new file mode 100644 index 000000000..836b74de6 --- /dev/null +++ b/sessionctx/variable/session.go @@ -0,0 +1,35 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package variable + +import ( + "tinysql/parser/mysql" +) + +type SessionVars struct { + // Status stands for the session status. e.g. in transaction or not, auto commit is on or off, and so on. + Status uint16 + + // Killed is a flag to indicate that this query is killed. + Killed uint32 +} + +// NewSessionVars creates a session vars object. +func NewSessionVars() *SessionVars { + vars := &SessionVars{ + Status: mysql.ServerStatusAutocommit, + } + return vars +} diff --git a/tinysql-server/main.go b/tinysql-server/main.go new file mode 100644 index 000000000..bf5bd1766 --- /dev/null +++ b/tinysql-server/main.go @@ -0,0 +1,35 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "github.com/pingcap/log" + "go.uber.org/zap" + "tinysql/parser/terror" + "tinysql/server" +) + +func main() { + server := createServer() + terror.MustNil(server.Run()) +} + +func createServer() *server.Server { + server, err := server.NewServer() + if err != nil { + log.Fatal("failed to create the server", zap.Error(err), zap.Stack("stack")) + } + return server +} diff --git a/util/arena/arena.go b/util/arena/arena.go new file mode 100644 index 000000000..62f83098a --- /dev/null +++ b/util/arena/arena.go @@ -0,0 +1,81 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package arena + +// Allocator pre-allocates memory to reduce memory allocation cost. +// It is not thread-safe. +type Allocator interface { + // Alloc allocates memory with 0 len and capacity cap. + Alloc(capacity int) []byte + + // AllocWithLen allocates memory with length and capacity. + AllocWithLen(length int, capacity int) []byte + + // Reset resets arena offset. + // Make sure all the allocated memory are not used any more. + Reset() +} + +// SimpleAllocator is a simple implementation of ArenaAllocator. +type SimpleAllocator struct { + arena []byte + off int +} + +type stdAllocator struct { +} + +func (a *stdAllocator) Alloc(capacity int) []byte { + return make([]byte, 0, capacity) +} + +func (a *stdAllocator) AllocWithLen(length int, capacity int) []byte { + return make([]byte, length, capacity) +} + +func (a *stdAllocator) Reset() { +} + +var _ Allocator = &stdAllocator{} + +// StdAllocator implements Allocator but do not pre-allocate memory. +var StdAllocator = &stdAllocator{} + +// NewAllocator creates an Allocator with a specified capacity. +func NewAllocator(capacity int) *SimpleAllocator { + return &SimpleAllocator{arena: make([]byte, 0, capacity)} +} + +// Alloc implements Allocator.AllocBytes interface. +func (s *SimpleAllocator) Alloc(capacity int) []byte { + if s.off+capacity < cap(s.arena) { + slice := s.arena[s.off : s.off : s.off+capacity] + s.off += capacity + return slice + } + + return make([]byte, 0, capacity) +} + +// AllocWithLen implements Allocator.AllocWithLen interface. +func (s *SimpleAllocator) AllocWithLen(length int, capacity int) []byte { + slice := s.Alloc(capacity) + return slice[:length:capacity] +} + +// Reset implements Allocator.Reset interface. +func (s *SimpleAllocator) Reset() { + s.off = 0 +} diff --git a/util/fastrand/random.go b/util/fastrand/random.go new file mode 100644 index 000000000..efab152a1 --- /dev/null +++ b/util/fastrand/random.go @@ -0,0 +1,55 @@ +// Copyright 2017 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fastrand + +import ( + _ "unsafe" // required by go:linkname +) + +// Buf generates a random string using ASCII characters but avoid separator character. +// See https://github.com/mysql/mysql-server/blob/5.7/mysys_ssl/crypt_genhash_impl.cc#L435 +func Buf(size int) []byte { + buf := make([]byte, size) + for i := 0; i < size; i++ { + buf[i] = byte(Uint32N(127)) + if buf[i] == 0 || buf[i] == byte('$') { + buf[i]++ + } + } + return buf +} + +// Uint32 returns a lock free uint32 value. +//go:linkname Uint32 runtime.fastrand +func Uint32() uint32 + +// Uint32N returns, as an uint32, a pseudo-random number in [0,n). +func Uint32N(n uint32) uint32 { + if n&(n-1) == 0 { // n is power of two, can mask + return Uint32() & (n - 1) + } + return Uint32() % n +} + +// Uint64N returns, as an uint64, a pseudo-random number in [0,n). +func Uint64N(n uint64) uint64 { + a := Uint32() + b := Uint32() + v := uint64(a)<<32 + uint64(b) + if n&(n-1) == 0 { // n is power of two, can mask + return v & (n - 1) + } + return v % n +} diff --git a/util/hack/hack.go b/util/hack/hack.go new file mode 100644 index 000000000..60ad6aab9 --- /dev/null +++ b/util/hack/hack.go @@ -0,0 +1,58 @@ +// Copyright 2015 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package hack + +import ( + "reflect" + "unsafe" +) + +// MutableString can be used as string via string(MutableString) without performance loss. +type MutableString string + +// String converts slice to MutableString without copy. +// The MutableString can be converts to string without copy. +// Use it at your own risk. +func String(b []byte) (s MutableString) { + if len(b) == 0 { + return "" + } + pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) + pstring.Data = pbytes.Data + pstring.Len = pbytes.Len + return +} + +// Slice converts string to slice without copy. +// Use at your own risk. +func Slice(s string) (b []byte) { + pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) + pbytes.Data = pstring.Data + pbytes.Len = pstring.Len + pbytes.Cap = pstring.Len + return +} + +// LoadFactor is the maximum average load of a bucket that triggers growth is 6.5 in Golang Map. +// Represent as LoadFactorNum/LoadFactorDen, to allow integer math. +// They are from the golang definition. ref: https://github.com/golang/go/blob/go1.13.15/src/runtime/map.go#L68-L71 +const ( + // LoadFactorNum is the numerator of load factor + LoadFactorNum = 13 + // LoadFactorDen is the denominator of load factor + LoadFactorDen = 2 +) diff --git a/util/logutil/hex.go b/util/logutil/hex.go new file mode 100644 index 000000000..2794fa87a --- /dev/null +++ b/util/logutil/hex.go @@ -0,0 +1,79 @@ +// Copyright 2019 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "bytes" + "encoding/hex" + "fmt" + "io" + "reflect" + "strings" + + "github.com/golang/protobuf/proto" +) + +// Hex defines a fmt.Stringer for proto.Message. +// We can't define the String() method on proto.Message, but we can wrap it. +func Hex(msg proto.Message) fmt.Stringer { + return hexStringer{msg} +} + +type hexStringer struct { + proto.Message +} + +func (h hexStringer) String() string { + val := reflect.ValueOf(h.Message) + var w bytes.Buffer + prettyPrint(&w, val) + return w.String() +} + +func prettyPrint(w io.Writer, val reflect.Value) { + tp := val.Type() + switch val.Kind() { + case reflect.Slice: + elemType := tp.Elem() + if elemType.Kind() == reflect.Uint8 { + fmt.Fprintf(w, "%s", hex.EncodeToString(val.Bytes())) + } else { + fmt.Fprintf(w, "%s", val.Interface()) + } + case reflect.Struct: + fmt.Fprintf(w, "{") + for i := 0; i < val.NumField(); i++ { + fv := val.Field(i) + ft := tp.Field(i) + if strings.HasPrefix(ft.Name, "XXX_") { + continue + } + if i != 0 { + fmt.Fprintf(w, " ") + } + fmt.Fprintf(w, "%s:", ft.Name) + prettyPrint(w, fv) + } + fmt.Fprintf(w, "}") + case reflect.Ptr: + if val.IsNil() { + fmt.Fprintf(w, "%v", val.Interface()) + } else { + prettyPrint(w, reflect.Indirect(val)) + } + default: + fmt.Fprintf(w, "%v", val.Interface()) + } +} diff --git a/util/logutil/log.go b/util/logutil/log.go new file mode 100644 index 000000000..5f522ee09 --- /dev/null +++ b/util/logutil/log.go @@ -0,0 +1,255 @@ +// Copyright 2017 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "context" + "fmt" + "os" + "runtime/trace" + "time" + + gzap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" + "github.com/opentracing/opentracing-go" + tlog "github.com/opentracing/opentracing-go/log" + "github.com/pingcap/errors" + "github.com/pingcap/log" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +const ( + // DefaultLogMaxSize is the default size of log files. + DefaultLogMaxSize = 300 // MB + // DefaultLogFormat is the default format of the log. + DefaultLogFormat = "text" + // DefaultSlowThreshold is the default slow log threshold in millisecond. + DefaultSlowThreshold = 300 + // DefaultQueryLogMaxLen is the default max length of the query in the log. + DefaultQueryLogMaxLen = 4096 + // DefaultRecordPlanInSlowLog is the default value for whether enable log query plan in the slow log. + DefaultRecordPlanInSlowLog = 1 + // DefaultTiDBEnableSlowLog enables TiDB to log slow queries. + DefaultTiDBEnableSlowLog = true +) + +// EmptyFileLogConfig is an empty FileLogConfig. +var EmptyFileLogConfig = FileLogConfig{} + +// FileLogConfig serializes file log related config in toml/json. +type FileLogConfig struct { + log.FileLogConfig +} + +// NewFileLogConfig creates a FileLogConfig. +func NewFileLogConfig(maxSize uint) FileLogConfig { + return FileLogConfig{FileLogConfig: log.FileLogConfig{ + MaxSize: int(maxSize), + }, + } +} + +// LogConfig serializes log related config in toml/json. +type LogConfig struct { + log.Config + + // SlowQueryFile filename, default to File log config on empty. + SlowQueryFile string +} + +// NewLogConfig creates a LogConfig. +func NewLogConfig(level, format, slowQueryFile string, fileCfg FileLogConfig, disableTimestamp bool, opts ...func(*log.Config)) *LogConfig { + c := &LogConfig{ + Config: log.Config{ + Level: level, + Format: format, + DisableTimestamp: disableTimestamp, + File: fileCfg.FileLogConfig, + }, + SlowQueryFile: slowQueryFile, + } + for _, opt := range opts { + opt(&c.Config) + } + return c +} + +const ( + // SlowLogTimeFormat is the time format for slow log. + SlowLogTimeFormat = time.RFC3339Nano + // OldSlowLogTimeFormat is the first version of the the time format for slow log, This is use for compatibility. + OldSlowLogTimeFormat = "2006-01-02-15:04:05.999999999 -0700" +) + +// SlowQueryLogger is used to log slow query, InitLogger will modify it according to config file. +var SlowQueryLogger = log.L() + +// InitLogger initializes a logger with cfg. +func InitLogger(cfg *LogConfig) error { + gl, props, err := log.InitLogger(&cfg.Config, zap.AddStacktrace(zapcore.FatalLevel)) + if err != nil { + return errors.Trace(err) + } + log.ReplaceGlobals(gl, props) + + // init dedicated logger for slow query log + SlowQueryLogger, _, err = newSlowQueryLogger(cfg) + if err != nil { + return errors.Trace(err) + } + + _, _, err = initGRPCLogger(cfg) + if err != nil { + return errors.Trace(err) + } + + return nil +} + +func initGRPCLogger(cfg *LogConfig) (*zap.Logger, *log.ZapProperties, error) { + // Copy Config struct by assignment. + config := cfg.Config + var l *zap.Logger + var err error + var prop *log.ZapProperties + if len(os.Getenv("GRPC_DEBUG")) > 0 { + config.Level = "debug" + l, prop, err = log.InitLogger(&config, zap.AddStacktrace(zapcore.FatalLevel)) + if err != nil { + return nil, nil, errors.Trace(err) + } + gzap.ReplaceGrpcLoggerV2WithVerbosity(l, 999) + } else { + config.Level = "error" + l, prop, err = log.InitLogger(&config, zap.AddStacktrace(zapcore.FatalLevel)) + if err != nil { + return nil, nil, errors.Trace(err) + } + gzap.ReplaceGrpcLoggerV2(l) + } + + return l, prop, nil +} + +// SetLevel sets the zap logger's level. +func SetLevel(level string) error { + l := zap.NewAtomicLevel() + if err := l.UnmarshalText([]byte(level)); err != nil { + return errors.Trace(err) + } + log.SetLevel(l.Level()) + return nil +} + +type ctxLogKeyType struct{} + +var ctxLogKey = ctxLogKeyType{} + +// Logger gets a contextual logger from current context. +// contextual logger will output common fields from context. +func Logger(ctx context.Context) *zap.Logger { + if ctxlogger, ok := ctx.Value(ctxLogKey).(*zap.Logger); ok { + return ctxlogger + } + return log.L() +} + +// BgLogger is alias of `logutil.BgLogger()` +func BgLogger() *zap.Logger { + return log.L() +} + +// WithConnID attaches connId to context. +func WithConnID(ctx context.Context, connID uint64) context.Context { + var logger *zap.Logger + if ctxLogger, ok := ctx.Value(ctxLogKey).(*zap.Logger); ok { + logger = ctxLogger + } else { + logger = log.L() + } + return context.WithValue(ctx, ctxLogKey, logger.With(zap.Uint64("conn", connID))) +} + +// WithTraceLogger attaches trace identifier to context +func WithTraceLogger(ctx context.Context, connID uint64) context.Context { + var logger *zap.Logger + if ctxLogger, ok := ctx.Value(ctxLogKey).(*zap.Logger); ok { + logger = ctxLogger + } else { + logger = log.L() + } + return context.WithValue(ctx, ctxLogKey, wrapTraceLogger(ctx, connID, logger)) +} + +func wrapTraceLogger(ctx context.Context, connID uint64, logger *zap.Logger) *zap.Logger { + return logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core { + tl := &traceLog{ctx: ctx} + traceCore := log.NewTextCore(log.NewTextEncoder(&log.Config{}), tl, tl). + With([]zapcore.Field{zap.Uint64("conn", connID)}) + return zapcore.NewTee(traceCore, core) + })) +} + +type traceLog struct { + ctx context.Context +} + +func (t *traceLog) Enabled(_ zapcore.Level) bool { + return true +} + +func (t *traceLog) Write(p []byte) (n int, err error) { + trace.Log(t.ctx, "log", string(p)) + return len(p), nil +} + +func (t *traceLog) Sync() error { + return nil +} + +// WithKeyValue attaches key/value to context. +func WithKeyValue(ctx context.Context, key, value string) context.Context { + var logger *zap.Logger + if ctxLogger, ok := ctx.Value(ctxLogKey).(*zap.Logger); ok { + logger = ctxLogger + } else { + logger = log.L() + } + return context.WithValue(ctx, ctxLogKey, logger.With(zap.String(key, value))) +} + +// TraceEventKey presents the TraceEventKey in span log. +const TraceEventKey = "event" + +// Event records event in current tracing span. +func Event(ctx context.Context, event string) { + if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil { + span.LogFields(tlog.String(TraceEventKey, event)) + } +} + +// Eventf records event in current tracing span with format support. +func Eventf(ctx context.Context, format string, args ...interface{}) { + if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil { + span.LogFields(tlog.String(TraceEventKey, fmt.Sprintf(format, args...))) + } +} + +// SetTag sets tag kv-pair in current tracing span +func SetTag(ctx context.Context, key string, value interface{}) { + if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil { + span.SetTag(key, value) + } +} diff --git a/util/logutil/slow_query_logger.go b/util/logutil/slow_query_logger.go new file mode 100644 index 000000000..433fd5746 --- /dev/null +++ b/util/logutil/slow_query_logger.go @@ -0,0 +1,78 @@ +package logutil + +import ( + "fmt" + "time" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + "go.uber.org/zap" + "go.uber.org/zap/buffer" + "go.uber.org/zap/zapcore" +) + +var _pool = buffer.NewPool() + +func newSlowQueryLogger(cfg *LogConfig) (*zap.Logger, *log.ZapProperties, error) { + + // copy global config and override slow query log file + // if slow query log filename is empty, slow query log will behave the same as global log + sqConfig := cfg.Config + if len(cfg.SlowQueryFile) != 0 { + sqConfig.File = log.FileLogConfig{ + MaxSize: cfg.File.MaxSize, + Filename: cfg.SlowQueryFile, + } + } + + // create the slow query logger + sqLogger, prop, err := log.InitLogger(&sqConfig) + if err != nil { + return nil, nil, errors.Trace(err) + } + + // replace 2018-12-19-unified-log-format text encoder with slow log encoder + newCore := log.NewTextCore(&slowLogEncoder{}, prop.Syncer, prop.Level) + sqLogger = sqLogger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core { + return newCore + })) + prop.Core = newCore + + return sqLogger, prop, nil +} + +type slowLogEncoder struct{} + +func (e *slowLogEncoder) EncodeEntry(entry zapcore.Entry, _ []zapcore.Field) (*buffer.Buffer, error) { + b := _pool.Get() + fmt.Fprintf(b, "# Time: %s\n", entry.Time.Format(SlowLogTimeFormat)) + fmt.Fprintf(b, "%s\n", entry.Message) + return b, nil +} + +func (e *slowLogEncoder) Clone() zapcore.Encoder { return e } +func (e *slowLogEncoder) AddArray(string, zapcore.ArrayMarshaler) error { return nil } +func (e *slowLogEncoder) AddObject(string, zapcore.ObjectMarshaler) error { return nil } +func (e *slowLogEncoder) AddBinary(string, []byte) {} +func (e *slowLogEncoder) AddByteString(string, []byte) {} +func (e *slowLogEncoder) AddBool(string, bool) {} +func (e *slowLogEncoder) AddComplex128(string, complex128) {} +func (e *slowLogEncoder) AddComplex64(string, complex64) {} +func (e *slowLogEncoder) AddDuration(string, time.Duration) {} +func (e *slowLogEncoder) AddFloat64(string, float64) {} +func (e *slowLogEncoder) AddFloat32(string, float32) {} +func (e *slowLogEncoder) AddInt(string, int) {} +func (e *slowLogEncoder) AddInt64(string, int64) {} +func (e *slowLogEncoder) AddInt32(string, int32) {} +func (e *slowLogEncoder) AddInt16(string, int16) {} +func (e *slowLogEncoder) AddInt8(string, int8) {} +func (e *slowLogEncoder) AddString(string, string) {} +func (e *slowLogEncoder) AddTime(string, time.Time) {} +func (e *slowLogEncoder) AddUint(string, uint) {} +func (e *slowLogEncoder) AddUint64(string, uint64) {} +func (e *slowLogEncoder) AddUint32(string, uint32) {} +func (e *slowLogEncoder) AddUint16(string, uint16) {} +func (e *slowLogEncoder) AddUint8(string, uint8) {} +func (e *slowLogEncoder) AddUintptr(string, uintptr) {} +func (e *slowLogEncoder) AddReflected(string, interface{}) error { return nil } +func (e *slowLogEncoder) OpenNamespace(string) {} diff --git a/util/processinfo.go b/util/processinfo.go new file mode 100644 index 000000000..e7f342581 --- /dev/null +++ b/util/processinfo.go @@ -0,0 +1,101 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package util + +import ( + "errors" + "sync/atomic" +) + +// GlobalConnID is the global connection ID, providing UNIQUE connection IDs across the whole TiDB cluster. +// 64 bits version: +// 63 62 41 40 1 0 +// +--+---------------------+--------------------------------------+------+ +// | | serverId | local connId |markup| +// |=0| (22b) | (40b) | =1 | +// +--+---------------------+--------------------------------------+------+ +// 32 bits version(coming soon): +// 31 1 0 +// +-----------------------------+------+ +// | ??? |markup| +// | ??? | =0 | +// +-----------------------------+------+ +type GlobalConnID struct { + ServerID uint64 + LocalConnID uint64 + Is64bits bool + ServerIDGetter func() uint64 +} + +const ( + // MaxServerID is maximum serverID. + MaxServerID = 1<<22 - 1 +) + +func (g *GlobalConnID) makeID(localConnID uint64) uint64 { + var ( + id uint64 + serverID uint64 + ) + if g.ServerIDGetter != nil { + serverID = g.ServerIDGetter() + } else { + serverID = g.ServerID + } + if g.Is64bits { + id |= 0x1 + id |= localConnID & 0xff_ffff_ffff << 1 // 40 bits local connID. + id |= serverID & MaxServerID << 41 // 22 bits serverID. + } else { + // TODO: update after new design for 32 bits version. + id |= localConnID & 0x7fff_ffff << 1 // 31 bits local connID. + } + return id +} + +// ID returns the connection id +func (g *GlobalConnID) ID() uint64 { + return g.makeID(g.LocalConnID) +} + +// NextID returns next connection id +func (g *GlobalConnID) NextID() uint64 { + localConnID := atomic.AddUint64(&g.LocalConnID, 1) + return g.makeID(localConnID) +} + +// ParseGlobalConnID parses an uint64 to GlobalConnID. +// `isTruncated` indicates that older versions of the client truncated the 64-bit GlobalConnID to 32-bit. +func ParseGlobalConnID(id uint64) (g GlobalConnID, isTruncated bool, err error) { + if id&0x80000000_00000000 > 0 { + return GlobalConnID{}, false, errors.New("Unexpected connectionID excceeds int64") + } + if id&0x1 > 0 { + if id&0xffffffff_00000000 == 0 { + return GlobalConnID{}, true, nil + } + return GlobalConnID{ + Is64bits: true, + LocalConnID: (id >> 1) & 0xff_ffff_ffff, + ServerID: (id >> 41) & MaxServerID, + }, false, nil + } + // TODO: update after new design for 32 bits version. + return GlobalConnID{ + Is64bits: false, + LocalConnID: (id >> 1) & 0x7fff_ffff, + ServerID: 0, + }, false, nil +}