sameersbn / sameersbn/docker-gitlab

[Fixed] Upgrade from 14.3.0 to 14.10.0 fails with background migration error

Open
#2,546 11 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

This is an FYI issue just in case someone has the same problem. It's similar to #2409 but with an upgrade from 14.3.0 to 14.10.0.

The error message was:

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':#011{:job_class_name=>"ProjectNamespaces::BackfillProjectNamespaces", :table_name=>:projects, :col
umn_name=>:id, :job_arguments=>[nil, "up"]}

Finalize it manualy by running

#011sudo gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null,"up"]']

For more information, check the documentation

#011https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished

To apply the suggested fix (using docker-compose where I have a gitlab container):

  • Stop the container
  • Run docker-compose run --rm gitlab app:rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']

That fixed it for me. The command may be a little different but can be copied from the error message.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is identified. Start with the 14.3.0-to-14.10.0 upgrade path and the linked background-migration documentation, then inspect how docker-compose invokes the GitLab rake task. Done would require a reproducible upgrade fix or documented handling that avoids the manual finalize command.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, shell
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.