On 23/08/12 23:21, Brion Vibber wrote:
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
I proposed this same thing on the mailing list two years ago: http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/49500
Yes, I completely support changing the transactions to be nested using savepoints. They even are supported (or were) on all our db backends.
However, I was told that it "might make us hold a lot of locks for much too long". So with fear to cause magical db overload, nothing was changed. :(