Skip to content

Commit

Permalink
config, session: add upgrade to version90 in bootstrap.go (#34711)
Browse files Browse the repository at this point in the history
ref #33769
  • Loading branch information
espresso98 authored May 19, 2022
1 parent a961485 commit 2106361
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
17 changes: 13 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ type Config struct {
// The following items are deprecated. We need to keep them here temporarily
// to support the upgrade process. They can be removed in future.

// EnableBatchDML, unused since bootstrap v90
EnableBatchDML bool `toml:"enable-batch-dml" json:"enable-batch-dml"`
// EnableBatchDML, MemQuotaQuery, OOMAction unused since bootstrap v90
EnableBatchDML bool `toml:"enable-batch-dml" json:"enable-batch-dml"`
MemQuotaQuery int64 `toml:"mem-quota-query" json:"mem-quota-query"`
OOMAction string `toml:"oom-action" json:"oom-action"`
}

// UpdateTempStoragePath is to update the `TempStoragePath` if port/statusPort was changed
Expand Down Expand Up @@ -428,6 +430,12 @@ type Log struct {
SlowThreshold uint64 `toml:"slow-threshold" json:"slow-threshold"`
ExpensiveThreshold uint `toml:"expensive-threshold" json:"expensive-threshold"`
RecordPlanInSlowLog uint32 `toml:"record-plan-in-slow-log" json:"record-plan-in-slow-log"`

// The following items are deprecated. We need to keep them here temporarily
// to support the upgrade process. They can be removed in future.

// QueryLogMaxLen, unused since bootstrap v90
QueryLogMaxLen uint64 `toml:"query-log-max-len" json:"query-log-max-len"`
}

// Instance is the section of instance scope system variables.
Expand Down Expand Up @@ -616,11 +624,12 @@ type Performance struct {
StatsLoadConcurrency uint `toml:"stats-load-concurrency" json:"stats-load-concurrency"`
StatsLoadQueueSize uint `toml:"stats-load-queue-size" json:"stats-load-queue-size"`
EnableStatsCacheMemQuota bool `toml:"enable-stats-cache-mem-quota" json:"enable-stats-cache-mem-quota"`

// The following items are deprecated. We need to keep them here temporarily
// to support the upgrade process. They can be removed in future.

RunAutoAnalyze bool `toml:"run-auto-analyze" json:"run-auto-analyze"`
// CommitterConcurrency, RunAutoAnalyze unused since bootstrap v90
CommitterConcurrency int `toml:"committer-concurrency" json:"committer-concurrency"`
RunAutoAnalyze bool `toml:"run-auto-analyze" json:"run-auto-analyze"`
}

// PlanCache is the PlanCache section of the config.
Expand Down
12 changes: 11 additions & 1 deletion session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ const (
version88 = 88
// version89 adds the tables mysql.advisory_locks
version89 = 89
// version90 converts enable-batch-dml to a sysvar
// version90 converts enable-batch-dml, mem-quota-query, query-log-max-len, committer-concurrency, run-auto-analyze, and oom-action to a sysvar
version90 = 90
)

Expand Down Expand Up @@ -1846,6 +1846,16 @@ func upgradeToVer90(s Session, ver int64) {
}
valStr := variable.BoolToOnOff(config.GetGlobalConfig().EnableBatchDML)
importConfigOption(s, "enable-batch-dml", variable.TiDBEnableBatchDML, valStr)
valStr = fmt.Sprint(config.GetGlobalConfig().MemQuotaQuery)
importConfigOption(s, "mem-quota-query", variable.TiDBMemQuotaQuery, valStr)
valStr = fmt.Sprint((config.GetGlobalConfig().Log.QueryLogMaxLen), 10)
importConfigOption(s, "query-log-max-len", variable.TiDBQueryLogMaxLen, valStr)
valStr = fmt.Sprint(config.GetGlobalConfig().Performance.CommitterConcurrency)
importConfigOption(s, "committer-concurrency", variable.TiDBCommitterConcurrency, valStr)
valStr = variable.BoolToOnOff(config.GetGlobalConfig().Performance.RunAutoAnalyze)
importConfigOption(s, "run-auto-analyze", variable.TiDBEnableAutoAnalyze, valStr)
valStr = config.GetGlobalConfig().OOMAction
importConfigOption(s, "oom-action", variable.TiDBMemOOMAction, valStr)
}

func writeOOMAction(s Session) {
Expand Down

0 comments on commit 2106361

Please sign in to comment.