Skip to content

Backfill all project namespaces

Alexandru Croitor requested to merge 337100_backfill_project_namespaces into master

What does this MR do and why?

IMPORTANT: This MR is blocked by !79964 (merged) and !81805 (merged)

This is the migration to backfill project namespaces. This comes as the main migration after we have tested migrating successfully project namespaces for a single namespace: gitlab-org !73640 (merged)

The migration will create a record in namespaces table for each project and also update namespaces#traversal_ids field with corresponding list of ancestor ids.

As part of findings in previous MR !73640 (merged) we do cleanup pending gin index list for namespaces and projects tables. see mode detailed discussion at !73640 (comment 816190847)

SAFE INFO: https://gitlab.com/gitlab-org/gitlab/-/issues/354305

Instructions for SRE

Pause/Run migration

  • rals console
# Pause
Gitlab::Database::BackgroundMigration::BatchedMigration.find_by_job_class_name('ProjectNamespaces::BackfillProjectNamespaces').paused!

# Run
Gitlab::Database::BackgroundMigration::BatchedMigration.find_by_job_class_name('ProjectNamespaces::BackfillProjectNamespaces').active!
  • In admin UI find the migration ProjectNamespaces::BackfillProjectNamespaces and use the pause/run action button:

Screenshot_2022-03-02_at_22.51.18

To change max batch size

  • rals console
# Pause
Gitlab::Database::BackgroundMigration::BatchedMigration.find_by_job_class_name('ProjectNamespaces::BackfillProjectNamespaces').update(max_batch_size: 10_000)

Removal of backfilled project namespaces

In case it wouldn't be sufficient to just pause the migration but we would also have to delete backfilled namespaces, there is a draft MR for this prupose !82094 (closed)

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 Jan Provaznik

Merge request reports