This repository was archived by the owner on Jul 24, 2024. It is now read-only.
fix restore auto increment ID overflow#458
Open
3pointer wants to merge 13 commits intopingcap:masterfrom
Open
Conversation
kennytm
reviewed
Aug 14, 2020
pkg/restore/db.go
Outdated
| // auto inc id overflow | ||
| autoIncID := table.Info.AutoIncID | ||
| if table.Info.AutoIncID < 0 { | ||
| autoIncID = math.MaxInt64 |
Collaborator
There was a problem hiding this comment.
what about bigint unsigned columns?
create table a (id bigint unsigned primary key auto_increment);
insert into a values (12345678901234567890);
Collaborator
Author
There was a problem hiding this comment.
I was wondering that the allocator can work well 🤔️,it set the allocator with unsigned=false https://github.com/pingcap/br/blob/master/pkg/backup/client.go#L261
Collaborator
Author
There was a problem hiding this comment.
How about add globalAutoID -= 1 after https://github.com/pingcap/br/blob/master/pkg/backup/client.go#L277?
Collaborator
There was a problem hiding this comment.
I'm not sure what's the purpose of subtracting 1 😅
kennytm
reviewed
Aug 17, 2020
glorv
reviewed
Aug 21, 2020
Member
|
Any update? |
da989b0 to
d3e2067
Compare
Collaborator
Author
|
/run-integration-tests |
37ba16c to
36e8045
Compare
…into fix_restore_overflow
kennytm
reviewed
Apr 15, 2021
Comment on lines
+178
to
181
| autoIncID = uint64(table.Info.AutoIncID) | ||
| } else { | ||
| setValSQL = fmt.Sprintf(setValFormat, table.Info.Sequence.MaxValue) | ||
| autoIncID = uint64(table.Info.AutoIncID) | ||
| } |
Collaborator
There was a problem hiding this comment.
the two branches are the same? so this is simply
}
autoIncID = uint64(table.Info.AutoIncID)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
when auto_increment id reached max.Int64, it can backs up success. but failed when restore. we should handle this situation.
What is changed and how it works?
if autoIncID overflowed. change is to max.Int64, to keep consistency with backup cluster.
Check List
Tests
Code changes
Side effects
Related changes
Release Note