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
nexedi
ZODB
Commits
9070f8e2
Commit
9070f8e2
authored
Aug 29, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complain if server invalidations are applied out of order.
parent
2b62301d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
9 deletions
+23
-9
src/ZEO/cache.py
src/ZEO/cache.py
+20
-5
src/ZEO/tests/test_cache.py
src/ZEO/tests/test_cache.py
+3
-4
No files found.
src/ZEO/cache.py
View file @
9070f8e2
...
@@ -555,13 +555,28 @@ class ClientCache(object):
...
@@ -555,13 +555,28 @@ class ClientCache(object):
# data for `oid`, stop believing we have current data, and mark the
# data for `oid`, stop believing we have current data, and mark the
# data we had as being valid only up to `tid`. In all other cases, do
# data we had as being valid only up to `tid`. In all other cases, do
# nothing.
# nothing.
# @param oid object id
#
# @param tid the id of the transaction that wrote a new revision of oid,
# Paramters:
#
# - oid object id
# - tid the id of the transaction that wrote a new revision of oid,
# or None to forget all cached info about oid.
# or None to forget all cached info about oid.
# - server_invalidation, a flag indicating whether the
# invalidation has come from the server. It's possible, due
# to threading issues, that when applying a local
# invalidation after a store, that later invalidations from
# the server may already have arrived.
@
locked
@
locked
def
invalidate
(
self
,
oid
,
tid
):
def
invalidate
(
self
,
oid
,
tid
,
server_invalidation
=
True
):
if
tid
>
self
.
tid
and
tid
is
not
None
:
if
tid
is
not
None
:
self
.
setLastTid
(
tid
)
if
tid
>
self
.
tid
:
self
.
setLastTid
(
tid
)
elif
tid
<
self
.
tid
:
if
server_invalidation
:
raise
ValueError
(
"invalidation tid (%s) must not be less"
" than previous one (%s)"
%
(
u64
(
tid
),
u64
(
self
.
tid
)))
ofs
=
self
.
current
.
get
(
oid
)
ofs
=
self
.
current
.
get
(
oid
)
if
ofs
is
None
:
if
ofs
is
None
:
...
...
src/ZEO/tests/test_cache.py
View file @
9070f8e2
...
@@ -76,8 +76,6 @@ class CacheTests(unittest.TestCase):
...
@@ -76,8 +76,6 @@ class CacheTests(unittest.TestCase):
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
None
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
None
)
self
.
cache
.
setLastTid
(
n2
)
self
.
cache
.
setLastTid
(
n2
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n2
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n2
)
self
.
cache
.
invalidate
(
n1
,
n1
)
self
.
cache
.
invalidate
(
n1
,
n1
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n2
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n2
)
self
.
cache
.
invalidate
(
n1
,
n3
)
self
.
cache
.
invalidate
(
n1
,
n3
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n3
)
self
.
assertEqual
(
self
.
cache
.
getLastTid
(),
n3
)
...
@@ -92,10 +90,11 @@ class CacheTests(unittest.TestCase):
...
@@ -92,10 +90,11 @@ class CacheTests(unittest.TestCase):
def
testInvalidate
(
self
):
def
testInvalidate
(
self
):
data1
=
"data for n1"
data1
=
"data for n1"
self
.
cache
.
store
(
n1
,
n3
,
None
,
data1
)
self
.
cache
.
store
(
n1
,
n3
,
None
,
data1
)
self
.
cache
.
invalidate
(
n1
,
n4
)
self
.
cache
.
invalidate
(
n2
,
n2
)
self
.
cache
.
invalidate
(
n2
,
n2
)
self
.
cache
.
invalidate
(
n1
,
n4
)
self
.
assertEqual
(
self
.
cache
.
load
(
n1
),
None
)
self
.
assertEqual
(
self
.
cache
.
load
(
n1
),
None
)
self
.
assertEqual
(
self
.
cache
.
loadBefore
(
n1
,
n4
),
(
data1
,
n3
,
n4
))
self
.
assertEqual
(
self
.
cache
.
loadBefore
(
n1
,
n4
),
(
data1
,
n3
,
n4
))
def
testNonCurrent
(
self
):
def
testNonCurrent
(
self
):
data1
=
"data for n1"
data1
=
"data for n1"
...
...
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