Skip to content

Commit

Permalink
session: fix bootstrap to only persist global variables (#30593)
Browse files Browse the repository at this point in the history
close #28667
  • Loading branch information
morgo authored Dec 19, 2021
1 parent 778e188 commit 866c551
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1764,8 +1764,8 @@ func doDMLWorks(s Session) {
// Init global system variables table.
values := make([]string, 0, len(variable.GetSysVars()))
for k, v := range variable.GetSysVars() {
// Session only variable should not be inserted.
if v.Scope != variable.ScopeSession {
// Only global variables should be inserted.
if v.HasGlobalScope() {
vVal := v.Value
if v.Name == variable.TiDBTxnMode && config.GetGlobalConfig().Store == "tikv" {
vVal = "pessimistic"
Expand Down
2 changes: 1 addition & 1 deletion session/bootstrap_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestBootstrap(t *testing.T) {
func globalVarsCount() int64 {
var count int64
for _, v := range variable.GetSysVars() {
if v.Scope != variable.ScopeSession {
if v.HasGlobalScope() {
count++
}
}
Expand Down

0 comments on commit 866c551

Please sign in to comment.