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: Fix sync empty schema diff #8623

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Dec 29, 2023

What problem does this PR solve?

Issue Number: close #8578, close #8289

Problem Summary: When there is conflict in concurrency DDL, it will skip some schema version, which generate an empty SchemaDiff.

What is changed and how it works?

Skip when meets an empty SchemaDiff in the non-latest schema version
As that in the relese-7.1 branch #8578 (comment)

SchemaBuilder<Getter, NameMapper> builder(getter, context, databases, used_version);
try
{
for (size_t diff_index = 0; diff_index < diffs.size(); ++diff_index)
{
const auto & schema_diff = diffs[diff_index];
if (!schema_diff)
{
// If `schema diff` got empty `schema diff`(it's not the latest one, due to we check it before), we should just skip it.
//
// example:
// - `cur_version` is 1, `latest_version` is 10
// - The schema diff of schema version [2,4,6] is empty, Then we just skip it.
// - The schema diff of schema version 10 is empty, Then we should just apply version into 9(which we check it before)
LOG_WARNING(log, "Skip the schema diff from version {}. ", cur_version + diff_index + 1);
continue;
}
if (schema_diff->regenerate_schema_map)
{
// If `schema_diff.regenerate_schema_map` == true, return `-1` direclty, let TiFlash reload schema info from TiKV.
LOG_INFO(log, "Meets a schema diff with regenerate_schema_map flag");
return -1;
}
builder.applyDiff(*schema_diff);
}
}

Refine the readme of running integration tests in local

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Fix the crash issue after TiDB's concurrent DDL meets a conflict

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-7.5 release-note-none size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note and removed release-note-none labels Dec 29, 2023
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 29, 2023
Copy link
Contributor

ti-chi-bot bot commented Dec 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JinheLin, Lloyd-Pottiger

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JinheLin,Lloyd-Pottiger]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

ti-chi-bot bot commented Dec 29, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-29 01:45:27.194155499 +0000 UTC m=+1789418.231382423: ☑️ agreed by Lloyd-Pottiger.
  • 2023-12-29 02:49:41.308491256 +0000 UTC m=+1793272.345718184: ☑️ agreed by JinheLin.

@JaySon-Huang
Copy link
Contributor Author

/run-unit-test

@ti-chi-bot ti-chi-bot bot merged commit 9d6d293 into pingcap:master Dec 29, 2023
6 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #8626.

@ti-chi-bot
Copy link
Member

/cherry-pick release-7.5

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request could not be created: failed to create pull request against pingcap/tiflash#release-7.5 from head ti-chi-bot:cherry-pick-8623-to-release-7.5: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between pingcap:release-7.5 and ti-chi-bot:cherry-pick-8623-to-release-7.5"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

@ti-chi-bot
Copy link
Member

@ti-chi-bot: new pull request could not be created: failed to create pull request against pingcap/tiflash#release-7.5 from head ti-chi-bot:cherry-pick-8623-to-release-7.5: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between pingcap:release-7.5 and ti-chi-bot:cherry-pick-8623-to-release-7.5"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

In response to this:

/cherry-pick release-7.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 release-note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Found empty schema diff in the non-latest schema version ddl: crash in syncSchemaDiffs
4 participants