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

owner(ticdc): Fix an unexpected stop problem for changefeed backoff #6351

Merged
merged 17 commits into from
Jul 21, 2022

Conversation

zhaoxinyu
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #6348

What is changed and how it works?

Use 0 as MaxElapsedTime value instead of not populating this field. Because if MaxElapsedTime is not set,
15 min will be used in default. So after 15min, the backoff will stop, which is unexpected.
Ref https://github.com/cenkalti/backoff/blob/6b0e4ad0cd65431b217393bff47d1dff727b264b/exponential.go#L80

Check List

Tests

  • Unit test
  • Integration test

Questions

Will it cause performance regression or break compatibility?

No

Do you need to update user documentation, design documentation or monitoring documentation?

No

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 19, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • asddongmen
  • overvenus

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. do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed labels Jul 19, 2022
@zhaoxinyu
Copy link
Contributor Author

/cc @asddongmen
/cc @overvenus
/cc @sdojjy

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 19, 2022
@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 Jul 19, 2022
@amyangfei
Copy link
Contributor

amyangfei commented Jul 19, 2022

Note the affected versions should be updated, since #4262 was picked to all release branches. @zhaoxinyu

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Please add unit tests. Also make sure when a processor reports an error, owner close its changefeed immediately.

@ti-chi-bot ti-chi-bot removed the status/LGT2 Indicates that a PR has LGTM 2. label Jul 20, 2022
@zhaoxinyu
Copy link
Contributor Author

zhaoxinyu commented Jul 20, 2022

Please add unit tests. Also make sure when a processor reports an error, owner close its changefeed immediately.

@overvenus We already have a test case TestHandleError to cover the backoff retry. The root cause of this issue is due to the hidden DefaultMaxElapsedTime = 15 * time.Minute in the backoff lib. I thought about adding more intervals in the following lines to let the total elapsed time pass 15min:

intervals := []time.Duration{200, 400, 800, 1600, 1600}
for i, d := range intervals {
intervals[i] = d * time.Millisecond
}
for _, d := range intervals {

However, 15min is extremely long for a unit test. Do you have any suggestions?

@zhaoxinyu
Copy link
Contributor Author

zhaoxinyu commented Jul 20, 2022

Note the affected versions should be updated, since #4262 was picked to all release branches. @zhaoxinyu

The problem fixed by this PR is introduced in #6020, which was in a feature branch. In that PR, defaultBackoffMaxElapsedTime was removed to solve another issue #5647. It should be solved in master branch instead of in the feature branch. It is my mistake.

Maybe I should submit an other standalone PR in 6.1 branch and cherry-pick it back? @amyangfei How do you think?

@overvenus
Copy link
Member

Please add unit tests. Also make sure when a processor reports an error, owner close its changefeed immediately.

@overvenus We already have a test case TestHandleError to cover the backoff retry. The root cause of this issue is due to the hidden DefaultMaxElapsedTime = 15 * time.Minute in the backoff lib. I thought about adding more intervals in the following lines to let the total elapsed time pass 15min:

intervals := []time.Duration{200, 400, 800, 1600, 1600}
for i, d := range intervals {
intervals[i] = d * time.Millisecond
}
for _, d := range intervals {

However, 15min is extremely long for a unit test. Do you have any suggestions?

What about setting a smaller backoff interval in tests?

@zhaoxinyu
Copy link
Contributor Author

What about setting a smaller backoff interval in tests?

@overvenus , in the unit tests, I think the backoff interval is already small enough. Ref:

func newFeedStateManager4Test() *feedStateManager {
f := new(feedStateManager)
f.errBackoff = backoff.NewExponentialBackOff()
f.errBackoff.InitialInterval = 200 * time.Millisecond
f.errBackoff.MaxInterval = 1600 * time.Millisecond
f.errBackoff.Multiplier = 2.0

@overvenus
Copy link
Member

so make sure when a processor reports an error, owner close its changefeed immediately.

Okay, we need a test as mentioned above.

@amyangfei
Copy link
Contributor

Note the affected versions should be updated, since #4262 was picked to all release branches. @zhaoxinyu

The problem fixed by this PR is introduced in #6020, which was in a feature branch. In that PR, defaultBackoffMaxElapsedTime was removed to solve another issue #5647. It should be solved in master branch instead of in the feature branch. It is my mistake.

Maybe I should submit an other standalone PR in 6.1 branch and cherry-pick it back? @amyangfei How do you think?

looks fine

@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-6.2 Should cherry pick this PR to release-6.2 branch. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 21, 2022
@zhaoxinyu zhaoxinyu requested a review from overvenus July 21, 2022 03:24
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 21, 2022
@asddongmen
Copy link
Contributor

/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 Jul 21, 2022
@asddongmen
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 6a699ae

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 21, 2022
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Jul 21, 2022
@asddongmen
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 1b50c47

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 21, 2022
@zhaoxinyu
Copy link
Contributor Author

/run-dm-compatibility-test
/run-dm-integration-test
/run-integration-test
/run-kafka-integration-test

@zhaoxinyu
Copy link
Contributor Author

/run-integration-test
/run-kafka-integration-test

@zhaoxinyu
Copy link
Contributor Author

/run-all-tests

@zhaoxinyu
Copy link
Contributor Author

/run-verify

@zhaoxinyu
Copy link
Contributor Author

/run-kafka-integration-test

@zhaoxinyu
Copy link
Contributor Author

/run-integration-test

@ti-chi-bot
Copy link
Member

@zhaoxinyu: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@zhaoxinyu
Copy link
Contributor Author

/run-integration-test

@ti-chi-bot ti-chi-bot merged commit 478b817 into pingcap:master Jul 21, 2022
@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.2 Should cherry pick this PR to release-6.2 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.

Owner does not retry changefeed when the changefeed reports error frequently
6 participants