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

fast_create_table: add retry for local worker #52543

Merged
merged 3 commits into from
Jul 10, 2024
Merged
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
10 changes: 9 additions & 1 deletion pkg/ddl/job_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,15 @@ func (d *ddl) delivery2LocalWorker(pool *workerPool, task *limitJobTask) {
metrics.DDLRunningJobCount.WithLabelValues(pool.tp().String()).Dec()
}()

err := wk.HandleLocalDDLJob(d.ddlCtx, job)
for i := int64(0); i < variable.GetDDLErrorCountLimit(); i++ {
err := wk.HandleLocalDDLJob(d.ddlCtx, job)
// since local the job is not inserted into the ddl job queue, we need to add retry logic here.
if err == nil || !isRetryableError(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember that if the job itself is not finished (job.IsFinished is false), it will retry itself. Why is there a special emphasis here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for fast create table, the job does not exist in the ddl job table, so the original retry mechanism (taken out from the ddl job table and re-executed) will not take effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, could we add a comment here?

break
}
logutil.DDLLogger().Info("handle local ddl job", zap.Int64("retry times", i), zap.Error(err))
time.Sleep(time.Second)
}
pool.put(wk)
if err != nil {
logutil.DDLLogger().Info("handle ddl job failed", zap.Error(err), zap.Stringer("job", job))
Expand Down