[ZODB-Dev] Support for graceful ZODB Class renaming
Jeremy Hylton
jeremy@zope.com (Jeremy Hylton)
Fri, 17 Jan 2003 10:06:07 -0500
Another possibility is to allow lazy upgrades that happen at load
time. The storage would need to keep a record of register
translations: class X.Y.Z is now A.B.C. The database would track
those registrations and convert classes on the fly when they were
loaded. If a particular storage did reference counting on classes, it
could delete registrations when all instances had been upgraded.
This is a variant on the classic solution, but a little less invasive
because it happens inside the database and doesn't require mucking
with sys.modules.
The registration could include a transformation function that
eliminated the need for __setstate__() hacks.
The chief advantage of this approach is that you can update the
database in a way that appears atomic but does not require taking the
database offline during the upgrade.
The chief disadvantage of this approach is maintaining the
registration information and the added complexity of starting new
database-internal transactions to do upgrades in the mniddle of an
application transaction that loads an object. I know Jim thinks this
is a severe disadvantage.
Jeremy