[Zope-Coders] ZRDB and Transactions

Stephan Richter srichter@cbu.edu
Sun, 14 Oct 2001 10:47:51 -0500


Hello everyone,

since this is a real low-level core issue and I am looking for the 
maintainer (well, I am to 90% sure that it is Jim ;-) ), I am going to post 
it here, instead of Zope-Dev:

The problem revolves around DBObjects, even though it is not particular to 
it. As you may know, when a DBObject is created, a SQL Method is called 
saving the data. This method also returns an id that is then used as the 
Zope object's id as well.

This all works fine until we get a ConflictError while writing the 
Zope-Fingerprint of the DBObject. Of course, the Publisher then aborts the 
publishing process and creates a new request to retry the publishing 
process (ZPublisher/Publish.py; line 175-205). This process then passes and 
everything seems fine. It created as many Zope Fingerprints as it did 
Database entries.

But when l look at the entries itself, I notice that the ids are out of 
sync. After some testing I noticed that PostGreSQL saved the data (and 
therefore id) of the first attempt and the Zope fingerprint (ZODB) saved 
the id of the second attempt. I tested the DA and it does not do anything 
weird.

I tested this behavior primarily with Zope 2.3.3 and Python 1.5.2, since 
PsycoPG is not yet stable for Python 2.x (throwing segmentation faults). I 
also tested this configuration with PoPy and its Zope DA.

Since PoPy runs stable under Python 2.x (except a memory leak, which exists 
on all Python versions), I tried it there again as well. I used Zope 
2.4.2b1. The same problem exists. So there is definitely no fix in the 
latest Zope version.

Even though I could not find any clues, I think something might be wrong in 
the way the Transactions are committed (ZODB/Transaction.py; line 258-383). 
I noticed that the "Surrogate" object of the DB DA is always first in the 
commit list. But when I reversed the order, it would not change the 
situation. So, I am really lost on what to try next.

If you like to receive the Test Suite I did all the tests with, please feel 
free to drop me a mail. I would not even mind giving a couple people 
(people I know) access to my server in order to run the tests locally.

DBObjects URL: http://demo.iuveno-net.de/iuveno/Products/DBObjects

Regards,
Stephan

--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development & Technical Project Management