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 autoid decrease when leader change or close for AUTO_ID_CACHE=1 #52602

Merged
merged 5 commits into from Apr 15, 2024

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #52600

Problem Summary:

What changed and how does it work?

  1. reset map when a node become leader
  2. add lock to protect the map in forceRebase when close

Check List

Tests

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

See the steps in #52600
I'll file another PR to support http API, because it import new changes rather than simple bug fix.

  • No need to test
    • I checked and no code files have been changed.

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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 15, 2024
Copy link

tiprow bot commented Apr 15, 2024

Hi @tiancaiamao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Merging #52602 (b95f6e6) into master (7a85b01) will increase coverage by 2.6677%.
Report is 1 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52602        +/-   ##
================================================
+ Coverage   70.7612%   73.4289%   +2.6677%     
================================================
  Files          1470       1470                
  Lines        408762     435523     +26761     
================================================
+ Hits         289245     319800     +30555     
+ Misses       100213      95527      -4686     
- Partials      19304      20196       +892     
Flag Coverage Δ
integration 21.9266% <ø> (?)

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

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 49.6114% <ø> (+6.9715%) ⬆️

pkg/autoid_service/autoid.go Outdated Show resolved Hide resolved
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp
Copy link
Member

jackysp commented Apr 15, 2024

PTAL @Defined2014

Copy link

ti-chi-bot bot commented Apr 15, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-15 11:24:09.357176117 +0000 UTC m=+250868.468222565: ☑️ agreed by jackysp.
  • 2024-04-15 11:38:08.333435771 +0000 UTC m=+251707.444482388: ☑️ agreed by Defined2014.

@ti-chi-bot ti-chi-bot bot removed the approved label Apr 15, 2024
@tiancaiamao
Copy link
Contributor Author

/approve

Copy link

ti-chi-bot bot commented Apr 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, jackysp, 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 approved label Apr 15, 2024
@ti-chi-bot ti-chi-bot bot merged commit bb84d1f into pingcap:master Apr 15, 2024
21 checks passed
@tiancaiamao tiancaiamao deleted the issue52600 branch April 15, 2024 13:24
3AceShowHand pushed a commit to 3AceShowHand/tidb that referenced this pull request Apr 16, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot bot pushed a commit that referenced this pull request Apr 17, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

when leader switch, autoid service does not reset the map
5 participants