Skip to content

Commit

Permalink
set global variable tidb_txn_mode to pessimistic during bootstrap. (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
coocood authored and XiaTianliang committed Dec 21, 2019
1 parent 87c2495 commit 93d71e7
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 93d71e7

Please sign in to comment.