db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Can someone explain this deadlock?
Date Sun, 06 Sep 2009 09:35:26 GMT
Dag.Wanvik@Sun.COM (Dag H. Wanvik) writes:

> T K <sanokistoka@yahoo.com> writes:
>
>> Does Derby support SQL hints, so I can tell it to NOLOCK on the SELECT?
>
> You can try to lower the isolation level for the select to read
> uncommitted,
> cf. http://db.apache.org/derby/docs/10.5/ref/rrefsqlj41360.html using
> the "WITH UR",
> if this is ok with your application logic.
>
> According to http://db.apache.org/derby/papers/btree_package.html,
> no locks are acquired in this case.
>
> But I am not sure that would prevent a momentary read lock being
> requested while the row is being read, does anyone know for sure?

It shouldn't obtain any shared row locks for read operations when the
isolation level is UR (read uncommitted). According to the javadoc for
org.apache.derby.impl.store.raw.xact.RowLocking1 [1], where this is
implemented, all requests to lock a record for reading are
ignored. Table-level intent locks are obtained, though, so an exclusive
table lock will still block readers with read uncommitted isolation
level.

[1] http://db.apache.org/derby/javadoc/engine/org/apache/derby/impl/store/raw/xact/RowLocking1.html

-- 
Knut Anders

Mime
View raw message