[Neo-report] r2786 jm - /trunk/neo/storage/replicator.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 15 12:39:14 CEST 2011


Author: jm
Date: Wed Jun 15 12:39:14 2011
New Revision: 2786

Log:
storage: fix update of outdated partitions when a transaction is finished

All Partition objects must be updated because all of them may contain an object
of the given transaction, even if the transaction itself is stored in another
storage.

Modified:
    trunk/neo/storage/replicator.py

Modified: trunk/neo/storage/replicator.py
==============================================================================
--- trunk/neo/storage/replicator.py [iso-8859-1] (original)
+++ trunk/neo/storage/replicator.py [iso-8859-1] Wed Jun 15 12:39:14 2011
@@ -27,8 +27,13 @@ class Partition(object):
     """This class abstracts the state of a partition."""
 
     def __init__(self, offset, max_tid, ttid_list):
+        # Possible optimization:
+        #   _pending_ttid_list & _critical_tid can be shared amongst partitions
+        #   created at the same time (cf Replicator.setUnfinishedTIDList).
+        #   Replicator.transactionFinished would only have to iterate on these
+        #   different sets, instead of all partitions.
         self._offset = offset
-        self._pending_ttid_list = ttid_list
+        self._pending_ttid_list = set(ttid_list)
         # pending upper bound
         self._critical_tid = max_tid
 
@@ -212,8 +217,8 @@ class Replicator(object):
 
     def transactionFinished(self, ttid, max_tid):
         """ Callback from MasterOperationHandler """
-        partition = self.partition_dict[self.app.pt.getPartition(ttid)]
-        partition.transactionFinished(ttid, max_tid)
+        for partition in self.partition_dict.itervalues():
+            partition.transactionFinished(ttid, max_tid)
 
     def _askUnfinishedTIDs(self):
         conn = self.app.master_conn




More information about the Neo-report mailing list