Page MenuHomePhabricator

WMF code trying to insert child rows after parent rows rolled back
Open, Needs TriagePublic

Description

Our post-save hooks and donation queue consumers often try to insert a series of rows: contact -> contribution -> contribution custom data, for example.

Sometimes when one of the first steps is rolled back, the code continues trying to insert the child rows with now-non-existent parent row IDs and causes foreign key constraint violations. We did some work to try to prevent this in T192977, but we're still seeing these FK violations in failmail from time to time.

Event Timeline

Note: the latest FK violation was on an insert to the 'gift data' fields, referencing a rolled-back contribution. Earlier work may have only included checking for rollbacks of contact when inserting the contribution, then of the contribution when inserting the wmf_contribution_extra row.