Remove faulty async index definitions
What does this MR do and why?
Similar to !167102 (merged)
This MR removes an async index which is trying to be created on a partition that no longer exists.
Click to expand
gitlabhq_dblab=# select * from postgres_async_indexes;
┌─[ RECORD 1 ]────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ id │ 1000742 │
│ created_at │ 2024-10-24 09:04:21.554525+00 │
│ updated_at │ 2024-11-09 01:12:52.75244+00 │
│ name │ index_ee8a554af9 │
│ definition │ CREATE INDEX CONCURRENTLY "index_ee8a554af9" ON "gitlab_partitions_dynamic"."security_findings_126" ("project_id") │
│ table_name │ gitlab_partitions_dynamic.security_findings_126 │
│ attempts │ 60 │
│ last_error │ PG::UndefinedTable: ERROR: relation "gitlab_partitions_dynamic.security_findings_126" does not exist ↵│
gitlabhq_dblab=# \d+ security_findings
Partitioned table "public.security_findings"
┌─────────────────────┬──────────┬───────────┬──────────┬───────────────────────────────────────────────┬──────────┬─────────────┬──────────────┬─────────────┐
│ Column │ Type │ Collation │ Nullable │ Default │ Storage │ Compression │ Stats target │ Description │
├─────────────────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────────┼──────────┼─────────────┼──────────────┼─────────────┤
│ id │ bigint │ │ not null │ nextval('security_findings_id_seq'::regclass) │ plain │ │ │ │
│ scan_id │ bigint │ │ not null │ │ plain │ │ │ │
│ scanner_id │ bigint │ │ not null │ │ plain │ │ │ │
│ severity │ smallint │ │ not null │ │ plain │ │ │ │
│ confidence │ smallint │ │ │ │ plain │ │ │ │
│ project_fingerprint │ text │ │ │ │ extended │ │ │ │
│ deduplicated │ boolean │ │ not null │ false │ plain │ │ │ │
│ uuid │ uuid │ │ │ │ plain │ │ │ │
│ overridden_uuid │ uuid │ │ │ │ plain │ │ │ │
│ partition_number │ integer │ │ not null │ 146 │ plain │ │ │ │
│ finding_data │ jsonb │ │ not null │ '{}'::jsonb │ extended │ │ │ │
│ project_id │ bigint │ │ │ │ plain │ │ │ │
└─────────────────────┴──────────┴───────────┴──────────┴───────────────────────────────────────────────┴──────────┴─────────────┴──────────────┴─────────────┘
Partition key: LIST (partition_number)
Indexes:
"security_findings_pkey" PRIMARY KEY, btree (id, partition_number)
"security_findings_project_fingerprint_idx" btree (project_fingerprint)
"security_findings_scan_id_deduplicated_idx" btree (scan_id, deduplicated)
"security_findings_scan_id_id_idx" btree (scan_id, id)
"security_findings_scanner_id_idx" btree (scanner_id)
"security_findings_severity_idx" btree (severity)
"security_findings_uuid_scan_id_partition_number_idx" UNIQUE, btree (uuid, scan_id, partition_number)
Check constraints:
"check_6c2851a8c9" CHECK (uuid IS NOT NULL)
"check_b9508c6df8" CHECK (char_length(project_fingerprint) <= 40)
Foreign-key constraints:
"fk_rails_729b763a54" FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE
"fk_rails_bb63863cf1" FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE
Triggers:
trigger_468b8554e533 BEFORE INSERT OR UPDATE ON security_findings FOR EACH ROW EXECUTE FUNCTION trigger_468b8554e533()
Partitions: gitlab_partitions_dynamic.security_findings_130 FOR VALUES IN (130),
gitlab_partitions_dynamic.security_findings_131 FOR VALUES IN (131),
gitlab_partitions_dynamic.security_findings_132 FOR VALUES IN (132),
gitlab_partitions_dynamic.security_findings_133 FOR VALUES IN (133),
gitlab_partitions_dynamic.security_findings_134 FOR VALUES IN (134),
gitlab_partitions_dynamic.security_findings_135 FOR VALUES IN (135),
gitlab_partitions_dynamic.security_findings_136 FOR VALUES IN (136),
gitlab_partitions_dynamic.security_findings_137 FOR VALUES IN (137),
gitlab_partitions_dynamic.security_findings_138 FOR VALUES IN (138),
gitlab_partitions_dynamic.security_findings_139 FOR VALUES IN (139),
gitlab_partitions_dynamic.security_findings_140 FOR VALUES IN (140),
gitlab_partitions_dynamic.security_findings_141 FOR VALUES IN (141),
gitlab_partitions_dynamic.security_findings_142 FOR VALUES IN (142),
gitlab_partitions_dynamic.security_findings_143 FOR VALUES IN (143),
gitlab_partitions_dynamic.security_findings_144 FOR VALUES IN (144),
gitlab_partitions_dynamic.security_findings_145 FOR VALUES IN (145),
gitlab_partitions_dynamic.security_findings_146 FOR VALUES IN (146)