[ZODB-Dev] Migration of obsolete BTrees to ZOPE 2.8

Tim Peters tim at zope.com
Sun Nov 20 19:49:53 EST 2005


[Dieter Maurer]
> It is no problem as long as you migrate while you are still using a Zope
> 2.7 (ZODB 3.2) release.

I believe (but don't know) that the OP has many distinct, physically
distributed installations of their product, involving many distinct
databases.  I don't know how many "many" is ;-), or what kind of upgrade
strategy would be acceptable, but I'm pretty sure they can't nurse each
upgrade along "by hand".

> We added automatic migration code to our old "BTree/Intset" using code.

Right, and I think that's what most other people did too.

> But we may need an explicit conversion before we finally upgrade to Zope
> 2.8 -- to get very rarely used objects upgraded as well.

...

> The migration is trivial as long as "BTree" and "Intset" are still
> available. We use for example the following "BTree" migration.
>
> # backward (pre Zope 2.8) compatibility
> try:
>   from BTree import BTree as _BTreeOld
> # DM 2005-08-25: for unknown reasons, this can raise an "AttributeError"
> #  rather than an "ImportError"
> #except ImportError: _BTreeOld = None
> except (ImportError, AttributeError):
>   _BTreeOld = None
>   from BTrees.OOBTree import OOBTree as BTree
>
> 	...
>         tree = self._tree
>         if _BTreeOld is not None and isinstance(tree, _BTreeOld):
>             # still an oldy -- upgrade to modern structure
>             self._tree = BTree(tree)
>             msg = 'BTree upgraded'
>         else: msg = 'BTree was already modern'

Margie, does this help you?  Can you do migration "live" along these lines,
or do you need on offline conversion script, or ...?



More information about the ZODB-Dev mailing list