Hacker News new | past | comments | ask | show | jobs | submit login

If you make 2 updates, check the balance to ensure > 0, and rollback if < 0, and you do all of this in a transaction, doesn't concurrency no longer matter? If another transaction beats you to the punch, won't the balance check query reflect that?



Nope - this can happen with cards with a balance above zero too.

Look at what happens if you start two transfers of 1/2 the money from A to B.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: