Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
Stefane Fermigier
neo
Commits
9cca0f8e
Commit
9cca0f8e
authored
Mar 30, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Found 2 bugs in undo, add tests
parent
8ec0faf7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
neo/client/app.py
neo/client/app.py
+2
-1
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+41
-1
No files found.
neo/client/app.py
View file @
9cca0f8e
...
...
@@ -538,7 +538,8 @@ class Application(ThreadedApplication):
if
data
is
CHECKED_SERIAL
:
raise
ReadConflictError
(
oid
=
oid
,
serials
=
(
conflict_serial
,
serial
))
if
data
:
# XXX: can 'data' be None ???
# TODO: data can be None if a conflict happens during undo
if
data
:
txn_context
[
'data_size'
]
-=
len
(
data
)
resolved_serial_set
=
resolved_conflict_serial_dict
.
setdefault
(
oid
,
set
())
...
...
neo/tests/threaded/test.py
View file @
9cca0f8e
...
...
@@ -42,7 +42,10 @@ class PCounter(Persistent):
class
PCounterWithResolution
(
PCounter
):
def
_p_resolveConflict
(
self
,
old
,
saved
,
new
):
new
[
'value'
]
+=
saved
[
'value'
]
-
old
.
get
(
'value'
,
0
)
new
[
'value'
]
=
(
saved
.
get
(
'value'
,
0
)
+
new
.
get
(
'value'
,
0
)
-
old
.
get
(
'value'
,
0
))
return
new
class
Test
(
NEOThreadedTest
):
...
...
@@ -152,6 +155,43 @@ class Test(NEOThreadedTest):
finally
:
cluster
.
stop
()
def
testUndoConflict
(
self
,
conflict_during_store
=
False
):
def
waitResponses
(
orig
,
*
args
):
orig
(
*
args
)
p
.
revert
()
ob
.
value
+=
3
t
.
commit
()
cluster
=
NEOCluster
()
try
:
cluster
.
start
()
t
,
c
=
cluster
.
getTransaction
()
c
.
root
()[
0
]
=
ob
=
PCounterWithResolution
()
t
.
commit
()
ob
.
value
+=
1
t
.
commit
()
tid
=
ob
.
_p_serial
storage
=
cluster
.
db
.
storage
txn
=
transaction
.
Transaction
()
storage
.
tpc_begin
(
txn
)
if
conflict_during_store
:
with
Patch
(
cluster
.
client
,
waitResponses
=
waitResponses
)
as
p
:
storage
.
undo
(
tid
,
txn
)
else
:
ob
.
value
+=
3
t
.
commit
()
storage
.
undo
(
tid
,
txn
)
storage
.
tpc_finish
(
txn
)
value
=
ob
.
value
ob
.
_p_invalidate
()
# BUG: this should not be required
self
.
assertEqual
(
ob
.
value
,
3
)
expectedFailure
(
self
.
assertNotEqual
)(
value
,
4
)
finally
:
cluster
.
stop
()
@
expectedFailure
(
POSException
.
ConflictError
)
def
testUndoConflictDuringStore
(
self
):
self
.
testUndoConflict
(
True
)
def
testStorageDataLock
(
self
):
cluster
=
NEOCluster
()
try
:
...
...
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