-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
ddl: add a channel to limit multiple DDL jobs writing at the same time #14342
Conversation
Please explain the meaning of ”taskCnt" and "Count" in the table in your PR Description. |
@bb7133 ”taskCnt" and "Count" are the variables in the benchmark. |
for { | ||
tasks := make([]*limitJobTask, 0, batchAddingJobs) | ||
select { | ||
case task := <-d.limitJobCh: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not quite understand how this limits the task rate.
By let multiple worker conflict on the same channel and increase the runtime lock spin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write conflicts occur when multiple DDL jobs are written to the DDL job list at the same time.
We use this channel to reduce such conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
job.StartTS = txn.StartTS() | ||
job.ID = ids[i] | ||
if err = buildJobDependence(t, job); err != nil { | ||
return errors.Trace(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one task fails, following tasks are discarded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but we get jobs failed only this function will fail to get jobs from TiKV. Therefore, if this job gets jobs failed, the other job should also fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @djshow832
PTAL @coocood |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
for i, task := range tasks { | ||
job := task.job | ||
job.Version = currentVersion | ||
job.StartTS = txn.StartTS() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batch DDL jobs share the same txn.StartTS()? unless these ddls is in same statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But not necessarily the same statement.
And this field has no special use in TiFilash and Tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
@zimulala merge failed. |
/run-all-tests |
/run-integration-ddl-test |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-3.0 in PR #15148 |
What problem does this PR solve?
When performing DDL operations on multiple connections at the same time, you may encounter a "Write conflict" error.
What is changed and how it works?
Adding a channel on a single TiDB to limit multiple DDL jobs writing to the DDL job list at the same time results in "Write conflict".
Check List
Tests
WC is the error of
write confilct
.Related changes
Release note