[Neo-report] r2223 vincent - in /trunk/neo/storage: app.py replicator.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 26 10:02:02 CEST 2010


Author: vincent
Date: Thu Aug 26 10:01:58 2010
New Revision: 2223

Log:
Only instanciate Replicator once.

Also, reverts r2197, as it is unclear what bug it was trying to fix, and it
doens't seem required (there is no call to Replicator.act() outside of
doOperation).

Modified:
    trunk/neo/storage/app.py
    trunk/neo/storage/replicator.py

Modified: trunk/neo/storage/app.py
==============================================================================
--- trunk/neo/storage/app.py [iso-8859-1] (original)
+++ trunk/neo/storage/app.py [iso-8859-1] Thu Aug 26 10:01:58 2010
@@ -64,7 +64,7 @@ class Application(object):
         # partitions.
         self.pt = None
 
-        self.replicator = None
+        self.replicator = Replicator(self)
         self.listening_conn = None
         self.master_conn = None
         self.master_node = None
@@ -176,9 +176,6 @@ class Application(object):
         while True:
             self.ready = False
             self.operational = False
-            if self.replicator is not None:
-              # stop the replicator
-              self.replicator.reset()
             if self.master_node is None:
                 # look for the primary master
                 self.connectToPrimary()
@@ -286,8 +283,7 @@ class Application(object):
         self.dm.dropUnfinishedData()
         self.tm.reset()
 
-        # The replicator.
-        self.replicator = Replicator(self)
+        self.replicator.populate()
 
         while True:
             em.poll(1)

Modified: trunk/neo/storage/replicator.py
==============================================================================
--- trunk/neo/storage/replicator.py [iso-8859-1] (original)
+++ trunk/neo/storage/replicator.py [iso-8859-1] Thu Aug 26 10:01:58 2010
@@ -79,6 +79,13 @@ class Replicator(object):
 
     def __init__(self, app):
         self.app = app
+
+    def populate(self):
+        """
+        Populate partitions to replicate. Must be called when partition
+        table is the one accepted by primary master.
+        Implies a reset.
+        """
         self.new_partition_dict = self._getOutdatedPartitionList()
         self.critical_tid_dict = {}
         self.reset()





More information about the Neo-report mailing list