Explicit locking in JPAStorageService

Cantor, Scott cantor.2 at osu.edu
Thu Nov 5 12:02:01 EST 2015


On 11/5/15, 11:38 AM, "dev on behalf of Cantor, Scott" <dev-bounces at shibboleth.net on behalf of cantor.2 at osu.edu> wrote:



>>I don't know what the ISO/IEC SQL standard says, since it is not freely
>>available, but locking a whole table seems excessive where a range lock
>>would suffice.
>
>It's not excessive, it's *mandatory*. If you don't take a table lock on a select with a transaction left open, then a follow up insert or update is subject to deadlock. When the operations are fast, that works fine.

(Of course, yes, if the fields are indexed, in some cases you *can* do a range lock, but that gets a lot harder to get right, which is why these rollbacks and deadlocks are so common.)

-- Scott



More information about the dev mailing list