From e9631668cc60aa1aa12325668c0d49d8f3109d3d Mon Sep 17 00:00:00 2001 From: Jian Zhang Date: Mon, 16 Apr 2018 19:11:58 +0800 Subject: [PATCH 1/2] variable: set default hash join concurrency in NewSessionVars --- sessionctx/variable/session.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 74ea322e290f9..b6960cb67b2af 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -347,6 +347,7 @@ func NewSessionVars() *SessionVars { IndexLookupConcurrency: DefIndexLookupConcurrency, IndexSerialScanConcurrency: DefIndexSerialScanConcurrency, IndexLookupJoinConcurrency: DefIndexLookupJoinConcurrency, + HashJoinConcurrency: DefTiDBHashJoinConcurrency, DistSQLScanConcurrency: DefDistSQLScanConcurrency, MaxChunkSize: DefMaxChunkSize, DMLBatchSize: DefDMLBatchSize, From ed469e46f3349e50c878246dab7f8a09d5389133 Mon Sep 17 00:00:00 2001 From: Jian Zhang Date: Mon, 16 Apr 2018 19:22:45 +0800 Subject: [PATCH 2/2] add UT for NewSessionVars() --- sessionctx/variable/varsutil_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sessionctx/variable/varsutil_test.go b/sessionctx/variable/varsutil_test.go index 74eb2d14bdbc8..6c9262a666490 100644 --- a/sessionctx/variable/varsutil_test.go +++ b/sessionctx/variable/varsutil_test.go @@ -52,6 +52,30 @@ func (s *testVarsutilSuite) TestTiDBOptOn(c *C) { } } +func (s *testVarsutilSuite) TestNewSessionVars(c *C) { + defer testleak.AfterTest(c)() + vars := NewSessionVars() + + c.Assert(vars.BuildStatsConcurrencyVar, Equals, DefBuildStatsConcurrency) + c.Assert(vars.IndexJoinBatchSize, Equals, DefIndexJoinBatchSize) + c.Assert(vars.IndexLookupSize, Equals, DefIndexLookupSize) + c.Assert(vars.IndexLookupConcurrency, Equals, DefIndexLookupConcurrency) + c.Assert(vars.IndexSerialScanConcurrency, Equals, DefIndexSerialScanConcurrency) + c.Assert(vars.IndexLookupJoinConcurrency, Equals, DefIndexLookupJoinConcurrency) + c.Assert(vars.HashJoinConcurrency, Equals, DefTiDBHashJoinConcurrency) + c.Assert(vars.DistSQLScanConcurrency, Equals, DefDistSQLScanConcurrency) + c.Assert(vars.MaxChunkSize, Equals, DefMaxChunkSize) + c.Assert(vars.DMLBatchSize, Equals, DefDMLBatchSize) + c.Assert(vars.MemQuotaQuery, Equals, int64(DefTiDBMemQuotaQuery)) + c.Assert(vars.MemQuotaHashJoin, Equals, int64(DefTiDBMemQuotaHashJoin)) + c.Assert(vars.MemQuotaMergeJoin, Equals, int64(DefTiDBMemQuotaMergeJoin)) + c.Assert(vars.MemQuotaSort, Equals, int64(DefTiDBMemQuotaSort)) + c.Assert(vars.MemQuotaTopn, Equals, int64(DefTiDBMemQuotaTopn)) + c.Assert(vars.MemQuotaIndexLookupReader, Equals, int64(DefTiDBMemQuotaIndexLookupReader)) + c.Assert(vars.MemQuotaIndexLookupJoin, Equals, int64(DefTiDBMemQuotaIndexLookupJoin)) + c.Assert(vars.MemQuotaNestedLoopApply, Equals, int64(DefTiDBMemQuotaNestedLoopApply)) +} + func (s *testVarsutilSuite) TestVarsutil(c *C) { defer testleak.AfterTest(c)() v := NewSessionVars()