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
Kirill Smelkov
ZODB
Commits
8f32f81f
Commit
8f32f81f
authored
Aug 28, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backported fix for bug #126007.
parent
a3d73055
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
NEWS.txt
NEWS.txt
+3
-0
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 @
8f32f81f
...
...
@@ -79,6 +79,9 @@ Transactions
Blobs
-----
- (3.8b3) Fixed bug #126007: tpc_abort had untested code path that was
broken.
- (3.8b1) Updated the Blob implementation in a number of ways. Some
of these are backward incompatible with 3.8a1:
...
...
src/ZODB/blob.py
View file @
8f32f81f
...
...
@@ -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 @
8f32f81f
...
...
@@ -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