doc/update/background_migrations_troubleshooting.md
{{< details >}}
{{< /details >}}
<!-- Linked from `lib/gitlab/database/migrations/batched_background_migration_helpers.rb` -->When updating to GitLab version 14.2 or later, database migrations might fail with a message like:
StandardError: An error has occurred, all later migrations canceled:
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':
{:job_class_name=>"CopyColumnUsingBackgroundMigrationJob",
:table_name=>"push_event_payloads",
:column_name=>"event_id",
:job_arguments=>[["event_id"],
["event_id_convert_to_bigint"]]
}
To resolve this error:
To roll back and follow the required upgrade path:
The process for rolling forward depends on whether no downtime is required or not.
Running all batched background migrations can take a significant amount of time depending on the size of your GitLab installation.
Check the status of the batched background migrations in the database, and manually run them with the appropriate arguments until the status query returns no rows.
When the status of all of all them is marked as complete, re-run migrations for your installation.
Complete the database migrations from your GitLab upgrade:
sudo gitlab-rake db:migrate
Run a reconfigure:
sudo gitlab-ctl reconfigure
Finish the upgrade for your installation.
Because the failing migrations are post-deployment migrations, you can remain on a running instance of the upgraded version and wait for the batched background migrations to finish.
In GitLab 15.0, an advanced search migration named DeleteOrphanedCommit can be permanently stuck
in a pending state across upgrades. This issue
is corrected in GitLab 15.1.
If you are a GitLab Self-Managed customer who uses GitLab 15.0 with advanced search, you will experience performance degradation. To clean up the migration, upgrade to 15.1 or later.
For other advanced search migrations stuck in pending problems, retry the halted migrations.
If you upgrade GitLab before all pending advanced search migrations are completed, any pending migrations that have been removed in the new version cannot be executed or retried. In this case, you must re-create your index from scratch.
Elasticsearch version not compatibleTo resolve this problem, confirm that your version of Elasticsearch or OpenSearch is compatible with your version of GitLab.