Delete any note from the index if noteable is nil
Prior to this we were specifically targetting missing commits because this was a case we [observed in staging](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55878) but we also may have more cases we haven't run into yet for other noteable types. The `noteable_id` column on the table does not have a `NOT NULL` constraint nor does it have foreign key references so it's totally conceivable there are other kinds of orphaned notes (eg. issues that were hard deleted at some point) that we don't know about. I have concerns that any one of these situations could again lead to the migration to update permissions getting stuck forever. As such I think the best course of action is to delete any of these. I also can't think of any good reason to keep the orphaned notes in the index so this seems quite safe.
Showing
Please register or sign in to comment