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

How to handle transactions #2

Closed
codeliner opened this issue May 25, 2015 · 4 comments
Closed

How to handle transactions #2

codeliner opened this issue May 25, 2015 · 4 comments

Comments

@codeliner
Copy link
Member

Question extracted from prooph/proophessor#20:

MongoDB does not support transactions, but it has atomic modifiers and ttl documents, so enough tools to build transactions manually. For the event stream a transactional behavior would be useful, right?
I think of something like this:

- Start transaction sets a property into the adapter that transaction is running
- During in-transaction persistence we add a "inTransaction":true property on the document.
- All findById and findAll and similar queries check for the inTransaction property
- After transaction is finished, we can remove the inTransaction property with an atomic modifier to enable the new state
- An entry marked "inTransation" has a ttl (time-to-life) on the server side, in case the process dies, we don't want to have pending transactions in the database, so they get cleaned up after some time.

If we do something like this, which TTL will we use? MySQL InnoDB has a innodb_lock_wait_timeout of 50 secs by default f.e.

@codeliner
Copy link
Member Author

Unfortunately, I have no production experience with mongoDB. Used it for a private project only. My clients always use Oracle. Don't ask me why :-)
Do we have other (simpler) options? Or maybe we should first have a look on how the event stream(s) can be organized with mongoDB. Let us discuss this in #3 first.

@prolic
Copy link
Member

prolic commented Aug 7, 2015

I can do that, if you want to ;)

@codeliner
Copy link
Member Author

Transaction support would be great. I'm also fine with the way you want to implement it. It sounds good and works without magic so go for it 👍

@codeliner
Copy link
Member Author

#4 ships with transaction support.

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

No branches or pull requests

2 participants