Skip to content

Fix updating events for WikiPage::Meta conflicts

What does this MR do and why?

Follow up to !180695 (merged).

Fixes https://new-sentry.gitlab.net/organizations/gitlab/issues/1349759/?project=3

When deciding to move activity events from the duplicate WikiPage::Meta record to the other one by simply updating the target_id, we failed to account for a unique index on (target_type, target_id, fingerprint) for the events table.

The fingerprint (which is a wiki page SHA) is the same in a scenario when a new wiki page is created and two duplicate events are created, one for each Meta. They share the same fingerprint, and we violate a unique index when we try to both have the same target_id.

Instead of updating the records, we opted to let them be destroyed along with the duplicate Meta record.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Piotr Skorupa

Merge request reports

Loading