Re:MongoDB gets support for multi-document ACID transactions
by javiermaestro on Thursday February 15, 2018 @03:10PM
(#16387153)
Please do, because I'm interested in seeing how non-relational it is... I truly believe it has to be otherwise, so I'd love to read your findings!
[ Parent
| on HN ]
Re:MongoDB gets support for multi-document ACID transactions
by imtringued on Thursday February 15, 2018 @06:17PM
(#16388641)
You still need ACID transactions over multiple entries even if your data is nonrelational otherwise there is the potential for item and money duping bugs.
A simple example would be a marketplace.
Player buys item X with Y gold from another player.
1. Server checks that item X exists.
2. Server checks that the player has at least Y gold.
3. Server removes the gold from the player
4. Server gives gold to the seller.
5. Server removes item from marketplace.
6. Server adds item to inventory.
What if someone maliciously crafts two requests in a way that step 2 of the second request happens before step 3 of the first request? The money is deducted properly but the account can now have a negative balance and there are now two instances of the item.