Skip to content

ddl: fix cancel drop table/database ddl job bug.#8537

Merged
ciscoxll merged 21 commits intopingcap:masterfrom
crazycs520:cancel-drop-table
Dec 26, 2018
Merged

ddl: fix cancel drop table/database ddl job bug.#8537
ciscoxll merged 21 commits intopingcap:masterfrom
crazycs520:cancel-drop-table

Conversation

@crazycs520
Copy link
Copy Markdown
Contributor

@crazycs520 crazycs520 commented Nov 30, 2018

What problem does this PR solve?

related same PR #8171.
This PR fix cancel drop table/database ddl job.
The droped table/database info state is change as follows:
public -> write only -> delete only -> none.

Currently, If we cancel drop table/database ddl in write only and delete only, TiDB infoschema will delete the table and when we operate the corresponding table/database, TiDB will return error: xxx not exist. But if we create table/database with the same name will return err: xxx already exists.

This PR fix above problem, if successfully cancel the drop table/database ddl, we should make TiDB infoschema to reload the table/database.

What is changed and how it works?

Only allow cancel drop database/table before the job first run.

Cancel create table/database will be ok in currentlly, and this pr also add test for this.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
    Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

This change is Reviewable

@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-all-tests

Comment thread ddl/table.go Outdated
Comment thread ddl/schema.go Outdated
Comment thread ddl/schema.go Outdated
Comment thread ddl/table.go Outdated
Comment thread ddl/schema.go Outdated
Comment thread ddl/table.go Outdated
@winkyao
Copy link
Copy Markdown
Contributor

winkyao commented Dec 6, 2018

@zimulala PTAL

Comment thread ddl/table.go Outdated
Comment thread ddl/table.go Outdated
Comment thread ddl/table.go Outdated
Comment thread ddl/schema.go Outdated
Comment thread ddl/schema.go Outdated
Comment thread ddl/schema.go Outdated
Copy link
Copy Markdown
Contributor

@ciscoxll ciscoxll left a comment

Choose a reason for hiding this comment

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

Please solve the CI error.

Comment thread ddl/rollingback.go Outdated
@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-all-tests

Copy link
Copy Markdown
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 24, 2018
Comment thread ddl/db_test.go
Copy link
Copy Markdown
Contributor

@ciscoxll ciscoxll left a comment

Choose a reason for hiding this comment

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

LGTM

@ciscoxll ciscoxll added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Dec 25, 2018
@ciscoxll
Copy link
Copy Markdown
Contributor

/run-all-tests

@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-unit-test

@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-unit-test

2 similar comments
@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-unit-test

@crazycs520
Copy link
Copy Markdown
Contributor Author

/run-unit-test

@crazycs520
Copy link
Copy Markdown
Contributor Author

/rebuild

@ciscoxll ciscoxll merged commit ffa375f into pingcap:master Dec 26, 2018
yu34po pushed a commit to yu34po/tidb that referenced this pull request Jan 2, 2019
crazycs520 added a commit to crazycs520/tidb that referenced this pull request Feb 28, 2019
crazycs520 added a commit to crazycs520/tidb that referenced this pull request Mar 1, 2019
zimulala pushed a commit that referenced this pull request Mar 7, 2019
@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/LGT3 The PR has already had 3 LGTM. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants