Duplicate and extra indexes while upgrading from older versions of GitLab
We have had reports of users with older installations of GitLab that the upgrade process failed. The cause for this were duplicate indexes that were not present in the codebase anymore but were still present in the installation. This led to failures when a migration was attempting to e.g. delete the index and Rails realized that the step was ambiguous due to the fact there were multiple indexes matching the index definition.
Examples of user reports are:
This is the canonical issue to track the problem.
A workaround solution is available where the offending indexes (the one that isn't tracked in the codebase anymore) is simply dropped from the system.
We've had fixes out for the individual issues above, to explicitly check if these unknown indexes are present and drop them before running the actual migration. If we see this happen more often, it's likely a bigger problem we should find a more general solution to.
It is currently unknown when and where we introduced those indexes and why those are leftovers and not being tracked anymore in the codebase. We have a few pointers of why this might have happened though, see !19362 (comment 238056010).