Remove invalid remote mirror records without "project_id"
What does this MR do and why?
Contributes to #444643 (closed)
Problem
remote_mirrors
is missing a NOT NULL constraint for project_id
field.
However, this field must be always populated.
Solution
As a first step, we should remove any remote_mirrors
records that missing a project_id
. We don't have them on GitLab.com and they
We don't have them on GitLab.com, see below:
select * from remote_mirrors where project_id is NULL;
Index Scan using index_remote_mirrors_on_project_id on public.remote_mirrors (cost=0.42..3.01 rows=1 width=675) (actual time=2.152..2.153 rows=0 loops=1)
Index Cond: (remote_mirrors.project_id IS NULL)
Buffers: shared read=3
I/O Timings: read=2.120 write=0.000
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/26845/commands/83643
They also should be missing on self-hosted instances. But as a precaution, we can remove them if they exist there.
In next release, we will add a missing constraint for project_id
(see Add NOT NULL constraint for `remote_mirrors.pro... (!153959 - merged))
Edited by Vasilii Iakliushin