Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongo 2-phase commit should be implemented #5

Open
JackAdams opened this issue Jan 11, 2015 · 6 comments
Open

Mongo 2-phase commit should be implemented #5

JackAdams opened this issue Jan 11, 2015 · 6 comments

Comments

@JackAdams
Copy link
Owner

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.

@dcworldwide
Copy link

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

@JackAdams
Copy link
Owner Author

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 ...

@dcworldwide
Copy link

👍

@JackAdams
Copy link
Owner Author

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

@JackAdams
Copy link
Owner Author

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.

@dcworldwide
Copy link

Amazing!

JackAdams pushed a commit that referenced this issue Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants