[ZODB-Dev] Timeout in UndoSearch

Brian R Brinegar brinegar at ecn.purdue.edu
Wed Jan 14 13:05:30 EST 2004


Hello,

A while back I brought this up, but to the best of my knowledge it was 
never resolved. Currently when someone clicks the Undo tab in the ZMI an 
UndoSearch is created and runs until it finds a certain number of 
transactions for the current object, or reaches the beginning of the 
database.

We run a Zope instance with a 14 gig FileStorage. If there have only 
been a few transactions in recent history clicking the Undo tab can take 
10+ minutes. In order to make Undo a useful tool each time an new 
FileStorage is released we patch it to search until it finds a certain 
number of transactions or reaches a timeout.

I propose this is added to the standard zope distribution, the timeout 
should probably be set in an environment variable or something, it would 
also be nice if as you click "earlier transactions" the timeout would 
increase, but that may be more work than it's worth.

The patch is two lines. I've included the modified methods below. Does 
anyone else have the same problem? Is this something that should be 
included in FileStorage?

Thanks,
-Brian

class UndoSearch:

     def __init__(self, file, pos, packt, first, last, filter=None):
         self.file = file
         self.pos = pos
         self.packt = packt
         self.first = first
         self.last = last
         self.filter = filter
         self.i = 0
         self.results = []
         self.stop = 0
         self.starttime = time.time()

     def finished(self):
         """Return True if UndoSearch has found enough records."""
         # BAW: Why 39 please?  This makes no sense (see also below).
         return time.time() - self.starttime > UNDOLOG_MAX_RUNTIME or 
self.i >= self.last or self.pos < 39 or self.stop



More information about the ZODB-Dev mailing list