[Zope] Concurrency/Atomicity in ZSQL/ZOracleDA ?

Matthew T. Kromer matt@zope.com
Thu, 21 Mar 2002 11:40:26 -0500


Renaud Gu=E9rin wrote:

>>>I think I need to lock the table against reads, not inserts.
>>>What I must ensure is that no more select's max(id)+1 can be done
>>>
>>before the
>>
>>>subsequent insert is completed.
>>>I don't know how to use LOCK to do that, anyone ?
>>>
>>You want   LOCK TABLE table IN EXCLUSIVE MODE;   most likely.  A second
>>lock statement will block until the first one clears.
>>
>
>damn, just read this:
>"A lock never prevents other users from querying the table. A query neve=
r places
>a lock on a table. Readers never block writers and writers never block r=
eaders. "
>
>(http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a901=
25/statements_915a.htm)
>
>So I guess that leaves me for good with only the sequence option, unless=
 there's
>something we didn't think of...
>
>
>thanks anyway!
>

But if you always issue a LOCK TABLE before SELECT MAX from... your=20
LOCKs will compete against themselves, so you'll be safe. =20

--=20
Matt Kromer
Zope Corporation  http://www.zope.com/=20