Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
6f077e60
Commit
6f077e60
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
8d9b2578
Changes
3
Hide 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 @
6f077e60
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
Bugs Fixed
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
- When using using a ClientStorage in a Storage server, there was a
threading bug that caused clients to get disconnected.
threading bug that caused clients to get disconnected.
...
...
src/ZODB/tests/testConnection.py
View file @
6f077e60
...
@@ -685,10 +685,26 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
...
@@ -685,10 +685,26 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
# sanity check
# sanity check
self
.
assert_
(
cache
.
total_estimated_size
>=
0
)
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
# ---- stubs
...
...
src/persistent/cPickleCache.c
View file @
6f077e60
...
@@ -668,7 +668,8 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
...
@@ -668,7 +668,8 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
PyObject
*
oid
;
PyObject
*
oid
;
cPersistentObject
*
v
;
cPersistentObject
*
v
;
unsigned
int
new_size
;
unsigned
int
new_size
;
if
(
!
PyArg_ParseTuple
(
args
,
"OI:updateObjectSizeEstimation"
,
&
oid
,
&
new_size
))
if
(
!
PyArg_ParseTuple
(
args
,
"OI:updateObjectSizeEstimation"
,
&
oid
,
&
new_size
))
return
NULL
;
return
NULL
;
/* Note: reference borrowed */
/* Note: reference borrowed */
v
=
(
cPersistentObject
*
)
PyDict_GetItem
(
self
->
data
,
oid
);
v
=
(
cPersistentObject
*
)
PyDict_GetItem
(
self
->
data
,
oid
);
...
@@ -680,8 +681,9 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
...
@@ -680,8 +681,9 @@ cc_update_object_size_estimation(ccobject *self, PyObject *args)
if
(
v
->
ring
.
r_next
)
if
(
v
->
ring
.
r_next
)
{
{
self
->
total_estimated_size
+=
_estimated_size_in_bytes
(
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
/* we do this in "Connection" as we need it even when the
object is not in the cache (or not the ring)
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