The ledger row is written first on purpose, so a crash cannot leave the audit trail behind the cached total. But when the quantity write then fails, the ledger sat ahead of the quantity - and the operator was told to retry, which wrote a second ledger row for the same change and double-counted it. A failed quantity write now reverses its own ledger row, so SUM(change_qty) still reconstructs current_qty and a retry is safe. |
||
|---|---|---|
| .. | ||
| plans | ||
| smoke-tests | ||
| specs | ||