[ZODB-Dev] Different commit protocols

Christian Theune ct at gocept.com
Fri Sep 22 08:35:52 EDT 2006



Wolfgang Schnerring wrote:
> Hi,
> 
> I'm working with Theuni on the BlobStorage, and am trying to understand the
> different 2-Phase-Commit protocols that are in use in ZODB at the same time.
> As I understand it, tpc_* is the old protocol, and prepare/commit is the new
> protocol.
> 
> The sequence in Transaction._commitResources is
>   tpc_begin      (ignored by DataManagerAdapter)
>   commit         (ignored)
>   tpc_vote       (translated to prepare)
>   tpc_finish     (translated to commit)
> 
> Which means, the old protocol is completed first, before the new protocol is
> even started.
> 
> Now, Connection uses the old protocol, and we've got a BlobDataManager that uses
> the new protocol. The BlobDataManager needs to do work during prepare, but it is
> only called to do this work *after* the Connection has already committed.
> Needless to say, the commit fails, because the preparation hasn't been done.
> 
> Maybe I misunderstood the protocol and the preparation work should be handled
> differently. In any case I'm rather confused by this double-protocal situation
> and would be grateful if someone enlightened me here.

Short annotation from me: The protocol only fails on windows because the
job of the BlobDataManager is to close all open file handles as a
preparation to commit the data. This has to happen before the Connection
(which implements storeBlob) can possibly rename the dirty blob files to
the committed file names.

So the other question would be: is there a way to assure that blob data
managers are always considered first (using the sort key)

Is the approach we are dealing with the right one? Or should the
connection or storage have enough knowledge about the blobs to tell them
to close all open file handles before renaming them? (The storage pretty
likely shouldn't, but the connection might IMHO)

Christian

-- 
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20060922/7294b2d2/signature.bin


More information about the ZODB-Dev mailing list