[Zodb-checkins] SVN: ZODB/trunk/src/ fix a small bug in the file locking error logging
Benji York
benji at zope.com
Fri Sep 26 15:07:58 EDT 2008
Log message for revision 91533:
fix a small bug in the file locking error logging
Changed:
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZODB/lock_file.py
U ZODB/trunk/src/ZODB/lock_file.txt
-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2008-09-26 15:58:54 UTC (rev 91532)
+++ ZODB/trunk/src/CHANGES.txt 2008-09-26 19:07:56 UTC (rev 91533)
@@ -109,11 +109,19 @@
- Fixed bug in ClientCache that occurred with objects larger than the total
cache size.
-3.8.1b8 (2008-09-??)
+3.8.1b9 (2008-??-??)
====================
Bugs Fixed:
+- When an error occured attempting to lock a file and logging of said error was
+ enabled.
+
+3.8.1b8 (2008-09-22
+====================
+
+Bugs Fixed:
+
- FileStorages previously saved indexes after a certain
number of writes. This was done during the last phase of two-phase
commit, which made this critical phase more subject to errors than
Modified: ZODB/trunk/src/ZODB/lock_file.py
===================================================================
--- ZODB/trunk/src/ZODB/lock_file.py 2008-09-26 15:58:54 UTC (rev 91532)
+++ ZODB/trunk/src/ZODB/lock_file.py 2008-09-26 19:07:56 UTC (rev 91533)
@@ -82,7 +82,9 @@
fp.seek(1)
pid = fp.read().strip()[:20]
fp.close()
- logger.exception("Error locking file", path, pid)
+ if not pid:
+ pid = 'UNKNOWN'
+ logger.exception("Error locking file %s; pid=%s", path, pid)
raise
self._fp = fp
Modified: ZODB/trunk/src/ZODB/lock_file.txt
===================================================================
--- ZODB/trunk/src/ZODB/lock_file.txt 2008-09-26 15:58:54 UTC (rev 91532)
+++ ZODB/trunk/src/ZODB/lock_file.txt 2008-09-26 19:07:56 UTC (rev 91533)
@@ -9,14 +9,20 @@
>>> import ZODB.lock_file
>>> lock = ZODB.lock_file.LockFile('lock')
-If we try to lock the same name, we'll get a lock error:
+If we try to lock the same name, we'll get a lock error and it will be logged:
+ >>> import ZODB.tests.loggingsupport
+ >>> handler = ZODB.tests.loggingsupport.InstalledHandler('ZODB.lock_file')
>>> try:
... ZODB.lock_file.LockFile('lock')
... except ZODB.lock_file.LockError:
... print "Can't lock file"
Can't lock file
+ >>> for record in handler.records:
+ ... print record.levelname, record.getMessage()
+ ERROR Error locking file lock; pid=UNKNOWN
+
To release the lock, use it's close method:
>>> lock.close()
More information about the Zodb-checkins
mailing list