Skip to content

Commit

Permalink
session: force tidb_multi_statement_mode=OFF when mode=WARN (pingcap#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Jul 5, 2021
1 parent 5b08e4c commit e6c94d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,14 @@ const (
version69 = 69
// version70 adds mysql.user.plugin to allow multiple authentication plugins
version70 = 70
// version71 forces tidb_multi_statement_mode=OFF when tidb_multi_statement_mode=WARN
// This affects upgrades from v4.0 where the default was WARN.
version71 = 71
)

// 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 = version70
var currentBootstrapVersion int64 = version71

var (
bootstrapVersion = []func(Session, int64){
Expand Down Expand Up @@ -570,6 +573,7 @@ var (
upgradeToVer68,
upgradeToVer69,
upgradeToVer70,
upgradeToVer71,
}
)

Expand Down Expand Up @@ -1507,6 +1511,13 @@ func upgradeToVer70(s Session, ver int64) {
mustExecute(s, "UPDATE HIGH_PRIORITY mysql.user SET plugin='mysql_native_password'")
}

func upgradeToVer71(s Session, ver int64) {
if ver >= version71 {
return
}
mustExecute(s, "UPDATE mysql.global_variables SET VARIABLE_VALUE='OFF' WHERE VARIABLE_NAME = 'tidb_multi_statement_mode' AND VARIABLE_VALUE = 'WARN'")
}

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

0 comments on commit e6c94d9

Please sign in to comment.