-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Prevent Oracle from committing uncommitted transactions on connection close #45301
Prevent Oracle from committing uncommitted transactions on connection close #45301
Conversation
This comment has been minimized.
This comment has been minimized.
🙈 The PR is closed and the preview is expired. |
This comment has been minimized.
This comment has been minimized.
Let's make sure @yrodiere is on board with this before merging. It obviously will require a note in the migration guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of this.
LGTM, just a few comments that can probably be dismissed if you disagree.
...e/src/main/java/io/quarkus/jdbc/oracle/runtime/RollbackOnConnectionClosePoolInterceptor.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e6d6080
to
38801ae
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
...e/src/main/java/io/quarkus/jdbc/oracle/runtime/RollbackOnConnectionClosePoolInterceptor.java
Show resolved
Hide resolved
Hey guys, I saw the comment about XA connections and did some low level testing. Here's the setup
My understanding of the issue is that the JTA transaction manager never gets the chance to either commit or roll back the transaction. In an XA scenario I believe that the transaction manager needs to either prepare+commit or rollback multiple connections. |
38801ae
to
918a2ad
Compare
@segersb I'm unsure how this is supposed to happen, I would have expected the XA layer to handle things properly in this case but I might be mistaken. What bugged me at the beginning was the Javadoc for
The |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@gsmet, I did some additional testing and digging into XA. In my previous example I was using an XA data source, but I was misusing it as a "regular" connection. When using the proper way to initiate an XA transaction, Oracle seems to behaves as we would expect: Also, as mentioned in the javadoc you referenced, an exception is thrown when rolling back an underlying connection. Therefore, ignoring XA connections in the rollback interceptor is indeed the appropriate solution.
|
@segersb thank you very much for taking the time to experiment with this, it's greatly appreciated! |
… close When a connection is closed, Oracle will commit the unfinished business, which is a very surprising behavior in most cases and could lead to data loss. I added a -Dquarkus-oracle-no-automatic-rollback-on-connection-close to disable this behavior if absolutely needed. If we have feedback that this is not something we should do always, we can add a proper configuration property (with a default value to determine). Fixes quarkusio#36265 Wouldn't have been possible without the nice work of @segersb and @Felk. Co-authored-by: Felix König <[email protected]>
2bc5cd6
to
1d8f3b8
Compare
1d8f3b8
to
44fd4b3
Compare
I pushed some minor doc adjustments. If you're all happy with it, we can merge and make it part of 3.18. |
Status for workflow
|
Status for workflow
|
And merged! Thanks for the awesome collaboration on this, everyone! |
When a connection is closed, Oracle will commit the unfinished business, which is a very surprising behavior in most cases and could lead to data loss.
I added a -Dquarkus-oracle-no-automatic-rollback-on-connection-close to disable this behavior if absolutely needed.
If we have feedback that this is not something we should do always, we can add a proper configuration property (with a default value to determine).
Fixes #36265
Wouldn't have been possible without the nice work of @segersb and @Felk.