You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #1087 and the fix in 2ff529d this is about concurrent inserts of unique jobs in Oban.
When inserting unique jobs the immanent assumption seems to be that
the advisory lock is acquired based on a feasible hash for the given unique constraints, and
if transaction attempt A fails to acquire the lock because transaction B has acquired it, then
its safe to assume that B will commit an insertion that will lead to a conflict and thus A doesn't have to insert one on its own
The thing is, should the transaction B terminate with a rollback the insertion which the lock was acquired for is never committed and in consequence no job will be inserted into the database.
Im not very familiar with using :replace with job insertions but I would guess that there is another issue there since the respective update can't take place.
Expected Behavior
Im not entirely sure how to best handle this but it seems to me that this behaviour is currently pretty obfuscated.
From my perspective this should lead to an error for insert/3,5 and an exception for insert!/3 instead of returning the job as if it was inserted.
The text was updated successfully, but these errors were encountered:
Another problem I ran into is that Postgres repeatable read isolation messes with job uniqueness since concurrent transactions are unable to succsesfully SELECT the respective conflicting jobs from each other and thus both jobs will be inserted.
Really no sure how to handle this one but maybe its worth to be noted in the docs.
There's a lot of thought and discussion about how to handle uniqueness without advisory locks going on currently, partly because of the push for interop with CockroachDB and Yugabyte.
Changing the return to an error in this circumstance may be necessary, but I don't want to introduce a potentially breaking change just to change it again soon. For now, documenting the caveats in the README seems like the best option.
Current Behavior
Similar to #1087 and the fix in 2ff529d this is about concurrent inserts of unique jobs in Oban.
When inserting unique jobs the immanent assumption seems to be that
A
fails to acquire the lock because transactionB
has acquired it, thenB
will commit an insertion that will lead to a conflict and thusA
doesn't have to insert one on its ownThe thing is, should the transaction
B
terminate with a rollback the insertion which the lock was acquired for is never committed and in consequence no job will be inserted into the database.Im not very familiar with using
:replace
with job insertions but I would guess that there is another issue there since the respective update can't take place.Expected Behavior
Im not entirely sure how to best handle this but it seems to me that this behaviour is currently pretty obfuscated.
From my perspective this should lead to an error for
insert/3,5
and an exception forinsert!/3
instead of returning the job as if it was inserted.The text was updated successfully, but these errors were encountered: