[ZODB-Dev] transactions, data manager order

Nitro nitro at dr-code.org
Tue Jun 22 04:58:41 EDT 2010


Hello,

I'm writing a custom data manager. The data manager should execute before  
the connection's data manager. So I provided the "sortKey" method. This  
works fine for the usual commit(). Once savepoints are involved however  
this fails, the connection's savepoint/rollback is executed before my  
custom data manager's savepoint/rollback.

This code in _transaction.py (in the _commitResources method) sorts the  
data managers:

L = list(self._resources)
L.sort(rm_cmp)

The problem is _commitResources is only executed from within commit().  
This means for a sequence such as

transaction.begin()
transaction.get().join( myDataManager )
transaction.savepoint()
transaction.rollback()
transaction.commit()

the data managers are not sorted unless commit is encountered. If I move  
the sorting code to the join() method instead, I get the proper search  
order.

Is this a bug?

-Matthias

P.S.: Thanks for this great writeup: http://repoze.org/tmdemo.html . It  
should be part of the official docs/the upcoming book.


More information about the ZODB-Dev mailing list