Commit bcd38ab5 authored by Christian Theune's avatar Christian Theune

Fixed bug in transaction buffer: a tuple was unpackged incorrectly in `clear`.

(backport from trunk)
parent 600b4696
...@@ -33,6 +33,9 @@ General ...@@ -33,6 +33,9 @@ General
ZEO ZEO
--- ---
- (???) Fixed bug in transaction buffer: a tuple was unpackged incorrectly in
`clear`.
- (???) Fixed bug in blob filesystem helper: the `isSecure` check was inversed. - (???) Fixed bug in blob filesystem helper: the `isSecure` check was inversed.
- (3.8.0b6) Bug #98275: Made ZEO cache more tolerant when invalidating current - (3.8.0b6) Bug #98275: Made ZEO cache more tolerant when invalidating current
......
...@@ -21,6 +21,7 @@ is used to store the data until a commit or abort. ...@@ -21,6 +21,7 @@ is used to store the data until a commit or abort.
# A faster implementation might store trans data in memory until it # A faster implementation might store trans data in memory until it
# reaches a certain size. # reaches a certain size.
import os
import cPickle import cPickle
import tempfile import tempfile
from threading import Lock from threading import Lock
...@@ -119,7 +120,7 @@ class TransactionBuffer: ...@@ -119,7 +120,7 @@ class TransactionBuffer:
self.count = 0 self.count = 0
self.size = 0 self.size = 0
while self.blobs: while self.blobs:
oid, serial, blobfilename = self.blobs.pop() oid, blobfilename = self.blobs.pop()
if os.path.exists(blobfilename): if os.path.exists(blobfilename):
os.remove(blobfilename) os.remove(blobfilename)
finally: finally:
......
...@@ -568,6 +568,17 @@ class CommonBlobTests: ...@@ -568,6 +568,17 @@ class CommonBlobTests:
self.assertEquals(self.blob_cache_dir, self.assertEquals(self.blob_cache_dir,
self._storage.temporaryDirectory()) self._storage.temporaryDirectory())
def checkTransactionBufferCleanup(self):
oid = self._storage.new_oid()
handle, blob_file_name = tempfile.mkstemp() #XXX cleanup temp file
open(blob_file_name, 'w').write('I am a happy blob.')
t = transaction.Transaction()
self._storage.tpc_begin(t)
self._storage.storeBlob(
oid, ZODB.utils.z64, 'foo', blob_file_name, '', t)
self._storage.close()
class BlobAdaptedFileStorageTests(GenericTests, CommonBlobTests): class BlobAdaptedFileStorageTests(GenericTests, CommonBlobTests):
"""ZEO backed by a BlobStorage-adapted FileStorage.""" """ZEO backed by a BlobStorage-adapted FileStorage."""
......
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