-
Notifications
You must be signed in to change notification settings - Fork 696
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
Select For Update
returns cached entity instead of updated entity.
#1527
Comments
Do you think this issue can be prioritized @Tapac |
Ok, the above is happening because of Ie. It returns the cached entity. |
Hey @yangineer, @nikunjy. Thanks for the highlight and sorry for the delay. I'm looking into the issue now and if you have any ideas how to fix it, please share it. We're also open to PRs :) |
Thank you @e5l for looking into this. Btw, I have a draft PR with a test to reproduce this bug in case anyone wish to take a stab. My idea is that we should update @Tapac previously mentioned an edge case about what to do if the entity is dirty. (ie. has pending updates)
I don't think that's a problem in most cases because If it does happen, I think we should throw an error. Ex. "Entity has pending changes and can't be wrapRowed".
Do you think this approach makes sense? |
In Postgres where the transaction is in Read Committed Isolation Level, when
Select For Update
, the client should receive the updated version of the row if the row is locked.In an Exposed transaction with Read Committed Isolation Level, when I query for an entity using DAO, and then do a
select for update
for the same entity later in the transaction, theselect for update
would be blocked until a concurrent transaction that updates the locked row is committed, as expected. However,select for update
also returned the cached entity, instead of the updated version as I was expecting. Calling additionalselect
for the same entity returned cached results as well. Only when calling.reload(entity)
would fetch the updated version.Shouldn't
select for update
skip the entity cache?Also, in
Read Committed
isolation level, I would expect:However, with the entity cache, I would see the same data(ie. cached data) if I query for the same entity in a transaction.
Is that correct?
The text was updated successfully, but these errors were encountered: