Commit a05fde35 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Storage storage last OID in transactions manager.

Remove the related TODO.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1737 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 02a1df15
......@@ -61,7 +61,6 @@ class Application(object):
# The partition table is initialized after getting the number of
# partitions.
self.pt = None
self.loid = None
self.replicator = None
self.listening_conn = None
......
......@@ -36,7 +36,7 @@ class BaseMasterHandler(EventHandler):
self.__class__.__name__)
def notifyLastOID(self, conn, oid):
self.app.loid = oid
self.app.tm.setLastOID(oid)
self.app.dm.setLastOID(oid)
def notifyNodeInformation(self, conn, node_list):
......
......@@ -97,8 +97,8 @@ class TransactionManager(object):
self._store_lock_dict = {}
self._load_lock_dict = {}
self._uuid_dict = {}
# TODO: replace app.loid with this one:
self._loid = None
self._loid_seen = None
def __contains__(self, tid):
"""
......@@ -117,6 +117,10 @@ class TransactionManager(object):
self._transaction_dict[tid] = transaction
return transaction
def setLastOID(self, oid):
assert oid >= self._loid
self._loid = oid
def reset(self):
"""
Reset the transaction manager
......@@ -150,11 +154,11 @@ class TransactionManager(object):
self.abort(tid, even_if_locked=True)
# update loid if needed
if self._loid != self._app.loid:
args = dump(self._loid), dump(self._app.loid)
if self._loid_seen > self._loid:
args = dump(self._loid_seen), dump(self._loid_seen)
logging.warning('Greater OID used in StoreObject : %s > %s', *args)
self._app.loid = self._loid
self._app.dm.setLastOID(self._app.loid)
self._loid = self._loid_seen
self._app.dm.setLastOID(self._loid)
def storeTransaction(self, uuid, tid, oid_list, user, desc, ext):
"""
......@@ -190,7 +194,7 @@ class TransactionManager(object):
self._store_lock_dict[oid] = tid
# update loid
self._loid = max(oid, self._app.loid)
self._loid_seen = oid
def abort(self, tid, even_if_locked=True):
"""
......
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