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: cancel job,after met DropTableOrView error #40641

Closed
wants to merge 1 commit into from

Conversation

ystaticy
Copy link
Contributor

@ystaticy ystaticy commented Jan 17, 2023

Signed-off-by: ystaticy [email protected]

What problem does this PR solve?

Issue Number: ref #40783

Problem Summary:
I met the error when TiDB call upgradeToVer94, upgrade from TiDB 6.2 to TiDB 6.4.
If the create and replace view ddl job in upgradeToVer94 is interrupted , we may encounter table doesn't exist(In fact, the old view has been dropped ) in DropTableOrView when we restart tidb and the rerun the job by old view info.

What is changed and how it works?

If we encounter table doesn't exist(the old view has been dropped ) the job.State need to be set to model.JobStateCancelled

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

fix create and replace view job state

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link
Member

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot added do-not-merge/invalid-title do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 17, 2023
@ystaticy ystaticy changed the title cancel job,after met DropTableOrView error [ddl]cancel job,after met DropTableOrView error Jan 17, 2023
@ystaticy ystaticy changed the title [ddl]cancel job,after met DropTableOrView error ddl: cancel job,after met DropTableOrView error Jan 17, 2023
@tangenta
Copy link
Contributor

@ystaticy I think this issue has been fixed by #40353?

@@ -301,6 +301,7 @@ func onCreateView(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, _ error)
if oldTbInfoID > 0 && orReplace {
err = t.DropTableOrView(schemaID, oldTbInfoID)
if err != nil {
job.State = model.JobStateCancelled
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to check oldTbInfoID after L291

@ystaticy ystaticy closed this Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants