おのたく日記 YouTubeも始めました→
2022-11-25(Fri) GitLab 15.6にupgrade中にマイグレーション失敗 [長年日記]
■ いつものようにomnibus Dockerイメージ版のGitLabを15.5から15.6にupgradeしようとしたらエラーが発生
Recipe: gitlab::database_migrations
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
* rails_migration[gitlab-rails] action run
* bash_hide_env[migrate gitlab-rails database] action run
[execute] rake aborted!
StandardError: An error has occurred, all later migrations canceled:
PG::UndefinedTable: ERROR: relation "index_issues_on_title_trigram" does not exist
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb:10:in `block in up'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/with_lock_retries.rb:123:in `run_block'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/with_lock_retries.rb:134:in `block in run_block_with_lock_timeout'
...
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
main: == 20221019194751 DisableFastupdateOnIssuesTitleGinIndex: migrating ===========
main: -- transaction_open?()
main: -> 0.0001s
main: -- execute("ALTER INDEX index_issues_on_title_trigram SET ( fastupdate = false ) ;\n")
================================================================================
Error executing action `run` on resource 'bash_hide_env[migrate gitlab-rails database]'
================================================================================
また、2021年11月2日の日記「GitLab 14.4へのupgradeでエラー」みたいなことが発生しているのだろうとして検索してみると。
すでにIssueが立っていた#383540 Upgrade to 15.6.0 fails: relation "index_issues_on_title_trigram" does not exis
とりあえずのワークアラウンドは#378343 (comment 1182560762)なので、
$ docker compose up -d
$ docker compose exec gitlab-ce bash
root@gitlab-ce:/# gitlab-psql
psql (12.12)
Type "help" for help.
gitlabhq_production=# CREATE INDEX index_issues_on_description_trigram ON issues USING gin (description gin_trgm_ops);
CREATE INDEX
gitlabhq_production=# CREATE INDEX index_issues_on_title_trigram ON issues USING gin (title gin_trgm_ops);
CREATE INDEX
gitlabhq_production=# CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops);
CREATE INDEX
gitlabhq_production=# CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops);
CREATE INDEX
gitlabhq_production=# quit
root@gitlab-ce:/# exit
と手早く打って、問題のマイグレーションの前に終わらせると、無事にGitLab 15.6が起動できた。
|