[ZODB-Dev] new user questions
Jim Fulton
jim at zope.com
Wed Nov 26 08:35:53 EST 2008
On Nov 25, 2008, at 3:28 PM, richrad miller wrote:
> Two questions from a new user
>
> I am running UBUNTU 8.04
>
> 1. If I open a zodb file and (Ctrl)c the process, I receive the
> following message on trying to reopen the file. Is there a way to
> recover ?
>
> Traceback (most recent call last):
> File "show_rate.py", line 298, in <module>
> zdb = zodbmod.WorkZodb('/work/tmp/zdb/rates.fs','old')
> File "/work/python/modules/zodbmod.py", line 12, in __init__
> self.storage = FileStorage.FileStorage(self.path)
> File
> "/usr/lib/python2.5/site-packages/ZODB3-3.8.1b7-py2.5-linux-i686.egg/
> ZODB/FileStorage/FileStorage.py", line 115, in __init__
> self._lock_file = LockFile(file_name + '.lock')
> File
> "/usr/lib/python2.5/site-packages/ZODB3-3.8.1b7-py2.5-linux-i686.egg/
> ZODB/lock_file.py", line 86, in __init__
> raise
> File
> "/usr/lib/python2.5/site-packages/ZODB3-3.8.1b7-py2.5-linux-i686.egg/
> ZODB/lock_file.py", line 80, in __init__
> _lock_file(fp)
> File
> "/usr/lib/python2.5/site-packages/ZODB3-3.8.1b7-py2.5-linux-i686.egg/
> ZODB/lock_file.py", line 59, in _lock_file
> raise LockError("Couldn't lock %r" % file.name)
> LockError: Couldn't lock '/work/tmp/zdb/rates.fs.lock'
Normally, exiting the process will free the lock. As someone else
suggested, you can try removing the lock file.
As Andreas pointed out, it is usually a good idea to use ZEO so you
can have multiple application processes
share a single database.
> 2. Is there a way to open a zodb file in "read only" mode.
It depends on the storage, but both FileStorage and ZEO support a
read_only option. In the case of a file storage, opening it read-only
doesn't require acquiring the lock.
Jim
--
Jim Fulton
Zope Corporation
More information about the ZODB-Dev
mailing list