You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A credit can be added to a billing account that is being deleted #2010
CreateEntry checks that the billing account is live before it opens its transaction. The credit insert inside that transaction does not read the account again.
If the account delete commits between the check and the insert, a new live transaction is written for a deleted account. The delete only hides the transactions that exist when it runs, so this one is left outside the forfeit totals.
Proposed fix: inside CreateEntry's transaction, read the live customer row with FOR KEY SHARE before the balance check and the insert. It only has to conflict with the FOR UPDATE lock that the account delete takes. Return customer.ErrNotFound when the row is already soft deleted.
Context: found while reviewing the billing account delete change in #1999. It is listed there as a known gap.
Activity