Commit 9f64b841 authored by Thomas Lotze's avatar Thomas Lotze

Fixed bug in transaction buffer: a tuple was unpacked incorrectly in [H[2J.

parent bf476281
...@@ -35,6 +35,9 @@ New Features ...@@ -35,6 +35,9 @@ New Features
Bugs Fixed Bugs Fixed
---------- ----------
- Fixed bug in transaction buffer: a tuple was unpacked incorrectly in
`clear`.
- Bugfix the situation in which comparing persistent objects (for - Bugfix the situation in which comparing persistent objects (for
instance, as members in BTree set or keys of BTree) might cause data instance, as members in BTree set or keys of BTree) might cause data
inconsistency during conflict resolution. inconsistency during conflict resolution.
......
...@@ -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
...@@ -113,7 +114,7 @@ class TransactionBuffer: ...@@ -113,7 +114,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:
......
...@@ -547,6 +547,17 @@ class CommonBlobTests: ...@@ -547,6 +547,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