[ZODB-Dev] transacting multiple databases

Shane Hathaway shane@zope.com
Wed, 11 Dec 2002 13:35:25 -0500


hazmat wrote:
> ok, but as long as zodb works with python2.1 it will ship with extension 
> class, so out of the box standalone zodb can use this for mounting zodb with 
> python 2.1, and assuming mounted zodb becomes a feature with zope3, it would 
> be reasonable to expect a similiar facility for zodb3.5/4, such that mounting 
> can be considered a useful feature of zodb without zope?

Hmm, you reminded me of something.  The current mounting code depends 
entirely on __of__(), but Zope 3 will not use ExtensionClass, and there 
is no equivalent to __of__() in Python itself, even with new-style 
classes.  So the current strategy will not work in Zope 3.  But that's 
not a problem because...

> having cross db references would rock as well, but mounting is pretty useful 
> as is, imo.

... for Zope 3 we should plan to do all "mounting" using cross-database 
references.  It will be faster and more seamless.  There won't be a 
"mount point" object that conceals itself; instead, ZODB will just know 
to load the mounted object from a different database.  The application 
will have to work hard to know that any mounting is going on, whereas 
today the application has to do all the work.

OTOH AdaptableStorage provides a very different way to mount data from 
multiple sources, and it already works with the current ZODB code.  I'll 
explain how this works soon.  (I think I'm starting to get a feel for 
how it is that Alan Cox can work on three branches of the Linux kernel 
at the same time. ;-) )

>>It will be easy to get everything working together with mounting,
>>though.  In addition to the setLocalTransaction() method, we might have
>>a setTransaction() method which lets the mounting machinery put both
>>connections in the same transaction.  Or perhaps we could make
>>connections aware of when they are mounted and pull the transaction from
>>their parent automatically.  Hmm, for better encapsulation, the second
>>option seems best, since right now we're stuffing an extra attribute in
>>the mounted connection anyway.
> 
> 
> perfect, thats so much easier than what i was prototyping, a corollary to the 
> aftermidnight programming rule should include no jetlagged programming :-),

True, but programming *on the plane* can be a good thing. :-)

>>I think the next step is to decide whether the setLocalTransaction()
>>code ought to be merged into mainline ZODB.  I'd be happy to do it with
>>Jeremy's approval.  (Jeremy, are you reading?)
> 
> 
> +1, its useful and often requested here. 

Christian described the justification very well, BTW.

Shane