Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sessionctx: make tidb_max_chunk_size as a global variable (#6585) #8333

Merged
merged 2 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ const loadCommonGlobalVarsSQL = "select HIGH_PRIORITY * from mysql.global_variab
variable.TiDBHashJoinConcurrency + quoteCommaQuote +
variable.TiDBDDLReorgWorkerCount + quoteCommaQuote +
variable.TiDBDistSQLScanConcurrency + quoteCommaQuote +
variable.TiDBMaxChunkSize + quoteCommaQuote +
variable.TiDBDisableTxnAutoRetry + "')"

// loadCommonGlobalVariablesIfNeeded loads and applies commonly used global variables for the session.
Expand Down
4 changes: 4 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,10 @@ func (s *testSchemaSuite) TestTableReaderChunk(c *C) {
s.cluster.SplitTable(s.mvccStore, tbl.Meta().ID, 10)

tk.Se.GetSessionVars().DistSQLScanConcurrency = 1
tk.MustExec("set tidb_max_chunk_size = 2")
eurekaka marked this conversation as resolved.
Show resolved Hide resolved
defer func() {
tk.MustExec(fmt.Sprintf("set tidb_max_chunk_size = %d", variable.DefMaxChunkSize))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just set tidb_max_chunk_size=default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

}()
rs, err := tk.Exec("select * from chk")
c.Assert(err, IsNil)
chk := rs.NewChunk()
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ var defaultSysVars = []*SysVar{
{ScopeSession, TiDBBatchDelete, boolToIntStr(DefBatchDelete)},
{ScopeSession, TiDBDMLBatchSize, strconv.Itoa(DefDMLBatchSize)},
{ScopeSession, TiDBCurrentTS, strconv.Itoa(DefCurretTS)},
{ScopeSession, TiDBMaxChunkSize, strconv.Itoa(DefMaxChunkSize)},
{ScopeGlobal | ScopeSession, TiDBMaxChunkSize, strconv.Itoa(DefMaxChunkSize)},
{ScopeSession, TIDBMemQuotaQuery, strconv.FormatInt(config.GetGlobalConfig().MemQuotaQuery, 10)},
{ScopeSession, TIDBMemQuotaHashJoin, strconv.FormatInt(DefTiDBMemQuotaHashJoin, 10)},
{ScopeSession, TIDBMemQuotaMergeJoin, strconv.FormatInt(DefTiDBMemQuotaMergeJoin, 10)},
Expand Down
6 changes: 3 additions & 3 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ const (
// User could change it to a smaller one to avoid breaking the transaction size limitation.
TiDBDMLBatchSize = "tidb_dml_batch_size"

// tidb_max_chunk_capacity is used to control the max chunk size during query execution.
TiDBMaxChunkSize = "tidb_max_chunk_size"

// The following session variables controls the memory quota during query execution.
// "tidb_mem_quota_query": control the memory quota of a query.
// "tidb_mem_quota_hashjoin": control the memory quota of "HashJoinExec".
Expand Down Expand Up @@ -149,6 +146,9 @@ const (
// when we need to keep the data output order the same as the order of index data.
TiDBIndexSerialScanConcurrency = "tidb_index_serial_scan_concurrency"

// tidb_max_chunk_capacity is used to control the max chunk size during query execution.
TiDBMaxChunkSize = "tidb_max_chunk_size"

// tidb_skip_utf8_check skips the UTF8 validate process, validate UTF8 has performance cost, if we can make sure
// the input string values are valid, we can skip the check.
TiDBSkipUTF8Check = "tidb_skip_utf8_check"
Expand Down