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
b8210d58
Commit
b8210d58
authored
Apr 01, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove HIDDEN node state
parent
f051b7a0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
73 deletions
+2
-73
TODO
TODO
+1
-1
neo/lib/protocol.py
neo/lib/protocol.py
+0
-2
neo/storage/app.py
neo/storage/app.py
+1
-20
neo/storage/handlers/__init__.py
neo/storage/handlers/__init__.py
+0
-2
neo/storage/handlers/hidden.py
neo/storage/handlers/hidden.py
+0
-48
No files found.
TODO
View file @
b8210d58
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
- Clarify handler methods to call when a connection is accepted from a
- Clarify handler methods to call when a connection is accepted from a
listening conenction and when remote node is identified
listening conenction and when remote node is identified
(cf. neo/lib/bootstrap.py).
(cf. neo/lib/bootstrap.py).
- Review PENDING/
HIDDEN/
SHUTDOWN states, don't use notifyNodeInformation()
- Review PENDING/SHUTDOWN states, don't use notifyNodeInformation()
to do a state-switch, use a exception-based mechanism ? (CODE)
to do a state-switch, use a exception-based mechanism ? (CODE)
- Review handler split (CODE)
- Review handler split (CODE)
The current handler split is the result of small incremental changes. A
The current handler split is the result of small incremental changes. A
...
...
neo/lib/protocol.py
View file @
b8210d58
...
@@ -124,7 +124,6 @@ def NodeStates():
...
@@ -124,7 +124,6 @@ def NodeStates():
TEMPORARILY_DOWN
TEMPORARILY_DOWN
DOWN
DOWN
BROKEN
BROKEN
HIDDEN
PENDING
PENDING
UNKNOWN
UNKNOWN
...
@@ -153,7 +152,6 @@ node_state_prefix_dict = {
...
@@ -153,7 +152,6 @@ node_state_prefix_dict = {
NodeStates
.
TEMPORARILY_DOWN
:
'T'
,
NodeStates
.
TEMPORARILY_DOWN
:
'T'
,
NodeStates
.
DOWN
:
'D'
,
NodeStates
.
DOWN
:
'D'
,
NodeStates
.
BROKEN
:
'B'
,
NodeStates
.
BROKEN
:
'B'
,
NodeStates
.
HIDDEN
:
'H'
,
NodeStates
.
PENDING
:
'P'
,
NodeStates
.
PENDING
:
'P'
,
NodeStates
.
UNKNOWN
:
'U'
,
NodeStates
.
UNKNOWN
:
'U'
,
}
}
...
...
neo/storage/app.py
View file @
b8210d58
...
@@ -28,8 +28,7 @@ from neo.lib.util import dump
...
@@ -28,8 +28,7 @@ from neo.lib.util import dump
from
neo.lib.bootstrap
import
BootstrapManager
from
neo.lib.bootstrap
import
BootstrapManager
from
.checker
import
Checker
from
.checker
import
Checker
from
.database
import
buildDatabaseManager
from
.database
import
buildDatabaseManager
from
.handlers
import
identification
,
initialization
from
.handlers
import
identification
,
initialization
,
master
from
.handlers
import
master
,
hidden
from
.replicator
import
Replicator
from
.replicator
import
Replicator
from
.transactions
import
TransactionManager
from
.transactions
import
TransactionManager
...
@@ -170,10 +169,6 @@ class Application(BaseApplication):
...
@@ -170,10 +169,6 @@ class Application(BaseApplication):
if
self
.
master_node
is
None
:
if
self
.
master_node
is
None
:
# look for the primary master
# look for the primary master
self
.
connectToPrimary
()
self
.
connectToPrimary
()
# check my state
node
=
self
.
nm
.
getByUUID
(
self
.
uuid
)
if
node
is
not
None
and
node
.
isHidden
():
self
.
wait
()
self
.
checker
=
Checker
(
self
)
self
.
checker
=
Checker
(
self
)
self
.
replicator
=
Replicator
(
self
)
self
.
replicator
=
Replicator
(
self
)
self
.
tm
=
TransactionManager
(
self
)
self
.
tm
=
TransactionManager
(
self
)
...
@@ -273,20 +268,6 @@ class Application(BaseApplication):
...
@@ -273,20 +268,6 @@ class Application(BaseApplication):
if
state
==
ClusterStates
.
STOPPING_BACKUP
:
if
state
==
ClusterStates
.
STOPPING_BACKUP
:
self
.
replicator
.
stop
()
self
.
replicator
.
stop
()
def
wait
(
self
):
# change handler
logging
.
info
(
"waiting in hidden state"
)
_poll
=
self
.
_poll
handler
=
hidden
.
HiddenHandler
(
self
)
for
conn
in
self
.
em
.
getConnectionList
():
conn
.
setHandler
(
handler
)
node
=
self
.
nm
.
getByUUID
(
self
.
uuid
)
while
True
:
_poll
()
if
not
node
.
isHidden
():
break
def
newTask
(
self
,
iterator
):
def
newTask
(
self
,
iterator
):
try
:
try
:
iterator
.
next
()
iterator
.
next
()
...
...
neo/storage/handlers/__init__.py
View file @
b8210d58
...
@@ -60,8 +60,6 @@ class BaseMasterHandler(BaseHandler):
...
@@ -60,8 +60,6 @@ class BaseMasterHandler(BaseHandler):
NodeStates
.
BROKEN
,
NodeStates
.
UNKNOWN
):
NodeStates
.
BROKEN
,
NodeStates
.
UNKNOWN
):
erase
=
state
==
NodeStates
.
DOWN
erase
=
state
==
NodeStates
.
DOWN
self
.
app
.
shutdown
(
erase
=
erase
)
self
.
app
.
shutdown
(
erase
=
erase
)
elif
state
==
NodeStates
.
HIDDEN
:
raise
StoppedOperation
elif
node_type
==
NodeTypes
.
CLIENT
and
state
!=
NodeStates
.
RUNNING
:
elif
node_type
==
NodeTypes
.
CLIENT
and
state
!=
NodeStates
.
RUNNING
:
logging
.
info
(
'Notified of non-running client, abort (%s)'
,
logging
.
info
(
'Notified of non-running client, abort (%s)'
,
uuid_str
(
uuid
))
uuid_str
(
uuid
))
...
...
neo/storage/handlers/hidden.py
deleted
100644 → 0
View file @
f051b7a0
#
# Copyright (C) 2006-2017 Nexedi SA
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
.
import
BaseMasterHandler
from
neo.lib
import
logging
from
neo.lib.protocol
import
CellStates
class
HiddenHandler
(
BaseMasterHandler
):
"""This class implements a generic part of the event handlers."""
def
notifyPartitionChanges
(
self
,
conn
,
ptid
,
cell_list
):
"""This is very similar to Send Partition Table, except that
the information is only about changes from the previous."""
app
=
self
.
app
if
ptid
<=
app
.
pt
.
getID
():
# Ignore this packet.
logging
.
debug
(
'ignoring older partition changes'
)
return
# update partition table in memory and the database
app
.
pt
.
update
(
ptid
,
cell_list
,
app
.
nm
)
app
.
dm
.
changePartitionTable
(
ptid
,
cell_list
)
# Check changes for replications
for
offset
,
uuid
,
state
in
cell_list
:
if
uuid
==
app
.
uuid
and
app
.
replicator
is
not
None
:
# If this is for myself, this can affect replications.
if
state
==
CellStates
.
DISCARDED
:
app
.
replicator
.
removePartition
(
offset
)
elif
state
==
CellStates
.
OUT_OF_DATE
:
app
.
replicator
.
addPartition
(
offset
)
def
startOperation
(
self
,
conn
):
self
.
app
.
operational
=
True
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