-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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 support via savepoints is broken in Oracle database #33987
Comments
We've also stumbled upon this change when trying to upgrade from Spring Boot 3.3.5 (Spring 6.1.14) to Spring Boot 3.4.0 (Spring 6.2.0). To add some more information to this issue: Our setup consists of a Spring Boot application communicating via JOOQ to an Oracle 19c SQL Database. Specifically, there are a few operations where a nested transaction is needed and the code for this looks something like this:
In Spring 6.1.14 this has worked as expected, however while trying to upgrade to Spring 6.2.0 we noticed that there were a few tests which started to fail due to an exception being thrown when the nested transaction is being committed:
As we investigated the cause of this failing test, we've found out that there was in fact a debug log with the same message being logged in Spring 6.1.14, whereas now with Spring 6.2.0 this exception is being thrown instead of being swallowed. We've pinpointed the origin of that change down to the same PR (#32992) as @minjun-jin did. The reason for this PR seems reasonable in a way that clients of spring-jdbc should be informed about such database errors. However, this exception stems from a level so deep that there is no way how we could handle this in our application code while also ensuring that the nested transaction doesn't rollback. We believe that this exception should be handled from within spring-tx (presumably from within AbstractPlatformTransactionManager::processCommit) as any Spring application using a transaction from within spring-tx is only a transitive client of spring-jdbc. Furthermore, the logic being performed within spring-tx seems like a place where this exception could actually be handled in a useful way without causing the whole transaction to rollback. Another point to mention here is the fact that the implementation of |
Related to pull request:
org.springframework.jdbc.datasource.JdbcTransactionObjectSupport
releaseSavepoint
The function was only handling exceptions as a log, but when it was modified to throw an exception, the nested transaction in the Oracle database was broken.
The Oracle driver does not support explicit
releaseSavepoint
. It releases automatically.A modification is needed to revert to the existing logic that does not throw exceptions or to prevent
releaseSavepoint
calls when using an Oracle database.The text was updated successfully, but these errors were encountered: