-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: set correct startHandle when add indices meets some errors #6897
Conversation
ddl/index.go
Outdated
|
||
batchTasks = append(batchTasks, task) | ||
if len(batchTasks) >= len(workers) || i == (len(kvRanges)-1) { | ||
// Wait tasks finish. | ||
err = w.handleReorgTasks(startTime, startHandle, reorgInfo, &totalAddedCount, workers, batchTasks) | ||
err = w.handleReorgTasks(startTime, firstHandle, reorgInfo, &totalAddedCount, workers, batchTasks) |
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 guess the firstHandle
argument is redundant.
You can always get it from batchTasks[0].start
, right?
ddl/index.go
Outdated
@@ -687,6 +689,14 @@ func (w *addIndexWorker) run(d *ddlCtx) { | |||
} | |||
|
|||
log.Debug("[ddl-reorg] got backfill index task:#v", task) | |||
|
|||
if task.mockTask { |
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 not gofail here directly?
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.
Here is in a multi-thread environment, so it's non-trivial to control the gofail run only once.
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.
Could we use addIndexWorker's offset to control this error run only once? Then we can use gofail here, and remove the variables in handleReorgTasks
.
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.
@winkyao
I think it worth it to gofail here directly.
We can check the worker id to avoid race.
@tiancaiamao PTAL |
LGTM |
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 |
ddl/index.go
Outdated
for i, task := range batchTasks { | ||
// gofail: var mockAddIndexErr bool | ||
// if mockAddIndexErr && !gofailMockAddindexErrOnceGuard { |
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.
gofailMockAddindexErrOnceGuard
is too long.
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.
To avoid name conflicts.
LGTM |
LGTM |
Thank you for working on TiDB! Please read TiDB's CONTRIBUTING document BEFORE filing this PR.
What have you changed? (mandatory)
Before this PR, we will fail the added gofail test.
When we encounter an error, we will update incorrect handle to the DDL job. Then we will never backfill the skipped indices range, cause
admin check table
failed.What are the type of the changes (mandatory)?
How has this PR been tested (mandatory)?
Unit test.
@zimulala @crazycs520 @ciscoxll PTAL