Fix losing wiki comments on some wiki page slug changes

What does this MR do and why?

In the course of fixing a race condition on creating wiki pages, we detect duplicate WikiPage::Meta records with the same slug and remove the newer record.

This turned out to be a bad strategy, because we found out that deleting wiki pages doesn't clean up their WikiPage::Meta record. Now, this conflict can happen when moving a page to a slug that was occupied by some other deleted page, and this can result in losing comments (notes) associated with this WikiPage::Meta record if the record is newer.

To fix this, this MR removes the creation date constraint, ensuring only the orphaned record is removed.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Create a wiki page with slug foo and add a comment.
  2. Create another wiki page with slug bar and add a different comment.
  3. Delete page foo.
  4. Edit page bar and change slug to foo.
  5. The comments from bar should still be there.
  6. Repeat from 1, but delete page bar instead, and change slug in foo to bar.

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.

Edited by Piotr Skorupa

Merge request reports

Loading