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) #8626

Merged

Conversation

ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Dec 29, 2023

This is an automated cherry-pick of #8623

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

@JaySon-Huang
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Dec 29, 2023
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@JaySon-Huang
Copy link
Contributor

[2023-12-29T03:59:04.129Z] [2023/12/29 11:58:43.831 +08:00] [ERROR] [Exception.cpp:91] ["Poco::Exception. Code: 1000, e.code() = 2, e.displayText() = Exception: Send TsoRequest failed, e.what() = Exception"] [source="DB::RawCppPtr DB::PreHandleSnapshot(DB::EngineStoreServerWrap *, DB::BaseBuffView, uint64_t, DB::SSTViewVec, uint64_t, uint64_t)"] [thread_id=572]

@JaySon-Huang
Copy link
Contributor

/run-integration-test

@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: JaySon-Huang, 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 [JaySon-Huang,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 03:49:05.45562332 +0000 UTC m=+1796836.492850250: ☑️ agreed by Lloyd-Pottiger.
  • 2023-12-29 07:05:49.113111651 +0000 UTC m=+1808640.150338593: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit 46e46dd into pingcap:release-7.5 Dec 29, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants