Commit 7eee28b8 authored by Yannis Roussos's avatar Yannis Roussos

Merge branch 'mc/backstage/cleanup-artifact-expiry-migration-problem' into 'master'

Clean up artifact expiry migration problem

See merge request gitlab-org/gitlab!51821
parents c31fcc99 bb2668dc
---
title: Cancel artifact expiry backfill background jobs.
merge_request: 51821
author:
type: fixed
......@@ -24,12 +24,18 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
# Needs to be removed in a later migration
add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: INDEX_CONDITION, name: INDEX_NAME)
queue_background_migration_jobs_by_range_at_intervals(
JobArtifact.without_expiry_date.before_switch,
::Gitlab::BackgroundMigration::BackfillArtifactExpiryDate,
2.minutes,
batch_size: 200_000
)
# queue_background_migration_jobs_by_range_at_intervals(
# JobArtifact.without_expiry_date.before_switch,
# ::Gitlab::BackgroundMigration::BackfillArtifactExpiryDate,
# 2.minutes,
# batch_size: 200_000
# )
# The scheduling code was using the full class symbol
# (`::Gitlab::BackgroundMigration::BackfillArtifactExpiryDate`) instead of a
# string with the class name (`BackfillArtifactExpiryDate`) by mistake,
# which resulted in an error. It is commented out so it's a no-op to prevent
# errors and will be reintroduced with
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51822.
end
def down
......
# frozen_string_literal: true
class CancelArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
MIGRATION = 'BackfillArtifactExpiryDate'
disable_ddl_transaction!
def up
Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
job.delete
false
end
end
def down
# no-op
end
end
cb846ce5f6270cfdc543c3d4ad3e861b2a92445b952ee8f0a02f4171b9792411
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment