diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-09-13 23:08:51 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-09-25 11:41:35 -0300 |
commit | 18223f0522dbf3a1697f777533bd5e14dfb62e89 (patch) | |
tree | dbf67d67de136120fe195ac86a63752391e2adac /db | |
parent | cb0f024cd4c4aa51c7824e4e1a6c4d0f307afad1 (diff) | |
download | gitlab-ce-18223f0522dbf3a1697f777533bd5e14dfb62e89.tar.gz |
Add clean-up phase for ScheduleDiffFilesDeletion
Process any remaining ScheduleDiffFilesDeletion workers and remove
temporary added index.
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb new file mode 100644 index 00000000000..ed9422a3894 --- /dev/null +++ b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ConsumeRemainingDiffFilesDeletionJobs < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + MIGRATION = 'ScheduleDiffFilesDeletion'.freeze + TMP_INDEX = 'tmp_partial_diff_id_with_files_index'.freeze + + def up + # Perform any ongoing background migration that might still be scheduled. + Gitlab::BackgroundMigration.steal(MIGRATION) + + remove_concurrent_index_by_name(:merge_request_diffs, TMP_INDEX) + end + + def down + add_concurrent_index(:merge_request_diffs, :id, where: "(state NOT IN ('without_files', 'empty'))", name: TMP_INDEX) + end +end |