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

kv (ticdc): fix kvClient reconnection downhill loop (#10559) #10572

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #10559

What problem does this PR solve?

Issue Number: close #10239

What is changed and how it works?

  1. Add an ID to the eventFeedStream struct to identify a stream and prevent it from being deleted unexpectedly.
  2. Bind the cancel function of a gRPC stream to its eventFeedStream to prevent the stream from being canceled unexpectedly.
  3. Reduce the number of calls to s.deleteStream to only once to prevent the stream from being deleted unexpectedly.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. Add hard code time.sleep(5 * time.second) before calling s.deleteStream in both unfixed and fixed version of code.
  2. Deploy a TiDB cluster with 3 TiKV nodes and 1 TiCDC server, create a changefeed.
  3. Patch the changed cdc binary, and restart a TiKV node randomly and observe the changefeed's lag.

unfixed cdc:
img_v3_027f_9b5e20b7-2aab-44b7-8884-fc29d2797beg

fixed cdc:
image

From the above graphs, it is evident that in the unfixed CDC, the lag of resolvedTs can exceed 12 minutes when a TiKV node is restarted. However, in the fixed CDC, the increase in resolvedTs is limited to a maximum of 35 seconds. This demonstrates the effectiveness of the fix.

Moreover, when the hard-coded time.sleep(5 * time.second) is removed and the fixed version of CDC is tested again, the lag becomes even smaller:
image

Questions

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

Release note

Fix a bug in kv client that could cause an increase in changefeed lag when TiKV is restarted.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added area/ticdc Issues or PRs related to TiCDC. component/kv-client TiKV kv log client component. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Jan 31, 2024
Copy link
Contributor

ti-chi-bot bot commented Jan 31, 2024

[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 assign gozssky for approval. For more information see the Kubernetes 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 ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Jan 31, 2024
Copy link
Contributor

ti-chi-bot bot commented Jan 31, 2024

@ti-chi-bot: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
jenkins-ticdc/verify fc9ba7e link true /test verify
pull-cdc-integration-storage-test fc9ba7e link true /test cdc-integration-storage-test
pull-cdc-integration-mysql-test fc9ba7e link true /test cdc-integration-mysql-test
pull-cdc-integration-pulsar-test fc9ba7e link true /test cdc-integration-pulsar-test
pull-cdc-integration-kafka-test fc9ba7e link true /test cdc-integration-kafka-test

Full PR test history. Your PR dashboard.

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 kubernetes/test-infra repository. I understand the commands that are listed here.

@asddongmen
Copy link
Contributor

This issue can not happen in 7.5.0, so close it.

@asddongmen asddongmen closed this Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. cherry-pick-approved Cherry pick PR approved by release team. component/kv-client TiKV kv log client component. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants