[ZODB-Dev] Transaction note interface

Jim Fulton jim at zope.com
Wed Sep 1 10:26:53 EDT 2004


Tim Peters wrote:
> [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

This is important.  The limitation is in the storage.

This limitation allows us to save a couple of bytes in the transaction record.
IOW, it is silly. :(

 > 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.

This seems like as good an approach as any.

> There's also Transaction.setExtendedInfo().  I don't know why it exists,

It exists to allow application-defined transaction meta data.

We have pondered folding the user and descriotion fields into this some day.

 > 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.

I can think of a couple of possible hacks, but I doubt anyone has time for them.

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 ZODB-Dev mailing list