Jeremy Hylton : weblog : 2004-04-16

ZODB 3.3 alpha 3

Friday, April 16, 2004, 4:13 p.m.

Tim Peters and I spent the better part of this week getting ZODB into shape for another alpha release. It's the last release of ZODB that I'll be actively involved in. I wish we had been able to get a beta release done, but there's too much new development for that; we need a release for people to try it out before the APIs can be finalized.

There is a long list of changes and new features in the NEWS file. My biggest project has been the revised transaction API -- a little more like the one we were working on in ZODB 4. I think the new APIs will be easier to use and provide more flexibility for people that don't like ZODB's default policy of giving each thread an independent transaction.

The revised transaction API has a completely new implementation. Most of the implementation was straightforward, but subtransaction support was not. ZODB 4 had savepoints that were created independently of committing a transaction. An application could rollback to an arbitrary savepoint, while ZODB 3's subtransaction only allow you to rollback changes since the last sub-commit. The API is cleaner for savepoints, but there's a major implementation benefit I hadn't realized before: The abort and commit logic becomes much clearer, because it isn't tangled up with the subtransaction support; they're two mostly independent features.

There are some nice changes to Persistent that were backported from ZODB 4 by Fred Drake, including improved support for getattr and setattr hooks. Fred also realized that we should distinguish between deactivating objects and invalidating objects; the former occurs because of cache eviction, the latter because of updates by another client.

The new release also reflects a new approach to writing tests. There are several tests that are based on doctest. Jim Fulton and Tim had a paper at PyCon that described some of our experience mixing doctest and unittest. Most of the new tests I've written have been constructed as module-level docstrings, e.g. A key idea is that tests require the same care and attention that the rest of your code requires; they require the same evolution and maintenance that the rest of the code requires.

We've come a long way since the StandaloneZODB release in early 2002. The current version of ZODB has support for new-style classes and multi-version concurrency control to eliminate read conflicts. We fixed a ton of bugs in concurrency control, prevented deadlock in multi-database commits, and overhauled ZEO so it was stable under heavy load. It's been a lot of fun.