Skip to content

Transactions implemented strangely #13

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

Closed
purplefox opened this issue Dec 22, 2013 · 6 comments
Closed

Transactions implemented strangely #13

purplefox opened this issue Dec 22, 2013 · 6 comments

Comments

@purplefox
Copy link
Member

The way that transactions are implemented using a "transaction" message does not look right to me.

Requiring the transaction message to contain all the operations of the transaction does not scale (transactions can be very big!) and does not seem necessary.

A better way to implement this would be to have a "transaction_start" message which the user sends to start a transaction, then the user sends operations (insert, delete etc) as normal, and then a "transaction_commit" or "transaction_rollback" message to end the transaction.

@Narigo
Copy link
Member

Narigo commented Dec 23, 2013

That would require to save state on the server what I tried to get rid of actually. Since we don't have a way to keep connections open, I'm not even sure if we could do this as we have no way of keeping the same connection over multiple messages.

@purplefox
Copy link
Member Author

You would need to pool connections (like a JDBC connection pool does).

You would not need to maintain the entire state of the transaction on the server, but what you're doing now is forcing the client to maintain that state, which could lead to OOM.

@purplefox
Copy link
Member Author

So... in more detail... if a user starts a transaction you need to get a connection from the pool and put it in transaction mode, then as more commands arrive for that connection you apply them against that same connection (and nothing else can use that connection).

@Narigo
Copy link
Member

Narigo commented Dec 23, 2013

Okay, I guess this is something we should be able to do as soon as we have a ConnectionPool. We still don't have this as we need a true async pooling solution. Mauricio and me don't know how to do that. You told me, that you have done something like that in HttpClient but I have to admit that I didn't really understood how that worked and how it was really asynchronous due to the synchronized keywords. Maybe I can have a look at it during the holidays, but I can't promise anything right now :(

@purplefox
Copy link
Member Author

There's nothing particularly complex about an asynchronous pool, here's an example: https://github.com/eclipse/vert.x/blob/master/vertx-core/src/main/java/org/vertx/java/core/http/impl/PriorityHttpConnectionPool.java

@Narigo
Copy link
Member

Narigo commented Sep 22, 2014

Finally, the new way to handle transactions made it into 0.3.0 release. Thanks!

@Narigo Narigo closed this as completed Sep 22, 2014
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