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

*: fix 'Duplicate entry' error when @@auto_increment_increment and @@auto_increment_offset is set #52626

Merged
merged 4 commits into from
Apr 18, 2024

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Apr 15, 2024

What problem does this PR solve?

Issue Number: close #52622

Problem Summary:

What changed and how does it work?

  1. set auto_increment_offset to 1 if its value is greater than auto_increment_increment
  2. add more check to protect alloc.base from been change to a smaller value

Check List

Tests

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

Follow the steps in the issue

  • 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

Copy link

ti-chi-bot bot commented Apr 15, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked do-not-merge/needs-triage-completed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. 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.

@tiancaiamao tiancaiamao marked this pull request as ready for review April 16, 2024 02:27
@ti-chi-bot ti-chi-bot bot removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/needs-triage-completed labels Apr 16, 2024
pkg/meta/meta_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/needs-tests-checked labels Apr 16, 2024
@tiancaiamao
Copy link
Contributor Author

@tangenta please also keep an eye on this.
We have several get auto_increment_increment and auto_increment_offset operation all over the codebase.
At a simple glance, AUTO_RANDOM also use those session variable, I'm not sure the behaviour of them for AUTO_RANDOM etc, so I do not change them in this commit. Maybe you can take a look for the other places.

Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Merging #52626 (5f648b1) into master (3d82fc5) will increase coverage by 2.8187%.
Report is 19 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52626        +/-   ##
================================================
+ Coverage   72.3590%   75.1777%   +2.8187%     
================================================
  Files          1470       1474         +4     
  Lines        427105     428189      +1084     
================================================
+ Hits         309049     321903     +12854     
+ Misses        98798      86010     -12788     
- Partials      19258      20276      +1018     
Flag Coverage Δ
integration 50.4485% <94.7368%> (?)
unit 71.1754% <94.7368%> (-0.0751%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 61.1314% <ø> (+20.0481%) ⬆️

@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 Apr 17, 2024
@tiancaiamao
Copy link
Contributor Author

MySQL's document and implementation mismatch and it's a bug.
See https://bugs.mysql.com/bug.php?id=47118

We follow the MySQL document's.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 17, 2024
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 18, 2024
Copy link

ti-chi-bot bot commented Apr 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-17 14:00:28.634358678 +0000 UTC m=+433047.745405122: ☑️ agreed by Defined2014.
  • 2024-04-18 05:43:09.991472216 +0000 UTC m=+489609.102518663: ☑️ agreed by bb7133.

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Apr 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bb7133, Defined2014, GMHDBJD

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 18, 2024
@ti-chi-bot ti-chi-bot bot merged commit f5e591d into pingcap:master Apr 18, 2024
21 of 23 checks passed
@jackysp
Copy link
Member

jackysp commented Apr 28, 2024

Why not backport this PR to the LTS branches?

@jackysp jackysp added the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Apr 28, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 28, 2024
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: #52962.

@tiancaiamao tiancaiamao deleted the issue52622 branch April 29, 2024 01:49
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label May 7, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 7, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@tiancaiamao tiancaiamao added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels May 9, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot bot pushed a commit that referenced this pull request May 9, 2024
ti-chi-bot bot pushed a commit that referenced this pull request May 23, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Jun 4, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Nov 7, 2024
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. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.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.

Duplicate entry error with @@auto_increment_increment and @@auto_increment_offset when using AUTO_ID_CACHE=1
6 participants