Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

shardddl/optimistic: use init-schema for table without info when recover lock (#1551) #1553

Merged
merged 4 commits into from
Apr 9, 2021

Conversation

ti-srebot
Copy link

@ti-srebot ti-srebot commented Apr 3, 2021

cherry-pick #1551 to release-2.0
You can switch your code base to this Pull Request by using git-extras:

# In dm repo:
git pr https://github.com/pingcap/dm/pull/1553

After apply modifications, you can push your change to this PR via:

git push [email protected]:ti-srebot/dm.git pr/1553:release-2.0-b6346dc1674c

What problem does this PR solve?

In #1518, we always use table-info-before to rebuild locks, but ignore the upstream table who has no optimism.Info. In such a case, we may build an incorrect joined table.

Suppose there are two upstream tables tb1(a int, b int, c int) and tb2(a int, b int, c int). A possible time series is:

t1: tb1 and tb2 are identical.
t2: tb1 drop column b, c.
t3: restart.
t4: joined becomes tb1's table-info-before, which is tb(a int). // The correct joined should be tb(a int, b int, c int).

What is changed and how it works?

Use init-schema for table without info when recover lock. If there is no optimism.Info for a upstream table, it indicates the table structure hasn't been changed since last removeLock. So the init schema should be its table info.

Check List

Tests

  • Unit test
  • Integration test

@ti-srebot ti-srebot added needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated size/L type/cherry-pick This PR is just a cherry-pick (backport) labels Apr 3, 2021
@ti-srebot ti-srebot requested review from GMHDBJD and lance6716 April 3, 2021 01:19
@ti-chi-bot ti-chi-bot requested a review from lichunzhu April 3, 2021 01:19
@lance6716
Copy link
Collaborator

/lgtm

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lance6716

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 One reviewer already commented LGTM label Apr 6, 2021
@lance6716 lance6716 merged commit 1e23b34 into pingcap:release-2.0 Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
first-time-contributor needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated size/L status/LGT1 One reviewer already commented LGTM type/cherry-pick This PR is just a cherry-pick (backport)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants