Commit 4319b532 authored by Julien Muchembled's avatar Julien Muchembled

Fix race condition preventing switching cluster in backup mode

parent cfbd9722
......@@ -127,7 +127,10 @@ class PartitionTable(object):
except IndexError:
return False
def getNodeSet(self):
def getNodeSet(self, readable=False):
if readable:
return set(x.getNode() for row in self.partition_list for x in row
if x.isReadable())
return set(x.getNode() for row in self.partition_list for x in row)
def getConnectedNodeList(self):
......
......@@ -90,6 +90,13 @@ class BackupApplication(object):
# [[tid]]
self.tid_list = tuple([] for _ in xrange(pt.getPartitions()))
try:
while True:
for node in pt.getNodeSet(readable=True):
if not app.isStorageReady(node.getUUID()):
break
else:
break
poll(1)
node, conn, uuid, num_partitions, num_replicas = \
bootstrap.getPrimaryConnection(self.connector_handler)
try:
......@@ -180,6 +187,8 @@ class BackupApplication(object):
for cell in pt.getCellList(offset, readable=True):
node = cell.getNode()
assert node.isConnected()
if not app.isStorageReady(node.getUUID()):
continue
node_list.append(node)
if last_max_tid <= cell.backup_tid:
# This is the last time we can increase
......
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