Skip to content
代码片段 群组 项目
提交 c29adfe7 编辑于 作者: drew cimino's avatar drew cimino 提交者: Adam Hegyi
浏览文件

Schedule async index build for ci_job_artifacts

Our purpose-built index for removal of expired records from
ci_job_artifacts does not exclude artifacts where expire_at is null.
This means job traces, which get unlocked but have no expiration, are
polluting an index that would otherwise be a clean ready-for-removal
queue and much smaller.

Changelog: performance
上级 4d048f64
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
class PrepareIndexForCiJobArtifactsUnlockedWithExpireAt < Gitlab::Database::Migration[1.0]
TABLE_NAME = 'ci_job_artifacts'
INDEX_NAME = 'index_ci_job_artifacts_on_expire_at_for_removal'
CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL'
def up
prepare_async_index TABLE_NAME, [:expire_at], where: CONDITIONS, name: INDEX_NAME
end
def down
unprepare_async_index_by_name TABLE_NAME, INDEX_NAME
end
end
fd738cf8a5642f96dc67a294dcf913d797b580a19f35d5ef76573c63bf2dd920
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册