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
57956ec9
Commit
57956ec9
authored
Oct 10, 2023
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: if upstream unset, reject request to backup rather than crashing
parent
0fc95175
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
neo/master/app.py
neo/master/app.py
+8
-6
neo/master/handlers/administration.py
neo/master/handlers/administration.py
+2
-0
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+5
-0
No files found.
neo/master/app.py
View file @
57956ec9
...
...
@@ -59,6 +59,8 @@ class Application(BaseApplication):
backup_app
=
None
truncate_tid
=
None
no_upstream_msg
=
"No upstream cluster to backup defined in configuration"
def
setUUID
(
self
,
uuid
):
node
=
self
.
nm
.
getByUUID
(
uuid
)
if
node
is
not
self
.
_node
:
...
...
@@ -171,10 +173,11 @@ class Application(BaseApplication):
def
run
(
self
):
try
:
self
.
_run
()
except
Exception
:
logging
.
exception
(
'Pre-mortem data:'
)
self
.
log
()
logging
.
flush
()
except
BaseException
,
e
:
if
not
isinstance
(
e
,
SystemExit
)
or
e
.
code
:
logging
.
exception
(
'Pre-mortem data:'
)
self
.
log
()
logging
.
flush
()
raise
def
_run
(
self
):
...
...
@@ -309,8 +312,7 @@ class Application(BaseApplication):
# self.provideService only returns without raising
# when switching to backup mode.
if
self
.
backup_app
is
None
:
raise
RuntimeError
(
"No upstream cluster to backup"
" defined in configuration"
)
sys
.
exit
(
self
.
no_upstream_msg
)
truncate
=
Packets
.
Truncate
(
self
.
backup_app
.
provideService
())
except
StoppedOperation
,
e
:
...
...
neo/master/handlers/administration.py
View file @
57956ec9
...
...
@@ -105,6 +105,8 @@ class AdministrationHandler(MasterHandler):
if
app
.
tm
.
hasPending
()
or
app
.
nm
.
getClientList
(
True
):
raise
AnswerDenied
(
"Can not switch to %s state with pending"
" transactions or connected clients"
%
state
)
if
app
.
backup_app
is
None
:
raise
AnswerDenied
(
app
.
no_upstream_msg
)
conn
.
answer
(
Errors
.
Ack
(
'Cluster state changed'
))
if
state
!=
app
.
cluster_state
:
...
...
neo/tests/threaded/test.py
View file @
57956ec9
...
...
@@ -2851,6 +2851,11 @@ class Test(NEOThreadedTest):
with
self
.
expectedFailure
():
\
self
.
assertFalse
(
s0m
.
isClosed
())
@
with_cluster
()
def
testUnsetUpsteam
(
self
,
cluster
):
self
.
assertRaises
(
SystemExit
,
cluster
.
neoctl
.
setClusterState
,
ClusterStates
.
STARTING_BACKUP
)
if
__name__
==
"__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