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

autoid_service: fix potential 'duplicated entry' error when tidb exit… #46507

Conversation

YangKeao
Copy link
Member

This is a cherry-pick of #46445

What problem does this PR solve?

Issue Number: close #46444

Problem Summary:

What is changed and how it works?

If the autoid service node is not leader, it should not save the cached id back to tikv.

Check List

Tests

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix potential 'duplicated entry' error when tidb exit for AUTO_ID_CACHE=1 tables.
The bug could happen when a tidb is the autoid_service leader previously, and exit as non-leader, it stores staled next autoid value to tikv in a force rebase way. If the value is loaded again, the autoid decreases and could cause duplicates.

@ti-chi-bot ti-chi-bot bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 30, 2023
@ti-chi-bot ti-chi-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 30, 2023
@YangKeao YangKeao requested a review from bb7133 August 30, 2023 08:38
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 30, 2023

@YangKeao: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev_2 57ef9f2 link true /test check-dev2

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.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiancaiamao

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:

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 the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 30, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 30, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-30 08:48:48.025186287 +0000 UTC m=+1916892.574202259: ☑️ agreed by tiancaiamao.

@ti-chi-bot ti-chi-bot bot added the approved label Aug 30, 2023
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao requested a review from jackysp August 30, 2023 08:56
@YangKeao
Copy link
Member Author

@tiancaiamao will submit a new PR with more logs. Close this one.

@YangKeao YangKeao closed this Aug 30, 2023
bb7133

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants