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
6f86c773
Commit
6f86c773
authored
Mar 15, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The partition table must forget dropped nodes
parent
7ffc96fd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
neo/lib/node.py
neo/lib/node.py
+3
-0
neo/lib/pt.py
neo/lib/pt.py
+4
-0
neo/tests/testNodes.py
neo/tests/testNodes.py
+3
-1
No files found.
neo/lib/node.py
View file @
6f86c773
...
@@ -451,6 +451,8 @@ class NodeManager(EventQueue):
...
@@ -451,6 +451,8 @@ class NodeManager(EventQueue):
# reconnect to the master because they cleared their
# reconnect to the master because they cleared their
# partition table upon disconnection.
# partition table upon disconnection.
node
.
getConnection
().
close
()
node
.
getConnection
().
close
()
if
app
.
uuid
!=
uuid
:
app
.
pt
.
dropNode
(
node
)
self
.
remove
(
node
)
self
.
remove
(
node
)
continue
continue
logging
.
debug
(
'updating node %r to %s %s %s %s %s'
,
logging
.
debug
(
'updating node %r to %s %s %s %s %s'
,
...
@@ -465,6 +467,7 @@ class NodeManager(EventQueue):
...
@@ -465,6 +467,7 @@ class NodeManager(EventQueue):
# For the first notification, we receive a full list of nodes from
# For the first notification, we receive a full list of nodes from
# the master. Remove all unknown nodes from a previous connection.
# the master. Remove all unknown nodes from a previous connection.
for
node
in
node_set
-
self
.
_node_set
:
for
node
in
node_set
-
self
.
_node_set
:
app
.
pt
.
dropNode
(
node
)
self
.
remove
(
node
)
self
.
remove
(
node
)
self
.
log
()
self
.
log
()
self
.
executeQueuedEvents
()
self
.
executeQueuedEvents
()
...
...
neo/lib/pt.py
View file @
6f86c773
...
@@ -195,6 +195,10 @@ class PartitionTable(object):
...
@@ -195,6 +195,10 @@ class PartitionTable(object):
self
.
count_dict
[
node
]
-=
1
self
.
count_dict
[
node
]
-=
1
break
break
def
dropNode
(
self
,
node
):
count
=
self
.
count_dict
.
pop
(
node
,
None
)
assert
not
count
,
(
node
,
count
)
def
load
(
self
,
ptid
,
row_list
,
nm
):
def
load
(
self
,
ptid
,
row_list
,
nm
):
"""
"""
Load the partition table with the specified PTID, discard all previous
Load the partition table with the specified PTID, discard all previous
...
...
neo/tests/testNodes.py
View file @
6f86c773
...
@@ -163,8 +163,10 @@ class NodeManagerTests(NeoUnitTestBase):
...
@@ -163,8 +163,10 @@ class NodeManagerTests(NeoUnitTestBase):
(
NodeTypes
.
ADMIN
,
self
.
admin
.
getAddress
(),
self
.
admin
.
getUUID
(),
(
NodeTypes
.
ADMIN
,
self
.
admin
.
getAddress
(),
self
.
admin
.
getUUID
(),
NodeStates
.
UNKNOWN
,
None
),
NodeStates
.
UNKNOWN
,
None
),
)
)
app
=
Mock
()
app
.
pt
=
Mock
()
# update manager content
# update manager content
manager
.
update
(
Mock
()
,
time
(),
node_list
)
manager
.
update
(
app
,
time
(),
node_list
)
# - the client gets down
# - the client gets down
self
.
checkClients
([])
self
.
checkClients
([])
# - master change it's address
# - master change it's address
...
...
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