-
Notifications
You must be signed in to change notification settings - Fork 132
R2dbcEntityTemplate.insert(…) doesn't propagate error signals after data signal #552
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
Comments
Test the insert using standalone r2dbc-mssql driver is working fine as expected. :: Debug Log::
|
The issue seems to be rooted in DatabaseClient.create(connectionFactory)
.sql("INSERT INTO customer VALUES(:customerid, :name)")
.bind("customerid", "1234")
.bind("name", "12345678901")
.then().block(); works for me while |
What happens here is quite interesting. First, SQL server sends a warning (error) frame containing the actual error.
Then, the server response contains a row including column description:
The driver emits the row and then sends an error signal. |
I think it makes sense to address this issue within the R2DBC driver directly so that a query that has seen an error doesn't emit rows at all. |
R2dbcEntityTemplate.insert(…) now fully consumes the response from the INSERT call before continuing. Previously, we consumed only the first signal and continued then. A driver could emit a row and then an error signal and so the error signal would go unnoticed. Closes #552.
R2dbcEntityTemplate.insert(…) now fully consumes the response from the INSERT call before continuing. Previously, we consumed only the first signal and continued then. A driver could emit a row and then an error signal and so the error signal would go unnoticed. Closes #552.
hi @mp911de thanks for reply me in #180 I think it is desired to give the application the choice to whether to determine whether to expect the return value. And the statement returned/prepared by spring-data should be "smart" enough determined to add filter statement or not.
|
Looking at JDBC, calling For now, we await all results to reliably catch the failure. |
yes, and this is where the transaction rollback cause process hang up there. the way to bypass for us right now is to use execute on DatabaseClient not the typed insert nor save()/saveAll() on SimpleR2DBCRepository |
@mp911de with this change it can fix the exception not throw, but transaction is till hanging. '''2021-03-11 21:44:51,892 DEBUG onnectionfactory.R2dbcTransactionManager: 139 - Creating new transaction with name [org.springframework.data.r2dbc.repository.support.AbstractSimpleR2dbcRepositoryIntegrationTests$TransactionalService.shouldRollbackRepository]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT Process finished with exit code 130 (interrupted by signal 2: SIGINT) |
Database table schema.
Exception is not thrown when do SQL insert/update using ReactiveCrudRepository's save method on Microsoft SQL Server. Tested using spring-data-r2dbc latest released (1.2.5) and also the snapshot (1.3.0-M4), both shown the same result. No error, no record inserted.
Tried testing on MySQL using same code, it working the exception is thrown as expected.
:: Debug Log ::
And when using same code with MySQL (r2dbc-mysql)
:: Debug Log ::
The exception thrown as expected.
The repository to replicate the issue is https://github.com/niciosity/test-spring-data-r2dbc
Please investigate, Thank you very much.
The text was updated successfully, but these errors were encountered: