おのたく日記 YouTubeも始めました→
2021-11-02(Tue) GitLab 14.4へのupgradeでエラー [長年日記]
■ GitLab 14.3から一ヶ月経って、14.4が出たのでupgradeしようとしたら14.3のときと同じくデータベースマイグレーションでエラー
gitlab-ce_1 | Recipe: gitlab::database_migrations
gitlab-ce_1 | * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
gitlab-ce_1 | * rails_migration[gitlab-rails] action run
gitlab-ce_1 | * bash[migrate gitlab-rails database] action run
gitlab-ce_1 | [execute] rake aborted!
gitlab-ce_1 | StandardError: An error has occurred, all later migrations canceled:
gitlab-ce_1 |
gitlab-ce_1 | PG::InvalidObjectDefinition: ERROR: functions in index predicate must be marked IMMUTABLE
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:155:in `block in add_concurrent_index'
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:359:in `disable_statement_timeout'
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:154:in `add_concurrent_index'
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb:9:in `up'
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/lock_retry_mixin.rb:31:in `ddl_transaction'
gitlab-ce_1 | /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in
' gitlab-ce_1 | /opt/gitlab/embedded/bin/bundle:23:in `load'
gitlab-ce_1 | /opt/gitlab/embedded/bin/bundle:23:in `
'
10月3日の日記での14.3での直し方が良くなかったのかと焦ったけど、違うエラー。
14.4が出た直後には無かったけど、14.4.1でもうまくいかないので、今日調べたら
CREATE INDEX CONCURRENTLY index_issue_metrics_first_mentioned_in_commit ON issue_metrics
USING btree (issue_id)
WHERE EXTRACT(YEAR FROM first_mentioned_in_commit_at at time zone 'UTC') > 2019;
言うのを見つけて、14.3で、gitlab-psqlを立ち上げて、このSQLで、index_issue_metrics_first_mentioned_in_commitを作ったら無事にGitLab 14.4.1が立ち上がった。
よかった。
|