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

*: Support the operation of `cancel DDL jobs` #4753

Merged
merged 18 commits into from Oct 19, 2017

Conversation

Projects
None yet
6 participants
@zimulala
Member

zimulala commented Oct 11, 2017

If the DDL job state is done or synced, we can't cancel this job.

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Oct 11, 2017

Member

/run-all-tests

Member

zimulala commented Oct 11, 2017

/run-all-tests

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli
Member

shenli commented Oct 12, 2017

Show outdated Hide outdated inspectkv/inspectkv.go Outdated
Show outdated Hide outdated inspectkv/inspectkv.go Outdated
Show outdated Hide outdated inspectkv/inspectkv.go Outdated

@winkyao winkyao changed the title from Support the operation of `cancel DDL jobs` to ddl: Support the operation of `cancel DDL jobs` Oct 12, 2017

@zimulala zimulala changed the title from ddl: Support the operation of `cancel DDL jobs` to *: Support the operation of `cancel DDL jobs` Oct 12, 2017

Show outdated Hide outdated inspectkv/inspectkv.go Outdated
@@ -64,6 +64,47 @@ func GetDDLInfo(txn kv.Transaction) (*DDLInfo, error) {
return info, nil
}
// CancelJobs cancels the DDL jobs.
func CancelJobs(txn kv.Transaction, ids []int64) ([]error, error) {

This comment has been minimized.

@coocood

coocood Oct 12, 2017

Member

inspectkv may not be a proper package for this function.

@coocood

coocood Oct 12, 2017

Member

inspectkv may not be a proper package for this function.

This comment has been minimized.

@zimulala

zimulala Oct 12, 2017

Member

Other functions that handle jobs are placed in this package, so I put it here.

@zimulala

zimulala Oct 12, 2017

Member

Other functions that handle jobs are placed in this package, so I put it here.

Show outdated Hide outdated ddl/ddl.go Outdated
Show outdated Hide outdated inspectkv/inspectkv.go Outdated

zimulala added some commits Oct 12, 2017

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Oct 12, 2017

Member

@coocood We will rollback if the error is ErrKeyExists. It's the old logical.

Member

zimulala commented Oct 12, 2017

@coocood We will rollback if the error is ErrKeyExists. It's the old logical.

Show outdated Hide outdated ddl/ddl_worker_test.go Outdated
Show outdated Hide outdated ddl/ddl_worker_test.go Outdated
Show outdated Hide outdated ddl/ddl_worker_test.go Outdated
Show outdated Hide outdated ddl/reorg.go Outdated
baseExecutor: newBaseExecutor(v.Schema(), b.ctx),
JobIDs: v.JobIDs,
}
e.errs, b.err = inspectkv.CancelJobs(e.ctx.Txn(), e.JobIDs)

This comment has been minimized.

@shenli

shenli Oct 12, 2017

Member

Why not do this in CancelDDLJobsExec.Next()?

@shenli

shenli Oct 12, 2017

Member

Why not do this in CancelDDLJobsExec.Next()?

This comment has been minimized.

@zimulala

zimulala Oct 13, 2017

Member

It seems CancelDDLJobsExec.Next() has no txn.

@zimulala

zimulala Oct 13, 2017

Member

It seems CancelDDLJobsExec.Next() has no txn.

This comment has been minimized.

@zimulala

zimulala Oct 13, 2017

Member

We can new a txn and commit this txn in CancelDDLJobsExec.Next(). But this solution will commit the previous transaction.

@zimulala

zimulala Oct 13, 2017

Member

We can new a txn and commit this txn in CancelDDLJobsExec.Next(). But this solution will commit the previous transaction.

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli
Member

shenli commented Oct 13, 2017

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala
Member

zimulala commented Oct 16, 2017

Show outdated Hide outdated ddl/ddl_worker.go Outdated
@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala
Member

zimulala commented Oct 17, 2017

PTAL @coocood

@winkyao winkyao added the status/LGT1 label Oct 18, 2017

Show outdated Hide outdated ddl/index.go Outdated
@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Oct 18, 2017

Member

LGTM

Member

coocood commented Oct 18, 2017

LGTM

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Oct 18, 2017

Member

/run-all-tests

Member

zimulala commented Oct 18, 2017

/run-all-tests

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Oct 18, 2017

Member

/run-all-tests

Member

zimulala commented Oct 18, 2017

/run-all-tests

@zimulala zimulala added status/LGT2 and removed status/LGT1 labels Oct 18, 2017

Show outdated Hide outdated ddl/ddl.go Outdated
Show outdated Hide outdated ddl/ddl_worker_test.go Outdated
Show outdated Hide outdated model/ddl.go Outdated

zimulala added some commits Oct 19, 2017

@winoros

LGTM

@ngaut ngaut merged commit 1a987dd into master Oct 19, 2017

5 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 72.574%
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@ngaut ngaut deleted the zimuxia/cancel-ddl branch Oct 19, 2017

zimulala added a commit to zimulala/tidb that referenced this pull request Oct 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment