-
Notifications
You must be signed in to change notification settings - Fork 690
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
Nested transaction partially commits outer transaction since 0.16.1 #605
Labels
Comments
toefel18
changed the title
Nested transaction commits outer transaction since 1.16.1
Nested transaction partially commits outer transaction since 1.16.1
Jul 13, 2019
toefel18
changed the title
Nested transaction partially commits outer transaction since 1.16.1
Nested transaction partially commits outer transaction since 0.16.1
Jul 14, 2019
Any updates on this? |
Fixed in 0.16.3. @toefel18 , I'll think about how to implement propagation in the future releases |
Hi, Should this issue be closed, or is it kept open for discussing propagation? I see #611 is opened. |
@binkley , thnx, I just forgot to close an issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The nested transaction commits prior work of the outer transaction when the nested transaction scope ends. A rollback after the nested transaction is ineffective and results in an incorrect state.
Default nested transaction handling seems incorrect after upgrading from 0.14.1 to 0.16.1.
(I have read https://github.com/JetBrains/Exposed/wiki/Transactions#using-nested-transactions, but it is not thourough)
Consider this nested transaction:
Behavior version 0.14.1
before-dummy <- rolled back!
inner-dummy <- rolled back!
after-dummy <- rolled back!
Behavior version 0.16.1 with
db.useNestedTransactions = false
(default)before-dummy <- written to database
inner-dummy <- written to database
after-dummy <- rolled back!
Observed behavior: The nested transaction seems to commit the first part (before-dummy) of the outer transaction when it goes out of scope.
Expected: it does not commit and leaves committing to the outer transaction (or less preferred: the inner transaction only commits work in it's own scope).
Behavior version 0.16.1 with
db.useNestedTransactions = true
before-dummy <- rolled back!
inner-dummy <- rolled back!
after-dummy <- rolled back!
This behaves as expected (although one could also expect inner-dummy to be committed!)
Without using
db.useNestedTransactions = true
nested transactions seem broken.Preferred solution in my opinion would be an extra parameter for
transaction(){}
which specifies the desired transaction propagation. For example:A bit like the options provided by Spring https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Propagation.html
The text was updated successfully, but these errors were encountered: