Skip to content

Add spec for optimized Advanced Search migration order

What does this MR do and why?

Inspired by !114187 (merged) And docs page: https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#best-practices-for-advanced-search-migrations

This MR

  • adds a spec to guard against Advanced Search migrations introduced in an inefficient order. The spec checks all migrations that use the two migration helpers for updates and backfills.
  • fixes an inefficient migration ordering for issues index

What can make the order inefficient?

Advanced Search migrations run each un-applied migration in order in the ee/elastic/migrate/ folder. Migration files are named using a specific format: YYYYMMDDHHMMSS_<migration_description>.rb.

If multiple mappings are unapplied, it is more efficient to complete all mapping migrations prior to any backfill migrations. That will avoid backfilling the same data twice.

Screenshots or screen recordings

Migration Order

Before After
AddLabelIdsAndSchemaVersionToIssuesMapping AddLabelIdsAndSchemaVersionToIssuesMapping
BackfillLabelIdsForIssues AddHiddenToIssues
AddHiddenToIssues BackfillLabelIdsForIssues
BackfillHiddenOnIssues BackfillHiddenOnIssues

How to set up and validate locally

N/A

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 Terri Chu

Merge request reports