Skip to content
Snippets Groups Projects

Add temporary partial index to speed up the migration

Merged username-removed-423915 requested to merge update-retried-migration into master
1 unresolved thread

What are the relevant issue numbers?

Closes #32469 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @timothyandrew Not including this in 9.2.0 means that any instance with a lot of CI builds can take a very long time to migrate. On GitLab.com for example it took around 1,5 hours of which most was done without the index (we created it by the time progress was around 80%).

  • added 1 commit

    • 1aa67247 - Add temporary partial index to speed up the migration

    Compare with previous version

  • username-removed-423915 resolved all discussions

    resolved all discussions

  • added 1 commit

    • 1aa67247 - Add temporary partial index to speed up the migration

    Compare with previous version

  • yorickpeterse-staging approved this merge request

    approved this merge request

  • @yorickpeterse: Good enough for me! I'd still like to get the other two sign-offs before this is picked (after it's merged first, of course!).

    /cc @selfup

  • @godfat Thanks, looks good to me! :heart:

    @timothyandrew Ok for me.

  • mentioned in commit 27eab8a4

  • @rymai Thanks!

    @timothyandrew @selfup Stan signed it too https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11534#note_30103035 Let's pick this if possible. If we can't make it, I think that's fine, we could do it in 9.2.1.

  • This will go into the next patch release :smile:

  • mentioned in merge request !11619 (closed)

  • DJ Mountney
    DJ Mountney @twk3 started a thread on the diff
  • 19 # This is slow update as it does single-row query
    20 # This is designed to be run as idle, or a post deployment migration
    21 is_retried = Arel.sql("((#{latest_id}) != ci_builds.id)")
    22
    23 update_column_in_batches(:ci_builds, :retried, is_retried) do |table, query|
    24 query.where(table[:retried].eq(nil))
    25 end
    24 26 end
    25 27 end
    26 28
    27 29 def down
    28 30 end
    31
    32 def with_temporary_partial_index
    33 if Gitlab::Database.postgresql?
    34 execute 'CREATE INDEX CONCURRENTLY IF NOT EXISTS index_for_ci_builds_retried_migration ON ci_builds (id) WHERE retried IS NULL;'
  • @godfat This MR doesn't apply cleanly onto 9-2-stable. Could you please fix the conflicts in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11619?

  • Please register or sign in to reply
    Loading