[ZODB-Dev] newly introduced FileStorage bug?

Chris McDonough chrism@zope.com
Sun, 5 May 2002 20:26:56 -0400


I packed a FileStorage file (actually the Zope.org filestorage
file), and then attempted to open it on another system running
StandaloneZODB 1.0 directly after it was packed.  I think there is a
bug in the read_index function of FileStorage under StandaloneZODB
1.0 which caused the open to fail.  Here's what happened:

Traceback (most recent call last):
  File
"/home/zope/opt/Python2/lib/python2.1/site-packages/ZEO/start.py",
line 214, in main
    storages[n]=get_storage(m,a)
  File
"/home/zope/opt/Python2/lib/python2.1/site-packages/ZEO/start.py",
line 40, in get_storage
    im=imp.load_module(m, im[0], im[1], im[2])
  File "/home/zope/var/ZEOStorage/Storage.py", line 16, in ?
    OldZopeOrg =
ZODB.FileStorage.FileStorage('/home/zope/var/migration/var/Data.fs.o
ldzopeorg')
  File
"/home/zope/opt/Python2/lib/python2.1/site-packages/ZODB/FileStorage
.py", line 254, in __init__
    read_only=read_only,
  File
"/home/zope/opt/Python2/lib/python2.1/site-packages/ZODB/FileStorage
.py", line 2123, in read_index
    _maxoid = max(tindex.keys()) # in 2.2, just max(tindex)
ValueError: min() or max() arg is an empty sequence

It appears that it is possible for "tindex" to be empty.  I worked
around the problem by changing the line:

_maxoid = max(tindex.keys())

to

_maxoid = 0

..temporarily.  This worked ok.

Just FYI.  Sorry I'm just not going in and fixing it... I'm running
a bit short on time.

- C