Skip to content

Commit

Permalink
session: fix dml_batch_size doesn't load the global variable (#24710) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot committed Sep 6, 2021
1 parent f0b0834 commit a4504d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,7 @@ var builtinGlobalVariable = []string{
variable.TiDBMultiStatementMode,
variable.TiDBEnableExchangePartition,
variable.TiDBAllowFallbackToTiKV,
variable.TiDBDMLBatchSize,
variable.TiDBEnableOrderedResultMode,
}

Expand Down
10 changes: 10 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4239,6 +4239,16 @@ func (s *testSessionSerialSuite) TestParseWithParams(c *C) {
c.Assert(sb.String(), Equals, "SELECT 3")
}

func (s *testSessionSuite) TestReadDMLBatchSize(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("set global tidb_dml_batch_size=1000")
se, err := session.CreateSession(s.store)
c.Assert(err, IsNil)
// `select 1` to load the global variables.
_, _ = se.Execute(context.TODO(), "select 1")
c.Assert(se.GetSessionVars().DMLBatchSize, Equals, 1000)
}

func (s *testSessionSuite) TestInTxnPSProtoPointGet(c *C) {
ctx := context.Background()
tk := testkit.NewTestKit(c, s.store)
Expand Down

0 comments on commit a4504d8

Please sign in to comment.