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
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
b22847d2
Commit
b22847d2
authored
Dec 15, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: ignore late AnswerInformationLocked during recovery
parent
a760258b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
neo/master/handlers/storage.py
neo/master/handlers/storage.py
+6
-1
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+44
-0
No files found.
neo/master/handlers/storage.py
View file @
b22847d2
...
@@ -69,7 +69,12 @@ class StorageServiceHandler(BaseServiceHandler):
...
@@ -69,7 +69,12 @@ class StorageServiceHandler(BaseServiceHandler):
app
.
pt
.
updatable
(
conn
.
getUUID
(),
offset_list
)
app
.
pt
.
updatable
(
conn
.
getUUID
(),
offset_list
)
def
answerInformationLocked
(
self
,
conn
,
ttid
):
def
answerInformationLocked
(
self
,
conn
,
ttid
):
self
.
app
.
tm
.
lock
(
ttid
,
conn
.
getUUID
())
app
=
self
.
app
# XXX: see testAnswerInformationLockedDuringRecovery
if
ClusterStates
.
RUNNING
!=
app
.
cluster_state
!=
ClusterStates
.
STOPPING
:
assert
app
.
cluster_state
==
ClusterStates
.
RECOVERING
else
:
app
.
tm
.
lock
(
ttid
,
conn
.
getUUID
())
def
notifyPartitionCorrupted
(
self
,
conn
,
partition
,
cell_list
):
def
notifyPartitionCorrupted
(
self
,
conn
,
partition
,
cell_list
):
change_list
=
[]
change_list
=
[]
...
...
neo/tests/threaded/test.py
View file @
b22847d2
...
@@ -2746,6 +2746,50 @@ class Test(NEOThreadedTest):
...
@@ -2746,6 +2746,50 @@ class Test(NEOThreadedTest):
else
:
else
:
self
.
fail
(
'%r not closed'
%
conn
)
self
.
fail
(
'%r not closed'
%
conn
)
@
with_cluster
(
partitions
=
2
,
storage_count
=
2
)
def
testAnswerInformationLockedDuringRecovery
(
self
,
cluster
):
"""
This test shows a possible wrong behavior of nodes about the handling
of answer packets. Here, after going back to RECOVERING state whereas
it was waiting for a transaction to be locked, it will anyway process
the AnswerInformationLocked packet: if the cluster state was not
checked, it would send a NotifyUnlockInformation packet, but the
latter would be unexpected for the storage (InitializationHandler),
causing an extra storage-master disconnection.
This would be a minor issue. However, the current design of connection
handlers requires careful coding for every requests: for the case that
is tested here, it would still work because the transaction manager is
only reset after recovery and AnswerInformationLocked can't arrive
later.
It would be less error-prone if pending requests were marked to discard
their answers once it makes no sense anymore to process them. Provided
that handlers can be carefully split, a possible solution is that
switching handler could first consist in changing the handlers of all
pending requests to one that ignore answers.
"""
s0
,
s1
=
cluster
.
sortStorageList
()
t
,
c
=
cluster
.
getTransaction
()
c
.
root
().
_p_changed
=
1
s0m
=
s0
.
master_conn
def
reconnect
(
orig
):
p
.
revert
()
self
.
assertFalse
(
s0m
.
isClosed
())
f
.
remove
(
delay
)
self
.
tic
()
return
orig
()
with
Patch
(
cluster
.
client
,
_connectToPrimaryNode
=
reconnect
)
as
p
,
\
s0
.
filterConnection
(
cluster
.
master
)
as
f
,
cluster
.
moduloTID
(
0
):
@
f
.
delayAnswerInformationLocked
def
delay
(
_
):
s1
.
em
.
wakeup
(
s1
.
master_conn
.
close
)
t
.
commit
()
self
.
tic
()
self
.
assertEqual
(
cluster
.
neoctl
.
getClusterState
(),
ClusterStates
.
RUNNING
)
self
.
assertFalse
(
s0m
.
isClosed
())
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
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