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

meta/autoid : fix the issue that MaxUint64 and MaxInt64 autoID is incorrectly allocated #12119

Merged
merged 17 commits into from
Sep 11, 2019

Conversation

AilinKid
Copy link
Contributor

What problem does this PR solve?

mysql 5.7 & mysql 8.0

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);

ERROR 1467 (HY000): Failed to read auto-increment value from storage engine

tidb master

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);

Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

What is changed and how it works?

Check the allocated value whether is the MaxUint64 or MaxInt64 before alloc.

Check List

Tests

  • mysql-test In CI
  • correlated mysql_tset PR #889

Related changes

  • Need to cherry-pick to the release branch

Release note

  • fix the MaxUint64 and MaxInt64 autoID should not allocated.

@bb7133 bb7133 changed the title autoid : fix the MaxUint64 and MaxInt64 autoID should not allocated. autoid : fix the issue that MaxUint64 and MaxInt64 autoID is incorrectly allocated Sep 10, 2019
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.

Please add some test cases

@AilinKid AilinKid force-pushed the fix_autoID_MaxNotAlloc branch from 126fd5c to 7c2fc21 Compare September 10, 2019 08:58
@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

Merging #12119 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12119   +/-   ##
===========================================
  Coverage   81.2957%   81.2957%           
===========================================
  Files           453        453           
  Lines         97208      97208           
===========================================
  Hits          79026      79026           
  Misses        12513      12513           
  Partials       5669       5669

@AilinKid AilinKid force-pushed the fix_autoID_MaxNotAlloc branch from 82e2c73 to 4af1f42 Compare September 10, 2019 09:37
@AilinKid
Copy link
Contributor Author

Please add some test cases

Done.

@AilinKid
Copy link
Contributor Author

/run-all-tests

@AilinKid AilinKid force-pushed the fix_autoID_MaxNotAlloc branch from 29dd5b3 to 268db18 Compare September 11, 2019 02:20
@AilinKid AilinKid force-pushed the fix_autoID_MaxNotAlloc branch from bf1910a to eb9ac98 Compare September 11, 2019 02:34
@AilinKid
Copy link
Contributor Author

Attention: this PR need mysql-test #889 merged first

Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@tangenta tangenta added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 11, 2019
meta/autoid/autoid_test.go Outdated Show resolved Hide resolved
meta/autoid/autoid_test.go Outdated Show resolved Hide resolved
@AilinKid AilinKid force-pushed the fix_autoID_MaxNotAlloc branch from 90c3cf4 to 76c9eb6 Compare September 11, 2019 10:50
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

@bb7133 bb7133 changed the title autoid : fix the issue that MaxUint64 and MaxInt64 autoID is incorrectly allocated meta/autoid : fix the issue that MaxUint64 and MaxInt64 autoID is incorrectly allocated Sep 11, 2019
@bb7133 bb7133 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 11, 2019
@bb7133
Copy link
Member

bb7133 commented Sep 11, 2019

/run-unit-test

@bb7133
Copy link
Member

bb7133 commented Sep 11, 2019

/run-all-tests

@bb7133 bb7133 added the status/can-merge Indicates a PR has been approved by a committer. label Sep 11, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 11, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Sep 11, 2019

@AilinKid merge failed.

@AilinKid
Copy link
Contributor Author

/run-common-test tidb-test=pr/889

@AilinKid
Copy link
Contributor Author

/run-integration-common-test tidb-test=pr/889

@AilinKid
Copy link
Contributor Author

/run-all-tests tidb-test=pr/889

@AilinKid
Copy link
Contributor Author

/run-all-tests tidb-test=pr/889

1 similar comment
@AilinKid
Copy link
Contributor Author

/run-all-tests tidb-test=pr/889

@bb7133
Copy link
Member

bb7133 commented Sep 11, 2019

/rebuild

@AilinKid AilinKid merged commit c2901fe into pingcap:master Sep 11, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 11, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Sep 11, 2019

cherry pick to release-3.0 in PR #12162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants