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

*: add session var 'tidb_ddl_reorg_worker_cnt' to control ddl reorg workers count #6441

Merged
merged 17 commits into from
Jun 27, 2018
Merged

*: add session var 'tidb_ddl_reorg_worker_cnt' to control ddl reorg workers count #6441

merged 17 commits into from
Jun 27, 2018

Conversation

winkyao
Copy link
Contributor

@winkyao winkyao commented May 2, 2018

After this PR, you can use below command to modify the count of ddl reorg workers, to
increase add index concurrency:

set tidb_ddl_reorg_worker_cnt = 100

@jackysp
Copy link
Member

jackysp commented May 3, 2018

/run-all-tests

executor/set.go Outdated
@@ -186,6 +186,8 @@ func (e *SetExecutor) setSysVariable(name string, v *expression.VarAssignment) e
if isoLevel == ast.ReadCommitted {
e.ctx.Txn().SetOption(kv.IsolationLevel, kv.RC)
}
} else if name == variable.TiDBDDLReorgWorkerCount {
domain.GetDomain(e.ctx).DDL().WorkerVars().DDLReorgWorkerCount = sessionVars.DDLReorgWorkerCount
Copy link
Member

Choose a reason for hiding this comment

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

If this is a session-scope variable, we have to find the instance which is ddl-owner and run the set statement on it. We should make it a global scope variable.
(And actually, it is a server-scope variable.)

@winkyao winkyao added the WIP label May 3, 2018
@winkyao winkyao removed the WIP label May 3, 2018
@winkyao
Copy link
Contributor Author

winkyao commented May 3, 2018

@shenli Done

@shenli
Copy link
Member

shenli commented May 3, 2018

Please fix the CI.

)

// Process global variables.
var (
ProcessGeneralLog uint32
ProcessGeneralLog uint32
DDLReorgWorkerCounter int32 = DefTiDBDDLReorgWorkerCount
Copy link
Contributor

Choose a reason for hiding this comment

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

s/DDLReorgWorkerCounter/ddlReorgWorkerCounter ?
We use GetDDLReorgWorkerCounter and SetDDLReorgWorkerCounter to change its value. So I think we'd better use the lowercase variable.

@@ -531,6 +531,9 @@ func (s *SessionVars) SetSystemVar(name string, val string) error {
s.EnableStreaming = TiDBOptOn(val)
case TiDBOptimizerSelectivityLevel:
s.OptimizerSelectivityLevel = tidbOptPositiveInt32(val, DefTiDBOptimizerSelectivityLevel)
case TiDBDDLReorgWorkerCount:
workerCnt := tidbOptPositiveInt32(val, DefTiDBDDLReorgWorkerCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to have an upper limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jackysp
Copy link
Member

jackysp commented May 24, 2018

Please resolve the conflicts @winkyao .

@shenli
Copy link
Member

shenli commented Jun 7, 2018

@winkyao Please resolve the conflicts.

@winkyao
Copy link
Contributor Author

winkyao commented Jun 11, 2018

@zimulala @shenli @jackysp PTAL

ddl/index.go Outdated
// TODO: make workerCnt can be modified by system variable.
workerCnt := defaultWorkers
// variable.ddlReorgWorkerCounter can be modified by system variable "tidb_ddl_reorg_worker_cnt".
workerCnt := variable.GetDDLReorgWorkerCounter()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we support updating worker counter when the workers are running?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be fixed later, not this PR.

@shenli
Copy link
Member

shenli commented Jun 15, 2018

Please resolve the conflicts.

@winkyao
Copy link
Contributor Author

winkyao commented Jun 15, 2018

@zimulala @shenli PTAL

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao winkyao added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 15, 2018
@winkyao
Copy link
Contributor Author

winkyao commented Jun 15, 2018

/run-all-tests

@crazycs520
Copy link
Contributor

LGTM

@ciscoxll
Copy link
Contributor

/run-all-tests

Copy link
Contributor

@ciscoxll ciscoxll left a comment

Choose a reason for hiding this comment

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

LGTM

@ciscoxll ciscoxll added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants