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
Ivan Tyagov
neoppod
Commits
badd9de3
Commit
badd9de3
authored
Oct 21, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: add assertion in cache to detect wrong invalidation
parent
9682722b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
neo/client/cache.py
neo/client/cache.py
+2
-0
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+6
-6
No files found.
neo/client/cache.py
View file @
badd9de3
...
@@ -205,6 +205,7 @@ class ClientCache(object):
...
@@ -205,6 +205,7 @@ class ClientCache(object):
insort
(
item_list
,
item
)
insort
(
item_list
,
item
)
else
:
else
:
prev
=
item_list
[
-
1
]
prev
=
item_list
[
-
1
]
assert
prev
.
next_tid
<=
tid
,
(
prev
,
item
)
item
.
counter
=
prev
.
counter
item
.
counter
=
prev
.
counter
prev
.
counter
=
0
prev
.
counter
=
0
if
prev
.
level
>
1
:
if
prev
.
level
>
1
:
...
@@ -275,6 +276,7 @@ def test(self):
...
@@ -275,6 +276,7 @@ def test(self):
cache
.
store
(
1
,
'10'
,
10
,
15
)
cache
.
store
(
1
,
'10'
,
10
,
15
)
cache
.
store
(
1
,
'20'
,
20
,
21
)
cache
.
store
(
1
,
'20'
,
20
,
21
)
self
.
assertEqual
([
5
,
10
,
15
,
20
],
[
x
.
tid
for
x
in
cache
.
_oid_dict
[
1
]])
self
.
assertEqual
([
5
,
10
,
15
,
20
],
[
x
.
tid
for
x
in
cache
.
_oid_dict
[
1
]])
self
.
assertRaises
(
AssertionError
,
cache
.
store
,
1
,
'20'
,
20
,
None
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
...
...
neo/tests/threaded/test.py
View file @
badd9de3
...
@@ -697,8 +697,6 @@ class Test(NEOThreadedTest):
...
@@ -697,8 +697,6 @@ class Test(NEOThreadedTest):
t1
,
c1
=
cluster
.
getTransaction
()
t1
,
c1
=
cluster
.
getTransaction
()
c1
.
root
()[
'x'
]
=
x
=
PCounter
()
c1
.
root
()[
'x'
]
=
x
=
PCounter
()
t1
.
commit
()
t1
.
commit
()
t1
.
begin
()
x
.
_p_deactivate
()
# We need a second client for external invalidations.
# We need a second client for external invalidations.
t2
=
transaction
.
TransactionManager
()
t2
=
transaction
.
TransactionManager
()
db
=
DB
(
storage
=
cluster
.
getZODBStorage
(
client
=
cluster
.
newClient
()))
db
=
DB
(
storage
=
cluster
.
getZODBStorage
(
client
=
cluster
.
newClient
()))
...
@@ -720,10 +718,12 @@ class Test(NEOThreadedTest):
...
@@ -720,10 +718,12 @@ class Test(NEOThreadedTest):
self
.
assertFalse
(
storage
.
tm
.
_transaction_dict
)
self
.
assertFalse
(
storage
.
tm
.
_transaction_dict
)
finally
:
finally
:
db
.
close
()
db
.
close
()
# Clearing cache is the easiest way to check we did't get an
# Check we did't get an invalidation, which would cause an
# invalidation, which would cause a failure in _setstate_noncurrent
# assertion failure in the cache. Connection does the same check in
c1
.
_storage
.
_cache
.
clear
()
# _setstate_noncurrent so this could be also done by starting a
self
.
assertFalse
(
x
.
value
)
# transaction before the last one, and clearing the cache before
# reloading x.
c1
.
_storage
.
load
(
x
.
_p_oid
)
t0
,
t1
,
t2
=
c1
.
_storage
.
iterator
()
t0
,
t1
,
t2
=
c1
.
_storage
.
iterator
()
self
.
assertEqual
(
map
(
u64
,
t0
.
oid_list
),
[
0
])
self
.
assertEqual
(
map
(
u64
,
t0
.
oid_list
),
[
0
])
self
.
assertEqual
(
map
(
u64
,
t1
.
oid_list
),
[
0
,
1
])
self
.
assertEqual
(
map
(
u64
,
t1
.
oid_list
),
[
0
,
1
])
...
...
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