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: improve the processing speed of general DDL jobs #19997
Conversation
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
@@ -0,0 +1,102 @@ | |||
// Copyright 202- PingCAP, Inc. |
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.
// Copyright 202- PingCAP, Inc. | |
// Copyright 2020- PingCAP, Inc. |
type DDLJobSubscriber interface { | ||
// WaitNewDDLJob return a channel for new ddl job notify | ||
WaitNewDDLJob(ctx context.Context) clientv3.WatchChan | ||
// NotifyNewDDLJob when dll job enqueue |
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.
// NotifyNewDDLJob when dll job enqueue | |
// NotifyNewDDLJob when ddl job enqueue |
} | ||
|
||
func (sub *ddlJobSubscirber) WaitNewDDLJob(ctx context.Context) clientv3.WatchChan { | ||
return sub.etcdCli.Watch(ctx, "/tidb//ddl/job/reverse") |
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.
why use double /
here?
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.
It's a mistake
case <-w.ctx.Done(): | ||
return | ||
if d.ownerManager.IsOwner() { | ||
select { |
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.
NotifyNewDDLJob(ctx context.Context) error | ||
// WaitDDLJobDone return a channel for ddl job doned notify | ||
WaitDDLJobDone(ctx context.Context, jobID int64) clientv3.WatchChan | ||
// NotifyDDLJobDone when dll job dequeue |
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.
ditto
return &mockDDLJobSubscriber{childCtx, cancelFunc} | ||
} | ||
|
||
func (sub *mockDDLJobSubscriber) WaitNewDDLJob(ctx context.Context) clientv3.WatchChan { |
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.
seem WaitNewDDLJob
and WaitDDLJobDone
will block on this? the channel returned here doesn't have the input.
There is no reward for this challenge pull request, so you can request a reward from @zimulala. |
1 similar comment
There is no reward for this challenge pull request, so you can request a reward from @zimulala. |
What problem does this PR solve?
Issue Number: close #14770
This is a tentative proposal may be wrong, I am not so sure this proposal work better than before program.
@zimulala PTAL, I really need some advices.
Problem Summary:
What is changed and how it works?
What's Changed:
doDDLJob
called on non-owner TiDB serverdoDDLJob
called on non-owner TiDBHow it Works:
/tidb//ddl/job/reverse
in select loop whendoDDLJob
called on non-owner TiDB/tidb//ddl/job/reverse
whendoDDLJob
calleddoDDLJob
called on non-owner TiDB/tidb/ddl/job/done/{jobID}
as DDL job done notification when callrunDDLJob
and job state is synced or cancelledCheck List
Release note
Improve the processing speed of general DDL jobs