Commit c711cf53 authored by Tim Peters's avatar Tim Peters

loadBefore(): This forgot to acquire the lock. That's a clear bug.

However, fixing it so far *appears* to fix a bunch of shy FileStorage
pack[Now]WhileWriting test failures whose connection to loadBefore()
isn't obvious.  It's plausible that it's a real fix for those, just
not (yet) compelling.  It seems very likely to be a real fix for very
rare failures that have shown up only in ChrisM's overnight testrunner
reports (because those did have stuff related to loadBefore() in their
tracebacks).
parent 975214e8
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Storage implementation using a log written to a single file. """Storage implementation using a log written to a single file.
$Revision: 1.4 $ $Revision: 1.5 $
""" """
import base64 import base64
...@@ -589,6 +589,8 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -589,6 +589,8 @@ class FileStorage(BaseStorage.BaseStorage,
self._lock_release() self._lock_release()
def loadBefore(self, oid, tid): def loadBefore(self, oid, tid):
self._lock_acquire()
try:
pos = self._lookup_pos(oid) pos = self._lookup_pos(oid)
end_tid = None end_tid = None
while True: while True:
...@@ -619,6 +621,9 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -619,6 +621,9 @@ class FileStorage(BaseStorage.BaseStorage,
else: else:
return self._file.read(h.plen), h.tid, end_tid return self._file.read(h.plen), h.tid, end_tid
finally:
self._lock_release()
def modifiedInVersion(self, oid): def modifiedInVersion(self, oid):
self._lock_acquire() self._lock_acquire()
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment