I wrote some unittests to investigate some odd transaction
behavior i noticed while doing unittests of integrating non 
sub transaction aware objects, and to insure proper txn behavior.
these tests test the transaction system independent of the rest 
of the zodb and test failure modes as well.

i've found a few bugs. 

1. TM.py ignores calls to tpc_abort. this i believe is the 
likely cause of most of the rdbms integration problems that
are referenced above as TM.py generally forms the integration
point between db adapters and zope's transaction framework. 
if an error occurs in the two-phase-commit protocol, the database
adapter will never recieve a finish/commit or abort message, and
will therefore (due to how TM works) never be able to register 
again for a zope transaction.

2. A Non Sub Transaction aware object (including any TM derived
object) that participates in a sub-transaction will recieve 
a tpc_finish message (which for TM derivatives calls _finish) 
as part of the subtransaction commit process. this means that
if the outer transaction is latter aborted, there will be a
loss data integrity.

3. As part of the commit process for a transaction involving
subtransactions, any objects registered since the last subtransaction
commit will be involved in an implicit subtransaction commit. 
if an error occurs during this implicit subtransaction, none
of the objects registered previously to the last explicit
subtransaction commit will recieve any messages. i'm not sure totally
sure this is a bug since any calls to explicitly begin a new
transaction should abort the objects that haven't recieved any
transaction messages. in a zope setting this is done automatically,
however standalone users should be aware of this.

i've posted a modified TM.py to my zope.org member page that
contains fixes/workarounds for problems 1 and 2. 

http://www.zope.org/Members/k_vertigo/ShortStories/Transaction/

in addition the unittests i've been using are posted there
as well. i'll commit these changes to TM.py latter today, but
have posted the above to zope.org for those who don't want
to immediately upgrade. actual fixes for problems 2 and 3 i'll 
leave to ZC.
 
if you're using a rdbms with zope, i would recommend 
installing the modified TM.py in replace of the exiting TM.py at 
lib/python/Shared/DC/ZRDB/TM.py. i would appreciate any 
feedback from rdbms users who were previously experiencing 
problems.

if this does not solve your problem, and you believe its
the fault of the transaction system, please email me. i don't 
use an rdbms with zope, but i'm happy to further investigate.

cheers

kapil thangavelu

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to