Commit 07efb0ca authored by Julien Muchembled's avatar Julien Muchembled

In backup mode, fix update of outdated partition when there's more than 1 replica

parent 32e5274a
......@@ -145,7 +145,7 @@ class BackupApplication(object):
# they would be quickly updated at the beginning of the
# RUNNING phase. This may simplify code.
# Any unfinished replication from upstream will be truncated.
while pt.getCheckTid(xrange(pt.getPartitions())) < tid:
while pt.getBackupTid(min) < tid:
poll(1)
last_tid = app.getLastTransaction()
handler = EventHandler(app)
......
......@@ -50,7 +50,7 @@ class StorageServiceHandler(BaseServiceHandler):
def askUnfinishedTransactions(self, conn):
app = self.app
if app.backup_tid:
last_tid = app.pt.getBackupTid()
last_tid = app.pt.getBackupTid(min)
pending_list = ()
else:
last_tid = app.tm.getLastTID()
......
......@@ -325,9 +325,9 @@ class PartitionTable(neo.lib.pt.PartitionTable):
cell.backup_tid = backup_tid_dict.get(cell.getUUID(),
ZERO_TID)
def getBackupTid(self):
def getBackupTid(self, mean=max):
try:
return min(max(cell.backup_tid for cell in row if cell.isReadable())
return min(mean(x.backup_tid for x in row if x.isReadable())
for row in self.partition_list)
except ValueError:
return ZERO_TID
......
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