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
2db52418
Commit
2db52418
authored
Aug 29, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug 129921
parent
4fb6aa13
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
NEWS.txt
NEWS.txt
+3
-0
src/ZODB/blob.py
src/ZODB/blob.py
+4
-2
src/ZODB/tests/blob_transaction.txt
src/ZODB/tests/blob_transaction.txt
+18
-3
No files found.
NEWS.txt
View file @
2db52418
...
...
@@ -31,6 +31,9 @@ Blobs
- (3.9.0a1) Fixed bug #126007: tpc_abort had untested code path that was
broken.
- (3.9.0a1) Fixed bug #129921: getSize() function in BlobStorage could not
deal with garbage files
BTrees
------
...
...
src/ZODB/blob.py
View file @
2db52418
...
...
@@ -544,11 +544,13 @@ class BlobStorage(SpecificationDecoratorBase):
def
getSize
(
self
):
"""Return the size of the database in bytes."""
orig_size
=
getProxiedObject
(
self
).
getSize
()
blob_size
=
0
base_dir
=
self
.
fshelper
.
base_dir
for
oid
in
os
.
listdir
(
base_dir
):
for
serial
in
os
.
listdir
(
os
.
path
.
join
(
base_dir
,
oid
)):
sub_dir
=
os
.
path
.
join
(
base_dir
,
oid
)
if
not
os
.
path
.
isdir
(
sub_dir
):
continue
for
serial
in
os
.
listdir
(
sub_dir
):
if
not
serial
.
endswith
(
BLOB_SUFFIX
):
continue
file_path
=
os
.
path
.
join
(
base_dir
,
oid
,
serial
)
...
...
src/ZODB/tests/blob_transaction.txt
View file @
2db52418
...
...
@@ -321,7 +321,7 @@ clean up dirty files:
... pass
>>> base_storage = DummyBaseStorage()
>>> blob_dir2 = mkdtemp()
>>> blob_storage = BlobStorage(blob_dir2, base_storage)
>>> blob_storage
2
= 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)
...
...
@@ -333,14 +333,29 @@ 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()
>>> blob_storage
2
.dirty_oids = [(0, 0), (1, 0)]
>>> blob_storage
2
.tpc_abort()
>>> os.path.exists(committed_blob_file)
False
Note: This is a counter measure against regression of bug #126007.
getSize with garbage in the directory structure
-----------------------------------------------
`getSize` iterates over the existing blob files in the blob directory and adds
up their size. The blob directory sometimes contains temporary files that the
getSize function needs to ignore:
>>> garbage_file = os.path.join(blob_dir, 'garbage')
>>> open(garbage_file, 'w').write('garbage')
>>> int(blob_storage.getSize())
881
Note: This is a counter measer against regression of bug #12991.
Teardown
--------
...
...
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