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
19bf8256
Commit
19bf8256
authored
Aug 29, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug #129921.
parent
8f32f81f
Changes
3
Hide 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 @
19bf8256
...
@@ -82,6 +82,9 @@ Blobs
...
@@ -82,6 +82,9 @@ Blobs
- (3.8b3) Fixed bug #126007: tpc_abort had untested code path that was
- (3.8b3) Fixed bug #126007: tpc_abort had untested code path that was
broken.
broken.
- (3.8b3) Fixed bug #129921: getSize() function in BlobStorage could not
deal with garbage files
- (3.8b1) Updated the Blob implementation in a number of ways. Some
- (3.8b1) Updated the Blob implementation in a number of ways. Some
of these are backward incompatible with 3.8a1:
of these are backward incompatible with 3.8a1:
...
...
src/ZODB/blob.py
View file @
19bf8256
...
@@ -544,11 +544,13 @@ class BlobStorage(SpecificationDecoratorBase):
...
@@ -544,11 +544,13 @@ class BlobStorage(SpecificationDecoratorBase):
def
getSize
(
self
):
def
getSize
(
self
):
"""Return the size of the database in bytes."""
"""Return the size of the database in bytes."""
orig_size
=
getProxiedObject
(
self
).
getSize
()
orig_size
=
getProxiedObject
(
self
).
getSize
()
blob_size
=
0
blob_size
=
0
base_dir
=
self
.
fshelper
.
base_dir
base_dir
=
self
.
fshelper
.
base_dir
for
oid
in
os
.
listdir
(
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
):
if
not
serial
.
endswith
(
BLOB_SUFFIX
):
continue
continue
file_path
=
os
.
path
.
join
(
base_dir
,
oid
,
serial
)
file_path
=
os
.
path
.
join
(
base_dir
,
oid
,
serial
)
...
...
src/ZODB/tests/blob_transaction.txt
View file @
19bf8256
...
@@ -321,7 +321,7 @@ clean up dirty files:
...
@@ -321,7 +321,7 @@ clean up dirty files:
... pass
... pass
>>> base_storage = DummyBaseStorage()
>>> base_storage = DummyBaseStorage()
>>> blob_dir2 = mkdtemp()
>>> 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_dir = os.path.join(blob_dir2, '0')
>>> committed_blob_file = os.path.join(committed_blob_dir, '0.blob')
>>> committed_blob_file = os.path.join(committed_blob_dir, '0.blob')
>>> os.mkdir(committed_blob_dir)
>>> 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
...
@@ -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
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:
set to dirty but doesn't actually have an existing file:
>>> blob_storage.dirty_oids = [(0, 0), (1, 0)]
>>> blob_storage
2
.dirty_oids = [(0, 0), (1, 0)]
>>> blob_storage.tpc_abort()
>>> blob_storage
2
.tpc_abort()
>>> os.path.exists(committed_blob_file)
>>> os.path.exists(committed_blob_file)
False
False
Note: This is a counter measure against regression of bug #126007.
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
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