Skip to content

Fix BackfillUserDetailsFields migration finalization

Stan Hu requested to merge sh-fix-issue-393216 into master

What does this MR do and why?

In GitLab 15.9 via !109019 (merged), columns such as users.linkedin were dropped in favor of user_details.linkedin, which was added in GitLab 15.5 via !95107 (merged).

GitLab 15.6 added a batched background migration to migrate the values from the users table to the user_details table.

However, GitLab 15.9 incorrectly finalized the migration as a regular background migration rather than a batched background migration. As a result, the batched_background_migrations.status field for the BackfillUserDetailsFields was erroneously marked as active rather than finished. This caused the cronjob to run the background migration, which would fail since the users columns had already been dropped.

This commit adds a new DML migration that precedes 20221102231131 (Remove temp index for user details fields) and 20230116160904 (Remove user details fields from users). This migration properly finalizes the batched migration so that the migration is marked as finished.

This fixes installations that have not yet upgraded to 15.9, but it doesn't help with installations that are already on 15.9. It's possible for users that skipped GitLab 15.6, there is minor data loss for the newly-added user_details columns since the batched background migration jobs may not have run.

The columns in question:

  • linkedin
  • twitter
  • skype
  • website_url
  • location
  • organization

Relates to:

  1. omnibus-gitlab#7474 (closed)
  2. #393216 (closed)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports