Skip to content

Remove race condition while deleting groups

Timothy Andrew requested to merge 23223-group-deletion-race-condition into master

What does this MR do?

The intended flow during a group deletion is:

  Soft-delete group (sync) -> Delete group projects (async) -> Hard-delete group (async)

The soft-delete was run in a transaction, which was committed only after the async job (for hard-deletion) was kicked off. There was a race condition here - the soft-delete transaction could complete after the hard delete completed, leaving a soft-deleted record in the database.

This MR removes this race condition. There is no need to run the soft-delete in a transaction. The soft-delete completes before the async job is kicked off.

This MR also adds a migration to delete all existing (soft-deleted) groups left in an inconsistent state due to this bug.

Does this MR meet the acceptance criteria?

  • [#23223 (closed)/!7528 (merged)] Groups not getting fully deleted / 500
    • Implementation
      • Fix the race condition
      • Write a migration to remove all groups currently in limbo (marked for deletion but not deleted)
    • Tests
      • Added
        • Race condition fix
      • Test migration on staging
      • Passing
    • Meta
      • CHANGELOG entry created
      • Documentation created/updated
      • API support added
      • Branch has no merge conflicts with master
      • Squashed related commits together
    • Review
      • Endboss
    • Wait for merge

What are the relevant issue numbers?

Merge request reports