[ZODB-Dev] Transaction note interface

Tim Peters tim at zope.com
Tue Aug 31 14:13:09 EDT 2004


[Christian Theune]
> I just ran into a problem forcing me to programm around the API for
> transactions. A very long running transaction created a lot of notes for
> it going over the 65k limit. I now need to to
>
> get_transaction().description = 'my short note'
>
> to be able to commit this transaction in FileStorage.
>
> What about giving note() an optional parameter to not append the note,
> but set the note to this exact value?

We could, but it doesn't seem to address the original problem.  That is, you
would still have no way to guess in advance whether the accumulated notes
are "too big".

It's clear from the implementation that notes() doesn't expect to see more
than a few relatively short strings per transaction (the implementation
requires time quadratic in the number of notes added in a transaction).
Maybe it would be better if storages with a limit on description size
automatically cut back (presumably rare) over-long descriptions instead of
raising an exception long after it's too late for the user to "do something"
about that.  Ditto for the user metadata.

There's also Transaction.setExtendedInfo().  I don't know why it exists, and
it appears Zope never uses it.  It creates a dict under the covers, and that
also gripes if the pickle of the dict is >= 64KB.  If anything does use
this, auto-reducing its size probably isn't justifiable.  I'm not sure
anyone would care if FileStorage cut arbitrary stuff out of a giant
description or user path.




More information about the ZODB-Dev mailing list