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
b2ec9b58
Commit
b2ec9b58
authored
Mar 23, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forward ported r109789, r110123-110124 from 3.9 branch to trunk
parent
181b01cb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
src/CHANGES.txt
src/CHANGES.txt
+3
-0
src/ZODB/tests/testConnection.py
src/ZODB/tests/testConnection.py
+20
-4
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+5
-3
No files found.
src/CHANGES.txt
View file @
b2ec9b58
...
...
@@ -8,6 +8,9 @@
Bugs Fixed
----------
- Fixed bug in cPickleCache's byte size estimation logic.
(https://bugs.launchpad.net/zodb/+bug/533015)
- When using using a ClientStorage in a Storage server, there was a
threading bug that caused clients to get disconnected.
...
...
src/ZODB/tests/testConnection.py
View file @
b2ec9b58
...
...
@@ -685,10 +685,26 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
# sanity check
self
.
assert_
(
cache
.
total_estimated_size
>=
0
)
def
test_cache_garbage_collection_shrinking_object
(
self
):
db
=
self
.
db
# activate size based cache garbage collection
db
.
setCacheSizeBytes
(
1000
)
obj
,
conn
,
cache
=
self
.
obj
,
self
.
conn
,
self
.
conn
.
_cache
# verify the change worked as expected
self
.
assertEqual
(
cache
.
cache_size_bytes
,
1000
)
# verify our entrance assumption is fullfilled
self
.
assert_
(
cache
.
total_estimated_size
>
1
)
# give the objects some size
obj
.
setValueWithSize
(
500
)
transaction
.
savepoint
()
self
.
assert_
(
cache
.
total_estimated_size
>
500
)
# make the object smaller
obj
.
setValueWithSize
(
100
)
transaction
.
savepoint
()
# make sure there was no overflow
self
.
assert_
(
cache
.
total_estimated_size
!=
0
)
# the size is not larger than the allowed maximum
self
.
assert_
(
cache
.
total_estimated_size
<=
1000
)
# ---- stubs
...
...
src/persistent/cPickleCache.c
View file @
b2ec9b58
...
...
@@ -668,7 +668,8 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
PyObject
*
oid
;
cPersistentObject
*
v
;
unsigned
int
new_size
;
if
(
!
PyArg_ParseTuple
(
args
,
"OI:updateObjectSizeEstimation"
,
&
oid
,
&
new_size
))
if
(
!
PyArg_ParseTuple
(
args
,
"OI:updateObjectSizeEstimation"
,
&
oid
,
&
new_size
))
return
NULL
;
/* Note: reference borrowed */
v
=
(
cPersistentObject
*
)
PyDict_GetItem
(
self
->
data
,
oid
);
...
...
@@ -680,7 +681,8 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
if
(
v
->
ring
.
r_next
)
{
self
->
total_estimated_size
+=
_estimated_size_in_bytes
(
_estimated_size_in_24_bits
(
new_size
)
-
v
->
estimated_size
(
int
)(
_estimated_size_in_24_bits
(
new_size
))
-
(
int
)(
v
->
estimated_size
)
);
/* we do this in "Connection" as we need it even when the
object is not in the cache (or not the ring)
...
...
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