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
Vincent Pelletier
neoppod
Commits
3839d224
Commit
3839d224
authored
Apr 04, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak: do not crash when trying to remove all nodes
parent
8a645d9f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
neo/master/handlers/administration.py
neo/master/handlers/administration.py
+8
-3
neo/master/pt.py
neo/master/pt.py
+2
-0
No files found.
neo/master/handlers/administration.py
View file @
3839d224
...
@@ -197,9 +197,14 @@ class AdministrationHandler(MasterHandler):
...
@@ -197,9 +197,14 @@ class AdministrationHandler(MasterHandler):
@
__change_pt_rpc
@
__change_pt_rpc
def
tweakPartitionTable
(
self
,
conn
,
uuid_list
):
def
tweakPartitionTable
(
self
,
conn
,
uuid_list
):
app
=
self
.
app
app
=
self
.
app
app
.
broadcastPartitionChanges
(
app
.
pt
.
tweak
([
node
drop_list
=
[
node
for
node
in
app
.
nm
.
getStorageList
()
for
node
in
app
.
nm
.
getStorageList
()
if
node
.
getUUID
()
in
uuid_list
or
not
node
.
isRunning
()]
if
node
.
getUUID
()
in
uuid_list
or
not
node
.
isRunning
()]))
try
:
changed_list
=
app
.
pt
.
tweak
(
drop_list
)
except
PartitionTableException
,
e
:
raise
AnswerDenied
(
str
(
e
))
else
:
app
.
broadcastPartitionChanges
(
changed_list
)
conn
.
answer
(
Errors
.
Ack
(
''
))
conn
.
answer
(
Errors
.
Ack
(
''
))
@
check_state
(
ClusterStates
.
RUNNING
)
@
check_state
(
ClusterStates
.
RUNNING
)
...
...
neo/master/pt.py
View file @
3839d224
...
@@ -230,6 +230,8 @@ class PartitionTable(neo.lib.pt.PartitionTable):
...
@@ -230,6 +230,8 @@ class PartitionTable(neo.lib.pt.PartitionTable):
# Collect some data in a usable form for the rest of the method.
# Collect some data in a usable form for the rest of the method.
node_list
=
{
node
:
{}
for
node
in
self
.
count_dict
node_list
=
{
node
:
{}
for
node
in
self
.
count_dict
if
node
not
in
drop_list
}
if
node
not
in
drop_list
}
if
not
node_list
:
raise
neo
.
lib
.
pt
.
PartitionTableException
(
"Can't remove all nodes."
)
drop_list
=
defaultdict
(
list
)
drop_list
=
defaultdict
(
list
)
for
offset
,
row
in
enumerate
(
self
.
partition_list
):
for
offset
,
row
in
enumerate
(
self
.
partition_list
):
for
cell
in
row
:
for
cell
in
row
:
...
...
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