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
be5a10d0
Commit
be5a10d0
authored
Apr 18, 2002
by
Toby Dickenson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments
parent
15fee6ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
24 deletions
+81
-24
trunk/src/Persistence/cPickleCache.c
trunk/src/Persistence/cPickleCache.c
+27
-8
trunk/src/ZODB/cPickleCache.c
trunk/src/ZODB/cPickleCache.c
+27
-8
trunk/src/persistent/cPickleCache.c
trunk/src/persistent/cPickleCache.c
+27
-8
No files found.
trunk/src/Persistence/cPickleCache.c
View file @
be5a10d0
...
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.6
3 2002/04/18 09:18:26
htrd Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.6
4 2002/04/18 09:32:13
htrd Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -835,6 +835,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
jar
==
NULL
)
return
-
1
;
if
(
jar
==
Py_None
)
{
Py_DECREF
(
jar
);
PyErr_SetString
(
PyExc_ValueError
,
"Cached object jar missing"
);
return
-
1
;
...
...
@@ -975,11 +976,23 @@ static int
_ring_corrupt
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
/* Determine the number of objects we expect to see in the ring.
* Normally this is one for the home node plus one for each
* non-ghost object, for which we maintain a separate total. If the
* ring is unlocked then this value should be precise; there should
* be no foreign nodes in the ring. If locked, it may be an
* underestimate */
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
return
3
;
/* ring too big, by a large margin */
if
(
++
total
>
(
expected
+
10
))
/* ring too big, by a large margin. This probably
* means we are stomping through random memory. Abort
* now, and maybe we can deliver this error message
* before dumping core */
return
3
;
if
(
!
here
->
next
)
return
4
;
/* various linking problems */
if
(
!
here
->
prev
)
...
...
@@ -993,15 +1006,18 @@ _ring_corrupt(ccobject *self, const char *context)
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
/* If the ring must be locked, then it only contains
object other than persistent instances.
*/
/* If the ring is unlocked, then it must not contain
* objects other than persistent instances (and the home) */
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
/* ghost objects should not be in the ring, according
* to the ghost storage regime. Experience shows
* that this error condition is likely to be caused
* by a race condition bug somewhere */
return
13
;
}
}
...
...
@@ -1009,8 +1025,11 @@ _ring_corrupt(ccobject *self, const char *context)
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
if
(
total
<
expected
)
/* ring is too small.
too big is ok when locked, we have already checked it is
not too big */
return
6
;
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
...
...
trunk/src/ZODB/cPickleCache.c
View file @
be5a10d0
...
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.6
3 2002/04/18 09:18:26
htrd Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.6
4 2002/04/18 09:32:13
htrd Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -835,6 +835,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
jar
==
NULL
)
return
-
1
;
if
(
jar
==
Py_None
)
{
Py_DECREF
(
jar
);
PyErr_SetString
(
PyExc_ValueError
,
"Cached object jar missing"
);
return
-
1
;
...
...
@@ -975,11 +976,23 @@ static int
_ring_corrupt
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
/* Determine the number of objects we expect to see in the ring.
* Normally this is one for the home node plus one for each
* non-ghost object, for which we maintain a separate total. If the
* ring is unlocked then this value should be precise; there should
* be no foreign nodes in the ring. If locked, it may be an
* underestimate */
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
return
3
;
/* ring too big, by a large margin */
if
(
++
total
>
(
expected
+
10
))
/* ring too big, by a large margin. This probably
* means we are stomping through random memory. Abort
* now, and maybe we can deliver this error message
* before dumping core */
return
3
;
if
(
!
here
->
next
)
return
4
;
/* various linking problems */
if
(
!
here
->
prev
)
...
...
@@ -993,15 +1006,18 @@ _ring_corrupt(ccobject *self, const char *context)
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
/* If the ring must be locked, then it only contains
object other than persistent instances.
*/
/* If the ring is unlocked, then it must not contain
* objects other than persistent instances (and the home) */
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
/* ghost objects should not be in the ring, according
* to the ghost storage regime. Experience shows
* that this error condition is likely to be caused
* by a race condition bug somewhere */
return
13
;
}
}
...
...
@@ -1009,8 +1025,11 @@ _ring_corrupt(ccobject *self, const char *context)
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
if
(
total
<
expected
)
/* ring is too small.
too big is ok when locked, we have already checked it is
not too big */
return
6
;
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
...
...
trunk/src/persistent/cPickleCache.c
View file @
be5a10d0
...
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.6
3 2002/04/18 09:18:26
htrd Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.6
4 2002/04/18 09:32:13
htrd Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -835,6 +835,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
jar
==
NULL
)
return
-
1
;
if
(
jar
==
Py_None
)
{
Py_DECREF
(
jar
);
PyErr_SetString
(
PyExc_ValueError
,
"Cached object jar missing"
);
return
-
1
;
...
...
@@ -975,11 +976,23 @@ static int
_ring_corrupt
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
/* Determine the number of objects we expect to see in the ring.
* Normally this is one for the home node plus one for each
* non-ghost object, for which we maintain a separate total. If the
* ring is unlocked then this value should be precise; there should
* be no foreign nodes in the ring. If locked, it may be an
* underestimate */
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
return
3
;
/* ring too big, by a large margin */
if
(
++
total
>
(
expected
+
10
))
/* ring too big, by a large margin. This probably
* means we are stomping through random memory. Abort
* now, and maybe we can deliver this error message
* before dumping core */
return
3
;
if
(
!
here
->
next
)
return
4
;
/* various linking problems */
if
(
!
here
->
prev
)
...
...
@@ -993,15 +1006,18 @@ _ring_corrupt(ccobject *self, const char *context)
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
/* If the ring must be locked, then it only contains
object other than persistent instances.
*/
/* If the ring is unlocked, then it must not contain
* objects other than persistent instances (and the home) */
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
/* ghost objects should not be in the ring, according
* to the ghost storage regime. Experience shows
* that this error condition is likely to be caused
* by a race condition bug somewhere */
return
13
;
}
}
...
...
@@ -1009,8 +1025,11 @@ _ring_corrupt(ccobject *self, const char *context)
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
if
(
total
<
expected
)
/* ring is too small.
too big is ok when locked, we have already checked it is
not too big */
return
6
;
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
...
...
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