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