Skip to content

Commit

Permalink
set global variable tidb_txn_mode to pessimistic during bootstrap. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Dec 21, 2019
1 parent b47381b commit adbb8b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/pingcap/parser/auth"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/infoschema"
Expand Down Expand Up @@ -967,7 +968,11 @@ func doDMLWorks(s Session) {
for k, v := range variable.SysVars {
// Session only variable should not be inserted.
if v.Scope != variable.ScopeSession {
value := fmt.Sprintf(`("%s", "%s")`, strings.ToLower(k), v.Value)
vVal := v.Value
if v.Name == variable.TiDBTxnMode && config.GetGlobalConfig().Store == "tikv" {
vVal = "pessimistic"
}
value := fmt.Sprintf(`("%s", "%s")`, strings.ToLower(k), vVal)
values = append(values, value)
}
}
Expand Down

0 comments on commit adbb8b9

Please sign in to comment.