[Zope-dev] Re: post publishing hook

Julien Anguenot ja at nuxeo.com
Sun Apr 3 16:38:54 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Dieter Maurer wrote:
> Christian Heimes wrote at 2005-4-1 22:28 +0200:
> 
>>...
>>You want to bind some actions to the transaction system because you want 
>>to execute some code at the end of the first phase of the 2 phase 
>>commit.
> 
> 
> I do not think that Florent wants to execute things at the end
> or in the first commit phase. Instead, he wants to execute something
> *BEFORE* this phase.
>

That was the initial idea in our case.

> 
>>Hooking into the transaction machinery of ZODB is very easy. Write 
>>your own DateManager implementing the IDateManager interface and 
>>register it into the current transaction using get_transaction.register(DM).
>>
>>For your use case overwrite the tpc_vote() method of the data manager to 
>>do the indexing at the boundary between the two phases.
> 
> 
> This will not work for Florent's use case,
> at least not in the current ZODB (for Zope 2.7).
> 
> Reason:
> 
>   The transaction freezes the set of objects it processes
>   in the commit *BEFORE* the first commit phase.
> 
>   Therefore, no "tpc_vote" is allowed to modify any persistent
>   object. Failure to do so leads to extremely nasty
>   persistency errors (the object is marked changed but
>   no transaction knows about it -- no change to this object in the future
>   will get persisted until a restart).
> 
> 

I've been implementing a IndexationManager hook doing the job for CPS
but I get the error your talking about...

Thanks Dieter for the explanation. Your mail just arrived when I was
trying to understand the persistency problems :(

I got POSKeyError, Unauthorized (at catalog level while indexing and
trying to get object attributs) or KeyError (Connection.setState())
exceptions randomly as well.

Is there a way to hook before the first transaction commit phase ?

	J.

- --
Julien Anguenot | Nuxeo R&D (Paris, France)
CPS Plateform : http://www.cps-project.org
mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFCUFReGhoG8MxZ/pIRAi2jAJ4hXTAJhqJB8czSkQpVCCBEKzWXtACfXA/m
S4JfeBF+TWweLWPSoxobPEE=
=8zPL
-----END PGP SIGNATURE-----


More information about the Zope-Dev mailing list