Re: Migrating to BTrees 4.x

Jason Madden <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
> On 1/5/17 10:01 AM, Jim Fulton wrote:
> 
> But surely people have built apps with BTrees 4, because BTrees 4 was released a loooooooong time ago (late 2012), and this seatbelt was introduced in BTrees 4.0.
> 
> When indexing content, you will very often encounter content without a value set, typically defaulting to None.
> 
> When such values are indexed, you'll get an error.  I don't see any guard against this error in, for example, zope.index.
> 
> Have people built newer apps with indexing on BTrees 4? If so, how have you dealt with this issue?

We've built some largish new applications beginning with BTrees 4 and using zc.catalog/zope.catalog/zope.index.

Our solution to the problem was to subclass Catalog and override the relevant methods where objects are added/updated in indexes and catch-and-ignore this TypeError[1]. Overall it wasn't really that onerous and was easy to fix once it cropped up, though it would be nice if it was handled out of the box. (Of course we wound up needing to sometimes handle other edge case exceptions for legacy reasons--yes, even in a new application; testers can get eventually very attached to their large, old, test DBs that have had botched migrations and botched distributed GCs---so we'd still have had to subclass eventually.)

Jason

[1] Mainly this means updateIndex. This is called from the IObjectAdded subscriber, and typically our objects have contracts that prevent a field from becoming None once's its been created, so it wasn't necessary to override index_doc which is called from the IObjectModified subscriber. YMMV, of course.

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.