-
Notifications
You must be signed in to change notification settings - Fork 296
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
Fixes #36850 - Avoid duplicate database indexes #10805
Conversation
Some downstream users have already created the indexes manually to relieve the issue. When upgrading Katello, the migration script will create duplicate indexes to the table with different index names or the migration will fail with PG duplicate index error due to index name conflict with the one migration script creates. Thus, modify this migration script to check for existing indexes in the table and then drop them before creating the new indexes.
@jeremylenz As discussed, I submitted the changes I proposed in PR 10773 |
This is not necessary.
Replace the Migration ID with yours. |
@lfu we don't want to do a manual job here. Besides, if we rollback the migration as you suggested it will remove the indexes including the one created manually. |
Could you try something like:
|
@lfu Hmm...because of my mistake the indexes that we manually created have different name as what rails will be created so I am thinking to drop them and let rails re-create them. Thus, the index names will be consistent. If you think that is ok, I am fine to implement your suggestion above. |
@hao-yu Can you tell us how you have created the index manually for customers? |
|
how is this review going? |
In my opinion, the best way to solve the issue here is to have the users manually remove the index that was manually added in the first place if any issue comes up due to that change. To find duplicate indexes
Then |
I am not sure how user friendly we are asking users to remove duplicate indexes manually. Unfortunately, the proposed PR is sitting here for 4 months without proper or motivation to progress It is no point and too late to fix this any more because #10773 has been released in downstream Satellite 6.14. For affected users who already upgraded to 6.14 will have duplicate indexes. |
Some downstream users have already created the indexes manually to relieve the issue. When upgrading Katello, the migration script will create duplicate indexes to the table with different index names or the migration will fail with PG duplicate index error due to index name conflict with the one migration script creates.
Thus, modify this migration script to check for existing indexes in the table and then drop them before creating the new indexes.