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

Copy auto increment #911

Closed
wants to merge 17 commits into from
Closed

Conversation

shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Jan 5, 2021

Solves #381

Description

This PR ensures to copy AUTO_INCREMENT value to gh-ost table. The problem in #381 is that if rows are deleted from end of table, then the new table is created (or ends up) with a lower auto_increment value. I think most migrations do not encounter this issue because new rows are commonly added to the table while it's being migrated, naturally bumping up the ghost table's AUTO_INCREMENT value to match the original table's. But for static tables this can happen.

  • parses user's -alter statement to see if the user has specified any explicit AUTO_INCREMENT

  • reads original table's AUTO_INCREMENT value (if exists)

  • if AUTO_INCREMENT exists, and user has not overriden, apply original table's AUTO_INCREMENT value onto the ghost table.

  • tests added to verify behavior.

  • contributed code is using same conventions as original code

  • script/cibuild returns with no formatting errors, build errors or unit test errors.

Resubmission of openark#12

Support a complete ALTER TABLE statement in --alter
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <[email protected]>
…original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
@timvaillancourt
Copy link
Collaborator

Merged in #967 👍

@shlomi-noach
Copy link
Contributor Author

Woohoo!

@shlomi-noach shlomi-noach deleted the copy-auto-increment branch May 25, 2021 06:19
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.

2 participants