Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config, session: add upgrade to version90 in bootstrap.go #34711

Merged
merged 6 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ type Config struct {

// EnableBatchDML, unused since bootstrap v90
EnableBatchDML bool `toml:"enable-batch-dml" json:"enable-batch-dml"`
// MemQuotaQuery,QueryLogMaxLen,CommitterConcurrency, unused since bootstrap v91
MemQuotaQuery int64 `toml:"mem-quota-query" json:"mem-quota-query"`
QueryLogMaxLen uint64 `toml:"query-log-max-len" json:"query-log-max-len"`
CommitterConcurrency int `toml:"committer-concurrency" json:"committer-concurrency"`
}

// UpdateTempStoragePath is to update the `TempStoragePath` if port/statusPort was changed
Expand Down
17 changes: 16 additions & 1 deletion session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,13 @@ const (
version89 = 89
// version90 converts enable-batch-dml to a sysvar
version90 = 90
// version91 converts mem-quota-query, query-log-max-len, committer-concurrency to a sysvar
version91 = 91
)

// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
// please make sure this is the largest version
var currentBootstrapVersion int64 = version90
var currentBootstrapVersion int64 = version91

var (
bootstrapVersion = []func(Session, int64){
Expand Down Expand Up @@ -715,6 +717,7 @@ var (
upgradeToVer88,
upgradeToVer89,
upgradeToVer90,
upgradeToVer91,
}
)

Expand Down Expand Up @@ -1848,6 +1851,18 @@ func upgradeToVer90(s Session, ver int64) {
importConfigOption(s, "enable-batch-dml", variable.TiDBEnableBatchDML, valStr)
}

func upgradeToVer91(s Session, ver int64) {
if ver >= version91 {
return
}
valStr := fmt.Sprint(config.GetGlobalConfig().MemQuotaQuery)
importConfigOption(s, "mem-quota-query", variable.TiDBMemQuotaQuery, valStr)
valStr = fmt.Sprint((config.GetGlobalConfig().QueryLogMaxLen), 10)
importConfigOption(s, "query-log-max-len", variable.TiDBQueryLogMaxLen, valStr)
valStr = fmt.Sprint(config.GetGlobalConfig().CommitterConcurrency)
importConfigOption(s, "committer-concurrency", variable.TiDBCommitterConcurrency, valStr)
}

func writeOOMAction(s Session) {
comment := "oom-action is `log` by default in v3.0.x, `cancel` by default in v4.0.11+"
mustExecute(s, `INSERT HIGH_PRIORITY INTO %n.%n VALUES (%?, %?, %?) ON DUPLICATE KEY UPDATE VARIABLE_VALUE= %?`,
Expand Down