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

DM(syncer): fix lost lost dml under special sharding ddls #5006

Merged
merged 6 commits into from
Mar 25, 2022
Merged

DM(syncer): fix lost lost dml under special sharding ddls #5006

merged 6 commits into from
Mar 25, 2022

Conversation

WizardXiao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #5002

What is changed and how it works?

Change the check method of whether sync dml to be active ddl >= dml.

Check List

Tests

  • Integration test

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 24, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • 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 submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-2.0.5 needs-cherry-pick-release-2.0.6 needs-cherry-pick-release-2.0.7 needs-cherry-pick-release-6.0 Should cherry pick this PR to release-6.0 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 24, 2022
@WizardXiao WizardXiao added the area/dm Issues or PRs related to DM. label Mar 24, 2022
@WizardXiao
Copy link
Contributor Author

/cc @lance6716 @GMHDBJD

@WizardXiao
Copy link
Contributor Author

/run-all-tests

@@ -239,7 +239,8 @@ func (sg *ShardingGroup) CheckSyncing(source string, location binlog.Location) (
if activeDDLItem == nil {
return true
}
return binlog.CompareLocation(activeDDLItem.FirstLocation, location, sg.enableGTID) > 0
// ddl position caculate use last_position's gtid, when last is a dml, it will be equal, but the dml should be synced.
return binlog.CompareLocation(activeDDLItem.FirstLocation, location, sg.enableGTID) >= 0
Copy link
Contributor

@GMHDBJD GMHDBJD Mar 24, 2022

Choose a reason for hiding this comment

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

I don't think this is a solution. The issue is because last_position is wrong after pingcap/dm#1926, the correct behavior is

DML 
# activeDDLItem.FirstLocation  <-- (endlocation of DML, start location of DDL, lastLocation)
DDL

after pingcap/dm#1926

DML
DDL
# activeDDLItem.FirstLocation(gtid) <-- (endlocation of DDL, lastLocation)

so now binlog.CompareLocation(activeDDLItem.FirstLocation, location, sg.enableGTID) greater than 0

Copy link
Contributor

Choose a reason for hiding this comment

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

But I forgot why we update last location when receive begin, cc @lance6716

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe to some problems of exit safe point. I'll take a look later

@WizardXiao
Copy link
Contributor Author

/run-all-tests

@WizardXiao
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 25, 2022
@WizardXiao
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 25, 2022
@lance6716
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 76f3ef9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 25, 2022
@ti-chi-bot ti-chi-bot merged commit 3a5cbcb into pingcap:master Mar 25, 2022
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Mar 25, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5026.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Mar 25, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5027.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout release-2.0.5: error checking out release-2.0.5: exit status 1. output: error: pathspec 'release-2.0.5' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout release-2.0.6: error checking out release-2.0.6: exit status 1. output: error: pathspec 'release-2.0.6' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout release-2.0.7: error checking out release-2.0.7: exit status 1. output: error: pathspec 'release-2.0.7' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5028.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. needs-cherry-pick-release-2.0.5 needs-cherry-pick-release-2.0.6 needs-cherry-pick-release-2.0.7 needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.0 Should cherry pick this PR to release-6.0 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DM(syncer): syncer may lost dml under special sharding ddls
4 participants