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

Copying AUTO_INCREMENT value to ghost table #12

Merged
merged 30 commits into from
Jan 5, 2021

Conversation

shlomi-noach
Copy link

@shlomi-noach shlomi-noach commented Dec 31, 2020

Initial commit: towards setting up a test suite

Solves github#381

Description

This PR ensures to copy AUTO_INCREMENT value to gh-ost table. The problem in github#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.

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

Shlomi Noach and others added 28 commits September 16, 2018 11:44
use sync.Once to avoid to send drop cutover sentry table to mysql twice (merge PR)
Support Azure Database for MySQL (merge PR)
Use golang:1.15.x, remove jessie tarball build
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]>
@shlomi-noach
Copy link
Author

This PR now:

  • 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.

@shlomi-noach shlomi-noach changed the title WIP: copying AUTO_INCREMENT value to ghost table Copying AUTO_INCREMENT value to ghost table Dec 31, 2020
@shlomi-noach shlomi-noach mentioned this pull request Jan 5, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants