Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
4fb6aa13
Commit
4fb6aa13
authored
Aug 28, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug #126007.
parent
2d75896f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
NEWS.txt
NEWS.txt
+2
-1
src/ZODB/blob.py
src/ZODB/blob.py
+1
-1
src/ZODB/tests/blob_transaction.txt
src/ZODB/tests/blob_transaction.txt
+34
-1
No files found.
NEWS.txt
View file @
4fb6aa13
...
...
@@ -28,7 +28,8 @@ Transactions
Blobs
-----
-
- (3.9.0a1) Fixed bug #126007: tpc_abort had untested code path that was
broken.
BTrees
------
...
...
src/ZODB/blob.py
View file @
4fb6aa13
...
...
@@ -447,7 +447,7 @@ class BlobStorage(SpecificationDecoratorBase):
while
self
.
dirty_oids
:
oid
,
serial
=
self
.
dirty_oids
.
pop
()
clean
=
self
.
fshelper
.
getBlobFilename
(
oid
,
serial
)
if
os
.
exists
(
clean
):
if
os
.
path
.
exists
(
clean
):
remove_committed
(
clean
)
@
non_overridable
...
...
src/ZODB/tests/blob_transaction.txt
View file @
4fb6aa13
...
...
@@ -37,7 +37,7 @@ Putting a Blob into a Connection works like any other Persistent object::
>>> root1['blob1'] = blob1
>>> 'blob1' in root1
True
Aborting a blob add leaves the blob unchanged:
>>> transaction.abort()
...
...
@@ -310,6 +310,36 @@ You can't open a committed blob file for writing:
...
IOError: ...
tpc_abort with dirty data
-------------------------
When `tpc_abort` is called during the first commit phase we need to be able to
clean up dirty files:
>>> class DummyBaseStorage(object):
... def tpc_abort(self):
... pass
>>> base_storage = DummyBaseStorage()
>>> blob_dir2 = mkdtemp()
>>> blob_storage = BlobStorage(blob_dir2, base_storage)
>>> committed_blob_dir = os.path.join(blob_dir2, '0')
>>> committed_blob_file = os.path.join(committed_blob_dir, '0.blob')
>>> os.mkdir(committed_blob_dir)
>>> open(os.path.join(committed_blob_file), 'w').write('foo')
>>> os.path.exists(committed_blob_file)
True
Now, telling the storage that Blob 0 and Blob 1 (both with serial 0) are dirty
will: remove the committed file for Blob 0 and ignore the fact that Blob 1 is
set to dirty but doesn't actually have an existing file:
>>> blob_storage.dirty_oids = [(0, 0), (1, 0)]
>>> blob_storage.tpc_abort()
>>> os.path.exists(committed_blob_file)
False
Note: This is a counter measure against regression of bug #126007.
Teardown
--------
...
...
@@ -319,3 +349,6 @@ We don't need the storage directory and databases anymore::
>>> tm1.abort()
>>> tm2.abort()
>>> database.close()
>>> import shutil
>>> shutil.rmtree(blob_dir)
>>> shutil.rmtree(blob_dir2)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment