Fix statement timeouts on p_ci_job_artifacts in Ci::DestroyPipelineService
While we addressed query timeouts on p_ci_pipelines in #572278 (closed), we still have query timeouts occurring on p_ci_job_artifacts table. These timeouts happen during pipeline deletion, specifically in the model callbacks when destroying pipelines and then job artifacts.
SELECT "p_ci_job_artifacts".* FROM "p_ci_job_artifacts"
INNER JOIN "p_ci_builds" ON "p_ci_job_artifacts"."job_id" = "p_ci_builds"."id"
WHERE "p_ci_builds"."type" = $1
AND "p_ci_builds"."commit_id" = $2
AND "p_ci_builds"."partition_id" = $3
AND "p_ci_job_artifacts"."partition_id" = $4
AND "p_ci_job_artifacts"."id" >= $5
AND "p_ci_job_artifacts"."id" < $6
Link to logs: https://log.gprd.gitlab.net/app/r/s/nf9E3
Related Issues and Context
- Parent issue: #572278 (closed)
- Related RFHs: gitlab-com/request-for-help#3419, gitlab-com/request-for-help#3022
- Discussions: #572278 (closed) (comment 2929210816), #572278 (closed) (comment 2929322165)
Proposal (tbd)
Edited by 🤖 GitLab Bot 🤖