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

sink(cdc): fix internal retry algothrim #9530

Merged
merged 12 commits into from
Aug 14, 2023
Merged

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Aug 9, 2023

What problem does this PR solve?

Issue Number: close #9518

What is changed and how it works?

Term Definition

  • Same Error: The changefeed has not been advanced after the error occurred.

Prior to this PR, if the DDLSink or DMLSink returned the same error continuously, the SinkManager would retry it for 30 minutes. If different errors occurred, the SinkManager would reset the retry time counter. Once the 30 minutes were up, the sink manager would report an UnretryableError to the owner and the changefeed would fail immediately. However, the SinkManager couldn't accurately determine whether the error returned by the DDLSink or DMLSink was the same error (It does not reset the retry time counter when correctly), leading to incorrect UnretryableError reports and unexpected changefeed failures.

With this PR, if the DDLSink or DMLSink returns the same error continuously, the SinkManager will continue retrying indefinitely but will report a warning to the owner. Since the owner has a broader view of the changefeed, it can determine if the error reported by the sinkManager is the same error. This PR takes the checkpoint into account to make the decision. The underlying logic is simple: if the checkpoint advanced since the last error was reported, the subsequent error is not the same as the previous error. Thus, the retry time is reset to ensure that the subsequent error will be also retry for 30 minutes.

Check List

Tests

  • Unit test

Questions

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

Release note

None

Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 9, 2023
Signed-off-by: qupeng <qupeng@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 9, 2023
Signed-off-by: qupeng <qupeng@pingcap.com>
@hicqu
Copy link
Contributor Author

hicqu commented Aug 10, 2023

/test verify

cdc/owner/ddl_sink.go Outdated Show resolved Hide resolved
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 14, 2023
@hicqu
Copy link
Contributor Author

hicqu commented Aug 14, 2023

/test cdc-integration-mysql-test

Signed-off-by: qupeng <qupeng@pingcap.com>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: asddongmen, CharlesCheung96

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 [CharlesCheung96,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 ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 14, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-14 07:19:56.824174057 +0000 UTC m=+529161.373190041: ☑️ agreed by asddongmen.
  • 2023-08-14 07:55:23.909220282 +0000 UTC m=+531288.458236254: ☑️ agreed by CharlesCheung96.

@ti-chi-bot ti-chi-bot bot merged commit bd210f8 into pingcap:master Aug 14, 2023
3 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Aug 14, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Aug 14, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@hicqu hicqu deleted the sink-retry-fix branch August 14, 2023 09:47
@hicqu hicqu removed the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Aug 14, 2023
@asddongmen asddongmen added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Aug 15, 2023
@ti-chi-bot
Copy link
Member

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

@asddongmen
Copy link
Contributor

/need-cherry-pick-release-6.5

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Aug 15, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
hicqu added a commit to ti-chi-bot/tiflow that referenced this pull request Aug 15, 2023
close pingcap#9518

Signed-off-by: qupeng <qupeng@pingcap.com>
ti-chi-bot bot pushed a commit that referenced this pull request Aug 15, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Aug 16, 2023
3AceShowHand pushed a commit to 3AceShowHand/tiflow that referenced this pull request Aug 29, 2023
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-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiCDC changefeed stucks after cdc owner to Kafka network partition recovered
4 participants