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

Use MongoDB transactions #9916

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

oplik0
Copy link
Contributor

@oplik0 oplik0 commented Oct 17, 2021

I mentioned that it'd be quite simple to add MongoDB transactions in #9898 - so I decided to try it, even if it's not ideal when it comes to consistency.

I think I handled all parts of MongoDB driver where multiple writes occur (since single operations are atomic anyway).

Transactions only work on replica sets on a version newer than MongoDB 4.0, unfortunately. On singular instances nothing improves in terms of consistency. As such the current tests never take the transaction path - and to change that would require adding another entry to test matrix for newer replica set MongoDB.
If it's fine to do so, I'll be glad to update this PR to have testing done properly for replica sets, but currently I just made a separate branch with all mongo tests modified to use replica sets: https://github.com/oplik0/NodeBB/actions/runs/1351224224

Edit: also now tested different mongo versions with replica set enabled:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant