[Zope-dev] To the brave folks trying Zope HEAD...
Jim Fulton
jim at zope.com
Thu Dec 11 23:03:35 EST 2003
Sidnei da Silva wrote:
> | Jim asked about it on zope-dev, and got no response; see:
> |
> | "Can we forsake database backward compatability on the head for
> | a while?"
> |
> | http://mail.zope.org/pipermail/zope-dev/2003-November/021055.html
> |
> | ...
> |
> | > This would mean that old databases would not be useable with the
> | > CVS head in the near term. Would this cause anyone any problems?
> |
> | I'm happy no one responded to this. Silence is assent, :)
>
> :P
>
> Is there any special trick to such script? Provided some pointers of
> what the script should do, I wouldn't mind writing and testing it.
There are lots of special tricks to such a script. Otherwise, I would
have written it already. :)
OK, here's how I think it needs to happen, with some, hopefuly helpful notes.
1. The script needs to be run under Zope 2.6 or 2.7. There should
be a product that people can install that installs some method to
be run. People should be able to run this method in a running zope.
They should not need to shut down their site to do the conversion.
2. The method should walk the object tree, converting:
- old-style BTrees to modern BTrees
- old-style buckets to modern buckets
- intSets to IITreeSets.
The individual conversions should be pretty simple. At worst involving
a for loop, but, in many cases, the constructors for the new types will
be able to accept the old types.
3. The hard part is walking the object tree. You will need a function that,
given an object, will return the oids of the objects it references.
Perhaps Jeremy can help you with that.
4. You should do each conversion in a separate transaction. That is, when you
encounter an object that needs to be converted, you should convert it and commit.
5. You will want to keep a dictionary of the oids visited, just in case there are
any cyles. Also, if you encounter an oid that was converted, you will need to
subtitute the new value. This might be really hard. :( I think this probably
won't happen, but perhaps you should at least check for it.
6. After the conversion has been run, the database should be usable with
the head.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope-Dev
mailing list