Commit 7f81ac2d authored by Julien Muchembled's avatar Julien Muchembled

admin: fix crash if not operational and a downstream cluster is RUNNING

Traceback (most recent call last):
  ...
  File ".../neo/lib/handler.py", line 75, in dispatch
    method(conn, *args, **kw)
  File ".../neo/admin/handler.py", line 174, in wrapper
    return func(self, name, *args, **kw)
  File ".../neo/admin/handler.py", line 190, in notifyMonitorInformation
    self.app.updateMonitorInformation(name, **info)
  File ".../neo/admin/app.py", line 290, in updateMonitorInformation
    self._notify(self.operational)
  File ".../neo/admin/app.py", line 315, in _notify
    body += '', name, '    ' + backup.formatSummary(upstream)[1]
  File ".../neo/admin/app.py", line 83, in formatSummary
    tid = self.ltid
AttributeError: 'Backup' object has no attribute 'ltid'
parent ba0bc779
......@@ -80,7 +80,12 @@ class Monitor(object):
# will be unknown for this cluster.
break
else:
tid = self.ltid
try:
tid = self.ltid
except AttributeError:
# Downstream is in RUNNING state but if we've just started
# whereas we're not operational, we didn't ask its last tid.
break
upstream = None
x = datetimeFromTID(tid)
if upstream:
......
......@@ -851,10 +851,13 @@ class NEOCluster(object):
def __exit__(self, t, v, tb):
self.stop(None)
def resetNeoCTL(self):
self.neoctl = NeoCTL(self.admin.getVirtualAddress(), ssl=self.SSL)
def start(self, storage_list=None, master_list=None, recovering=False):
self.started = True
self._patch()
self.neoctl = NeoCTL(self.admin.getVirtualAddress(), ssl=self.SSL)
self.resetNeoCTL()
if master_list is None:
master_list = self.master_list
if storage_list is None:
......
......@@ -1052,6 +1052,27 @@ class ReplicationTests(NEOThreadedTest):
s = cluster.storage_list[1]
self.assertRaises(SystemExit, cluster.neoctl.dropNode, s.uuid)
@backup_test()
def testUpstreamStartWithDownstreamRunning(self, backup):
upstream = backup.upstream
upstream.getTransaction() # "initial database creation" commit
self.tic()
backup.neoctl.setClusterState(ClusterStates.STOPPING_BACKUP)
self.tic()
self.assertEqual(backup.neoctl.getClusterState(),
ClusterStates.RUNNING)
admin = upstream.admin
admin.stop()
storage = upstream.storage
storage.stop()
upstream.join((admin, storage))
admin.resetNode()
admin.start()
self.tic()
upstream.resetNeoCTL()
self.assertEqual(upstream.neoctl.getClusterState(),
ClusterStates.RECOVERING)
@with_cluster(partitions=5, replicas=2, storage_count=3)
def testCheckReplicas(self, cluster):
from neo.storage import checker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment