[ZODB-Dev] ZEO, FileStorage, and Undo
Shane Hathaway
shane@zope.com
Thu, 22 Aug 2002 12:12:58 -0400
Jeremy Hylton wrote:
> Yes. Every FileStorage method that reads the database needs to hold
> the lock to protect the file position. The read-only methods call
> seek() and read() on the file object. If two read-only methods
> executed at the same time, there's no guarantee they would read the
> data they wanted to read.
Alternatively, could undoLog() open its own file (pointed to the same
filename, but opened read-only) to do the scanning?
> I think we could change the search process so that acquire and
> released the lock for each transaction. That might make the undo a
> lot slower, but it would also allow other threads to make progress
> while undoLog() is running. To implement this, we'd need to modify
> FileStorage to change its lock behavior and ZEO to run undoLog() in a
> separate thread. These both sound easy. If I sent you a patch, would
> you want to give it a try?
If you go ahead with this method, you could avoid the performance hit by
releasing and reacquiring the lock every 20 transactions or so.
Shane