Gitlab-ce db migration failed upgrading from 15.5.2 to 15.6.0

What's this issue all about? (Background and context)

Gitlab-ce db migration failed upgrading from 15.5.2 to 15.6.0

What hypotheses and/or assumptions do you have?

Six indexes in total were missing in the embedded PSql database. I found them, one at a time, from the final output of

gitlab-ctl reconfigure
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
main: == 20221019195754 DisableFastupdateOnIssuesDescriptionGinIndex: migrating =====
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER INDEX index_issues_on_description_trigram SET ( fastupdate = false ) ;\n")
main:    -> 0.0015s
main: == 20221019195754 DisableFastupdateOnIssuesDescriptionGinIndex: migrated (0.0126s) 

main: == 20221019200033 DisableFastupdateOnMergeRequestsTitleGinIndex: migrating ====
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER INDEX index_merge_requests_on_title_trigram SET ( fastupdate = false ) ;\n")
STDERR: 
---- End output of "bash"  ----
Ran "bash"  returned 1

My solution

I found the following statements, in /opt/gitlab/embedded/service/gitlab-rails/db/structure.sql and ran them in gitlab-psql

CREATE INDEX index_issues_on_description_trigram_non_latin ON issues USING gin (description gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)));
CREATE INDEX index_issues_on_title_trigram ON issues USING gin (title gin_trgm_ops) WITH (fastupdate='false');
CREATE INDEX index_issues_on_title_trigram_non_latin ON issues USING gin (title gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)));
CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops) WITH (fastupdate='false');
CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops) WITH (fastupdate='false');

What questions are you trying to answer?

My solution worked, but will it cause trouble in future updates?

Implementation path

  • Create an MR to update the index only if it exists and then pick the commit into the next 15.6 patch
Edited by Gabe Weaver