Commit 4ed74d9e authored by Grégory Wisniewski's avatar Grégory Wisniewski

Clarity replicator.act() implementation.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1750 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4c2a63ee
...@@ -204,35 +204,38 @@ class Replicator(object): ...@@ -204,35 +204,38 @@ class Replicator(object):
if self.new_partition_dict: if self.new_partition_dict:
self._askCriticalTID() self._askCriticalTID()
if self.current_partition is None: if self.current_partition is not None:
# I need to choose something.
if self.waiting_for_unfinished_tids:
# Still waiting.
logging.debug('waiting for unfinished tids')
return
elif self.unfinished_tid_list is not None:
# Try to select something.
for partition in self.partition_dict.values():
if partition.safe(self.unfinished_tid_list):
self.current_partition = partition
self.unfinished_tid_list = None
break
else:
# Not yet.
logging.debug('not ready yet')
self.unfinished_tid_list = None
return
self._startReplication()
else:
# Ask pending transactions.
logging.debug('asking unfinished tids')
self._askUnfinishedTIDs()
else:
if self.replication_done: if self.replication_done:
# finish a replication
logging.info('replication is done for %s' % logging.info('replication is done for %s' %
(self.current_partition.getRID(), )) (self.current_partition.getRID(), ))
self._finishReplication() self._finishReplication()
return
if self.waiting_for_unfinished_tids:
# Still waiting.
logging.debug('waiting for unfinished tids')
return
if self.unfinished_tid_list is None:
# Ask pending transactions.
logging.debug('asking unfinished tids')
self._askUnfinishedTIDs()
return
# Try to select something.
for partition in self.partition_dict.values():
if partition.safe(self.unfinished_tid_list):
self.current_partition = partition
self.unfinished_tid_list = None
break
else:
# Not yet.
logging.debug('not ready yet')
self.unfinished_tid_list = None
return
self._startReplication()
def removePartition(self, rid): def removePartition(self, rid):
"""This is a callback from OperationEventHandler.""" """This is a callback from OperationEventHandler."""
......
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