I’m currently running a self-hosted gitlab 17.3.7 (was 17.3.3 at first) omnibus install on almalinux 9.4.
Right now I fail to raise version to anything higher that that, because some of the new db migrations fail during upgrade. So far I tried it from 17.3.3/.5/.7, it always happens.
The basic error is “duplicate Key”, that a new database key ist already existing(?).
Relevant excerpt of the error message might be:
[…]
Caused by:
PG::UniqueViolation: ERROR: could not create unique index “idx_sbom_components_on_name_purl_type_component_type_and_org_id”
DETAIL: Key (name, purl_type, component_type, organization_id)=(camelcase, 6, 0, 1) is duplicated.
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:122:in block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/timeout_helpers.rb:31:in
disable_statement_timeout’
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:121:in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20240730203748_replace_sbom_components_unique_index.rb:11:in
up’
[…]
This is the .rb file, what the migration is trying to do:
https://gitlab-org.gitlab.io/gitlab/coverage-ruby/#930731778137cf20ccf50cbeb9ad0a0affbf8cb7
Only documention regarding this I found so far, is a general hint that this might happen when upgrading from 17.3 (GitLab 17 changes | GitLab), but the documented issue there was regarding a different migration and database key and the solution presented won’t help in my specific case resp. migration and key.
Soo, why is this happening?
I haven’t found this specific migration to be problematic anywhere, so maybe what makes my installation unique in this?
And most importantly: how exactly can I fix this?
Is there a more general way to solve this (better than fiddling with specific keys)?