-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
The transaction does not seem to take effect in this case #652
Comments
Have you checked what transaction is holding the lock? |
distributedLockRepository.findByLockKey(distributedLockDO.getLockKey()) The lock is held, which means that his transaction is not maintained to the update sql block,or it's not the same transaction as the update transaction |
'for update' and 'update' are not connected in a transaction, which causes 'update' to time out while waiting for an x-lock on the database, how do I get 'select for update' and 'update' to stay in the same transaction? @mp911de |
Make sure that you have a single connection factory to obtain connections from. Any routing might cause interferences. |
You can try this example, the transaction is invalid |
|
I changed the code to the following and the transaction took effect, I will continue to watch and learn tomorrow, thanks for your help @mp911de
|
Changing the above code to use TransactionalOperator will invalidate the transaction
|
The 2 example transactions above both fail except that they no longer output 'Lock wait timeout exceeded' |
Can anyone tell me what to do for this application scenario |
help |
|
In a transaction, there is inherently the possibility of relying on query results, so how can you ensure that data is not read dirty if it is not in the same transaction? Can you tell me how to have both query and insert actions in a single transaction in r2dbc? |
When using the above code, the transaction will fail, and querying the data first and then updating it will fail due to the inability to get an x-lock on the database
The text was updated successfully, but these errors were encountered: