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
f0b83f75
Commit
f0b83f75
authored
Apr 20, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an egregious bug that caused caches to fail when run with an
optimized Python. :(
parent
e95d0635
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
+31
-20
src/ZEO/cache.py
src/ZEO/cache.py
+31
-20
No files found.
src/ZEO/cache.py
View file @
f0b83f75
...
@@ -471,7 +471,8 @@ class ClientCache(object):
...
@@ -471,7 +471,8 @@ class ClientCache(object):
return
None
return
None
self
.
f
.
seek
(
ofs
)
self
.
f
.
seek
(
ofs
)
read
=
self
.
f
.
read
read
=
self
.
f
.
read
assert
read
(
1
)
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
status
=
read
(
1
)
assert
status
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
size
,
saved_oid
,
tid
,
end_tid
,
lver
,
ldata
=
unpack
(
size
,
saved_oid
,
tid
,
end_tid
,
lver
,
ldata
=
unpack
(
">I8s8s8sHI"
,
read
(
34
))
">I8s8s8sHI"
,
read
(
34
))
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
...
@@ -479,6 +480,9 @@ class ClientCache(object):
...
@@ -479,6 +480,9 @@ class ClientCache(object):
data
=
read
(
ldata
)
data
=
read
(
ldata
)
assert
len
(
data
)
==
ldata
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
len
(
data
),
ldata
)
assert
len
(
data
)
==
ldata
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
len
(
data
),
ldata
)
# WARNING: The following assert changes the file position.
# We must not depend on ths below or we'll fail in optimized mode.
assert
read
(
8
)
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
assert
read
(
8
)
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
self
.
_n_accesses
+=
1
self
.
_n_accesses
+=
1
...
@@ -507,7 +511,8 @@ class ClientCache(object):
...
@@ -507,7 +511,8 @@ class ClientCache(object):
self
.
f
.
seek
(
ofs
)
self
.
f
.
seek
(
ofs
)
read
=
self
.
f
.
read
read
=
self
.
f
.
read
assert
read
(
1
)
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
before_tid
)
status
=
read
(
1
)
assert
status
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
before_tid
)
size
,
saved_oid
,
saved_tid
,
end_tid
,
lver
,
ldata
=
unpack
(
size
,
saved_oid
,
saved_tid
,
end_tid
,
lver
,
ldata
=
unpack
(
">I8s8s8sHI"
,
read
(
34
))
">I8s8s8sHI"
,
read
(
34
))
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
...
@@ -516,6 +521,9 @@ class ClientCache(object):
...
@@ -516,6 +521,9 @@ class ClientCache(object):
assert
lver
==
0
,
"Versions aren't supported"
assert
lver
==
0
,
"Versions aren't supported"
data
=
read
(
ldata
)
data
=
read
(
ldata
)
assert
len
(
data
)
==
ldata
,
(
ofs
,
self
.
f
.
tell
())
assert
len
(
data
)
==
ldata
,
(
ofs
,
self
.
f
.
tell
())
# WARNING: The following assert changes the file position.
# We must not depend on ths below or we'll fail in optimized mode.
assert
read
(
8
)
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
assert
read
(
8
)
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
if
end_tid
<
before_tid
:
if
end_tid
<
before_tid
:
...
@@ -543,7 +551,8 @@ class ClientCache(object):
...
@@ -543,7 +551,8 @@ class ClientCache(object):
if
ofs
:
if
ofs
:
seek
(
ofs
)
seek
(
ofs
)
read
=
self
.
f
.
read
read
=
self
.
f
.
read
assert
read
(
1
)
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
status
=
read
(
1
)
assert
status
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
size
,
saved_oid
,
saved_tid
,
end_tid
=
unpack
(
size
,
saved_oid
,
saved_tid
,
end_tid
=
unpack
(
">I8s8s8s"
,
read
(
28
))
">I8s8s8s"
,
read
(
28
))
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
...
@@ -655,7 +664,8 @@ class ClientCache(object):
...
@@ -655,7 +664,8 @@ class ClientCache(object):
self
.
f
.
seek
(
ofs
)
self
.
f
.
seek
(
ofs
)
read
=
self
.
f
.
read
read
=
self
.
f
.
read
assert
read
(
1
)
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
status
=
read
(
1
)
assert
status
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
size
,
saved_oid
,
saved_tid
,
end_tid
=
unpack
(
">I8s8s8s"
,
read
(
28
))
size
,
saved_oid
,
saved_tid
,
end_tid
=
unpack
(
">I8s8s8s"
,
read
(
28
))
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
end_tid
==
z64
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
assert
end_tid
==
z64
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
...
@@ -685,7 +695,8 @@ class ClientCache(object):
...
@@ -685,7 +695,8 @@ class ClientCache(object):
self
.
_lock
.
acquire
()
self
.
_lock
.
acquire
()
try
:
try
:
seek
(
ofs
)
seek
(
ofs
)
assert
read
(
1
)
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
status
=
read
(
1
)
assert
status
==
'a'
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
size
,
saved_oid
,
tid
,
end_tid
=
unpack
(
">I8s8s8s"
,
read
(
28
))
size
,
saved_oid
,
tid
,
end_tid
=
unpack
(
">I8s8s8s"
,
read
(
28
))
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
saved_oid
==
oid
,
(
ofs
,
self
.
f
.
tell
(),
oid
,
saved_oid
)
assert
end_tid
==
z64
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
assert
end_tid
==
z64
,
(
ofs
,
self
.
f
.
tell
(),
oid
)
...
...
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