Backfill project SD and CS analyzer statuses based on existing records
What does this MR do and why?
Backfill migration to create secret_detection_pipeline_based
and container_scanning_pipeline_base
records, based off of existing secret_detection
and container_scanning
records in the analyzer_project_statuses
table
This backfill is in support of a series of MRs (1,2) that add ProjectSecuritySetting
- related fields (secret_push_protection
and container_scanning_for_registry
) to the new project-level analyzer statuses. These statuses will be used for the Security Inventory feature.
References
Namespace level statuses for DB based settings (#548281 - closed) • rossfuhrman, Gal Katz • 18.2
Query plans
upsert_analyzer_statuses
Raw SQL
INSERT INTO analyzer_project_statuses (project_id, status, last_call, traversal_ids, build_id, archived, analyzer_type, created_at, updated_at)
VALUES (68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 12, NOW(), NOW()),
(68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 13, NOW(), NOW()),
(68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 13, NOW(), NOW()),
(68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 13, NOW(), NOW()),
(68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 13, NOW(), NOW()),
(68794259, 3, '2025-06-25 14:49:32.967187', ARRAY[9970, 96981785, 97058478, 98867842, 100569068]::bigint[], 11111, FALSE, 13, NOW(), NOW())
ON CONFLICT (project_id, analyzer_type)
DO NOTHING
RETURNING
id;
Query plan
Full details here
ModifyTable on public.analyzer_project_statuses (cost=0.00..0.09 rows=6 width=85) (actual time=3.221..3.282 rows=2 loops=1)
Buffers: shared hit=107 read=25 dirtied=7
WAL: records=15 fpi=6 bytes=30065
I/O Timings: read=2.742 write=0.000
-> Values Scan on "*VALUES*" (cost=0.00..0.09 rows=6 width=85) (actual time=1.258..1.277 rows=6 loops=1)
Buffers: shared hit=20 read=5 dirtied=2
WAL: records=3 fpi=1 bytes=8363
I/O Timings: read=1.105 write=0.000
Settings: jit = 'off', seq_page_cost = '4', work_mem = '100MB', effective_cache_size = '338688MB', random_page_cost = '1.5'
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.