Skip to content

Backfilling missing ci_cd_settings for projects

Jerry Seto requested to merge 393502-backfill-missing-ci-cd-settings into master

What does this MR do and why?

Backfilling missing ci_cd_settings for projects

Add a batched background migration for creating ci cd settings for projects that do not have them

Contributes to: #393502 (closed)

Example query plans

SELECT "projects"."id" 
FROM "projects" 
WHERE "projects"."id" BETWEEN 1 AND 1500 
ORDER BY "projects"."id" ASC 
LIMIT 1

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/20011/commands/65297

SELECT "projects"."id" 
FROM "projects" 
WHERE "projects"."id" BETWEEN 1 AND 1500 
AND "projects"."id" >= 1 
ORDER BY "projects"."id" ASC 
LIMIT 1 OFFSET 1000

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/20011/commands/65298

SELECT "projects"."id" 
FROM "projects" 
WHERE "projects"."id" BETWEEN 1 AND 1500 
AND "projects"."id" >= 1 AND (
	NOT EXISTS (
	  SELECT 1	  
	  FROM project_ci_cd_settings	  
	  WHERE project_ci_cd_settings.project_id = projects.id
	)
)

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/20011/commands/65299

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #393502 (closed)

Edited by Jerry Seto

Merge request reports