tiflow icon indicating copy to clipboard operation
tiflow copied to clipboard

pkg/causality(cdc): refactor and simplify conflict detector

Open CharlesCheung96 opened this issue 10 months ago • 11 comments

What problem does this PR solve?

Issue Number: close #10973

What is changed and how it works?

  • Remove some useless and redundant logic.
  • Move sortAndDedupHashes to pkg/causality/internal/slots.go, since it is used to solve the false positive problem caused by hash conflicts in slots.
  • For txnEvent interface, rename GenSortedDedupKeysHash to ConflictKeys to ensure semantic consistency, because the implementers should not care about internal implementations of conflict_detector.

Check List

Tests

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

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

CharlesCheung96 avatar Apr 23 '24 11:04 CharlesCheung96

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[bot] avatar Apr 23 '24 11:04 ti-chi-bot[bot]

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from charlescheung96, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

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

Needs approval from an approver in each of these files:

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

ti-chi-bot[bot] avatar Apr 23 '24 11:04 ti-chi-bot[bot]

/test all

CharlesCheung96 avatar Apr 23 '24 11:04 CharlesCheung96

Codecov Report

Attention: Patch coverage is 78.43137% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 58.4036%. Comparing base (cd065d3) to head (b103f65). Report is 34 commits behind head on master.

Additional details and impacted files
Components Coverage Δ
cdc 63.4049% <78.4313%> (+1.7170%) :arrow_up:
dm 51.4824% <ø> (+0.2188%) :arrow_up:
engine 63.4232% <ø> (+0.0635%) :arrow_up:
Flag Coverage Δ
unit 58.4036% <78.4313%> (+1.0006%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

@@               Coverage Diff                @@
##             master     #10954        +/-   ##
================================================
+ Coverage   57.4030%   58.4036%   +1.0006%     
================================================
  Files           851        853         +2     
  Lines        125145     127855      +2710     
================================================
+ Hits          71837      74672      +2835     
+ Misses        47917      47752       -165     
- Partials       5391       5431        +40     

codecov[bot] avatar Apr 23 '24 11:04 codecov[bot]

/test all

CharlesCheung96 avatar Apr 24 '24 11:04 CharlesCheung96

/test all

CharlesCheung96 avatar Apr 24 '24 15:04 CharlesCheung96

/retest

CharlesCheung96 avatar Apr 25 '24 10:04 CharlesCheung96

/retest

CharlesCheung96 avatar Apr 26 '24 10:04 CharlesCheung96

We found an out-of-order write problem that could be caused by a conflict detector. /hold until we find the root cause of the problem.

CharlesCheung96 avatar Apr 28 '24 09:04 CharlesCheung96

/unhold

CharlesCheung96 avatar Apr 29 '24 12:04 CharlesCheung96

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3AceShowHand, asddongmen

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~~ [3AceShowHand,asddongmen]

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

ti-chi-bot[bot] avatar May 15 '24 10:05 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-05-13 03:36:56.006992557 +0000 UTC m=+1451569.764128145: :ballot_box_with_check: agreed by asddongmen.
  • 2024-05-15 10:43:05.073179736 +0000 UTC m=+1649938.830315327: :ballot_box_with_check: agreed by 3AceShowHand.

ti-chi-bot[bot] avatar May 15 '24 10:05 ti-chi-bot[bot]

/retest

CharlesCheung96 avatar May 15 '24 13:05 CharlesCheung96

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot

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

ti-chi-bot avatar Jun 07 '24 07:06 ti-chi-bot