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 DB indices for phys_locations and topology #6081

Merged
merged 2 commits into from
Aug 4, 2021
Merged

Fix DB indices for phys_locations and topology #6081

merged 2 commits into from
Aug 4, 2021

Conversation

shamrickus
Copy link
Member

What does this PR (Pull Request) do?

Which Traffic Control components are affected by this PR?

  • Traffic Ops

What is the best way to verify this PR?

Run the db/admin tool with migrations. Verify the indices are correct. Verify the rollback works correctly.

If this is a bug fix, what versions of Traffic Control are affected?

  • master
  • 5.1.2

The following criteria are ALL met by this PR

  • This PR includes tests OR I have explained why tests are unnecessary
  • This PR includes documentation OR I have explained why documentation is unnecessary
  • This PR includes an update to CHANGELOG.md OR such an update is not necessary
  • This PR includes any and all required license headers
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Copy link
Member

@zrhoffman zrhoffman left a comment

Choose a reason for hiding this comment

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

,> IF EXISTS/IF NOT EXISTS

I don't think migrations should succeed error-free if the pre-migration state is not what is expected. The migration version we keep track of should indicate whether these indices already exist and what their names are.

Because the migration version is increased on success, the migration won't rerun anyway, so we shouldn't need the IF EXISTS. If the migration does not do anything, or if it fails, that is potentially useful information that we don't want to hide.

Copy link
Member

@zrhoffman zrhoffman left a comment

Choose a reason for hiding this comment

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

  • Verified that indices are fixed after applying 2021080408053529_fix_indices.up.sql
  • Verified that a DB dump after applying 2021080408053529_fix_indices.up.sql and 2021080408053529_fix_indices.down.sql is identical to a DB dump after running all migrations on the Apache master branch

@zrhoffman zrhoffman merged commit 3760360 into apache:master Aug 4, 2021
@shamrickus shamrickus deleted the db/fix-issues branch August 4, 2021 20:16
@zrhoffman zrhoffman added database relating to setup/installation/structure of the Traffic Ops database improvement The functionality exists but it could be improved in some way. Traffic Ops related to Traffic Ops labels Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database relating to setup/installation/structure of the Traffic Ops database improvement The functionality exists but it could be improved in some way. Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TODB: Incorrect or missing indexes
2 participants