Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
Commits
896900f1
Commit
896900f1
authored
Jul 23, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! client: fix cache invalidation during a load from a storage for the same oid
parent
20628341
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
neo/client/cache.py
neo/client/cache.py
+9
-6
neo/client/handlers/master.py
neo/client/handlers/master.py
+5
-10
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+3
-2
No files found.
neo/client/cache.py
View file @
896900f1
...
...
@@ -225,7 +225,11 @@ class ClientCache(object):
def
invalidate
(
self
,
oid
,
tid
):
"""Mark data record as being valid only up to given tid"""
try
:
item
=
self
.
_oid_dict
[
oid
][
-
1
]
except
KeyError
:
pass
else
:
if
item
.
next_tid
is
None
:
item
.
next_tid
=
tid
else
:
...
...
@@ -236,10 +240,9 @@ def test(self):
cache
=
ClientCache
()
self
.
assertEqual
(
cache
.
load
(
1
,
10
),
None
)
self
.
assertEqual
(
cache
.
load
(
1
,
None
),
None
)
self
.
assertRaises
(
KeyError
,
cache
.
invalidate
,
1
,
10
)
cache
.
invalidate
(
1
,
10
)
data
=
'5'
,
5
,
10
# 2 identical stores happens if 2 threads got a cache miss at the same time
# (which currently never happens in NEO, due to a lock)
cache
.
store
(
1
,
*
data
)
cache
.
store
(
1
,
*
data
)
self
.
assertEqual
(
cache
.
load
(
1
,
10
),
data
)
...
...
neo/client/handlers/master.py
View file @
896900f1
...
...
@@ -110,10 +110,7 @@ class PrimaryNotificationsHandler(BaseHandler):
# was modified).
continue
# Update ex-latest value in cache
try
:
cache
.
invalidate
(
oid
,
tid
)
except
KeyError
:
pass
if
data
is
not
None
:
# Store in cache with no next_tid
cache
.
store
(
oid
,
data
,
tid
,
None
)
...
...
@@ -142,9 +139,7 @@ class PrimaryNotificationsHandler(BaseHandler):
invalidate
=
app
.
_cache
.
invalidate
loading
=
app
.
_loading_oid
for
oid
in
oid_list
:
try
:
invalidate
(
oid
,
tid
)
except
KeyError
:
if
oid
==
loading
:
app
.
_loading_oid
=
None
app
.
_loading_invalidated
=
tid
...
...
neo/tests/threaded/test.py
View file @
896900f1
...
...
@@ -538,6 +538,7 @@ class Test(NEOThreadedTest):
cluster
=
NEOCluster
()
try
:
cluster
.
start
()
cache
=
cluster
.
client
.
_cache
# Initialize objects
t1
,
c1
=
cluster
.
getTransaction
()
c1
.
root
()[
'x'
]
=
x1
=
PCounter
()
...
...
@@ -571,7 +572,7 @@ class Test(NEOThreadedTest):
# storage node to return original value of x, even if we
# haven't processed yet any invalidation for x.
x2
=
c2
.
root
()[
'x'
]
c
luster
.
client
.
_c
ache
.
clear
()
# bypass cache
cache
.
clear
()
# bypass cache
self
.
assertEqual
(
x2
.
value
,
0
)
finally
:
master_client
()
...
...
@@ -592,7 +593,7 @@ class Test(NEOThreadedTest):
l1
.
release
()
l2
.
acquire
()
x2
.
_p_deactivate
()
c
luster
.
client
.
_cache
.
clear
(
)
c
ache
.
_remove
(
cache
.
_oid_dict
[
x2
.
_p_oid
].
pop
()
)
p
=
Patch
(
cluster
.
client
,
_loadFromStorage
=
_loadFromStorage
)
try
:
t
=
self
.
newThread
(
x2
.
_p_activate
)
...
...
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