meteor-transactions icon indicating copy to clipboard operation
meteor-transactions copied to clipboard

Mongo 2-phase commit should be implemented

Open JackAdams opened this issue 9 years ago • 6 comments

The mongo 2-phase commit approach can be implemented in this package. It will take some refactoring, but it will ensure better data integrity than the current naive/optimistic transaction model that the package employs.

It would be necessary (and a big improvement) to change the way that transactions originating on the client are handled. Instead of make client side collection updates, thereby pushing a bunch of inserts, updates and removes through the allow/deny rules, the whole set of transaction data can be sent to the server via a method, processed there, and the db changes made or rejected based on identical permission checks to those used for transactions originating on the server. This would lead to much more maintainable/reliable app code, preserve latency compensation, and allow for a proper 2-phase commit for transactions originating from both client and server.

JackAdams avatar Jan 11 '15 10:01 JackAdams

It would be really impressive if you managed to implement this. I wish i could help but its a bit beyond me atm.

dcworldwide avatar Mar 05 '15 04:03 dcworldwide

I can sort of see my way through how it would go down, but it would take a big refactor of the whole package. There are a bunch of other things that are higher on my priority list at the moment, as the package works in its current form, even though I know the approach used is pretty brittle.

One day ...

JackAdams avatar Mar 05 '15 06:03 JackAdams

:+1:

dcworldwide avatar Mar 11 '15 03:03 dcworldwide

0.7.0 gets very close to achieving this. Leaving the issue open until I can make it bulletproof.

JackAdams avatar Aug 05 '15 09:08 JackAdams

0.7.5 is another big improvement. The approach is not as solid as the one outlined in the mongo docs, but it makes fewer writes and, with oplog/mergebox pressure to consider it's "good enough" for the moment.

JackAdams avatar Nov 26 '15 11:11 JackAdams

Amazing!

dcworldwide avatar Dec 07 '15 07:12 dcworldwide