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

ddl: delete ranges when rolling back 'add index' #6188

Merged
merged 4 commits into from
Apr 2, 2018

Conversation

zimulala
Copy link
Contributor

We need to delete ranges when the operation of 'add index' needs to be rolled back.

@zimulala
Copy link
Contributor Author

/run-all-tests

@zimulala
Copy link
Contributor Author

PTAL @winkyao @coocood

@@ -323,6 +323,7 @@ func (s *testDBSuite) TestCancelAddIndex(c *C) {
}

var checkErr error
var idxInfo *model.IndexInfo
Copy link
Member

Choose a reason for hiding this comment

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

c3IdxInfo is more readable.

break
}
// ActionAddIndex needs to delete ranges when it needs to be rolled back.
fallthrough
Copy link
Member

Choose a reason for hiding this comment

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

fallthrough is rarely used, it's hard to read.
How about extracting a function shouldDeleteRange?

ddl/index.go Outdated
@@ -395,6 +395,7 @@ func (d *ddl) onDropIndex(t *meta.Meta, job *model.Job) (ver int64, _ error) {
job.FinishTableJob(model.JobStateDone, model.StateNone, ver, tblInfo)
}
job.Args = append(job.Args, indexInfo.ID)
log.Warnf("args %v, ts %v", job.Args, t.StartTS)
Copy link
Member

Choose a reason for hiding this comment

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

Remove the warn log.

@zimulala
Copy link
Contributor Author

zimulala commented Apr 2, 2018

PTAL @coocood

@shenli shenli added the DDL label Apr 2, 2018
Copy link
Member

@shenli shenli left a comment

Choose a reason for hiding this comment

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

Rest LGTM

}
// ActionAddIndex needs to delete ranges when it needs to be rolled back.
Copy link
Member

Choose a reason for hiding this comment

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

After rolling back an AddIndex operation, we need to use delete-range to delete the half-done index data.

@zimulala
Copy link
Contributor Author

zimulala commented Apr 2, 2018

PTAL @shenli

@shenli
Copy link
Member

shenli commented Apr 2, 2018

LGTM

@shenli
Copy link
Member

shenli commented Apr 2, 2018

@winkyao @coocood @ciscoxll PTAL

@zimulala zimulala added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 2, 2018
Copy link
Member

@coocood coocood left a comment

Choose a reason for hiding this comment

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

LGTM

@coocood coocood merged commit fddaf75 into pingcap:master Apr 2, 2018
@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 2, 2018
@zimulala zimulala deleted the ddl-del-range branch August 7, 2018 06:33
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants