On Thu, Aug 23, 2012 at 2:02 PM, Evan Priestley epriestley@phacility.comwrote:
We solve this in Phabricator by using BEGIN (depth 0) or SAVEPOINT (depth 1+) when incrementing the counter, ROLLBACK TO SAVEPOINT (depth 1+) or ROLLBACK (depth 0) when decrementing it after a failure, and nothing (depth
- or COMMIT (depth 0) when decrementing it after a success. Our experience
with transaction stacks has generally been good (no real surprises, doesn't feel magical, significantly reduces the complexity of transactional code), although we don't support anything but MySQL.
Oooh, nice! Hadn't come across SAVEPOINT before.
http://dev.mysql.com/doc/refman/5.0/en/savepoint.html
-- brion