[Neo-report] r1976 vincent - in /trunk/neo: ./ master/ storage/ tests/storage/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 26 17:57:21 CET 2010
Author: vincent
Date: Fri Mar 26 17:57:20 2010
New Revision: 1976
Log:
Fix missing field decoding in AnswerLastIDs.
Modified:
trunk/neo/master/recovery.py
trunk/neo/master/transactions.py
trunk/neo/master/verification.py
trunk/neo/protocol.py
trunk/neo/storage/replicator.py
trunk/neo/tests/storage/testVerificationHandler.py
Modified: trunk/neo/master/recovery.py
==============================================================================
--- trunk/neo/master/recovery.py [iso-8859-1] (original)
+++ trunk/neo/master/recovery.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -119,8 +119,13 @@
pt = app.pt
# Get max values.
- app.loid = max(loid, app.loid)
- self.app.tm.setLastTID(ltid)
+ if loid is not None:
+ if app.loid is None:
+ app.loid = loid
+ else:
+ app.loid = max(loid, app.loid)
+ if ltid is not None:
+ self.app.tm.setLastTID(ltid)
if lptid > pt.getID():
# something newer
self.target_uuid = conn.getUUID()
Modified: trunk/neo/master/transactions.py
==============================================================================
--- trunk/neo/master/transactions.py [iso-8859-1] (original)
+++ trunk/neo/master/transactions.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -148,7 +148,10 @@
"""
Set the last TID, keep the previous if lower
"""
- self._last_tid = max(self._last_tid, tid)
+ if self._last_tid is None:
+ self._last_tid = tid
+ else:
+ self._last_tid = max(self._last_tid, tid)
def reset(self):
"""
Modified: trunk/neo/master/verification.py
==============================================================================
--- trunk/neo/master/verification.py [iso-8859-1] (original)
+++ trunk/neo/master/verification.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -185,8 +185,9 @@
def answerLastIDs(self, conn, loid, ltid, lptid):
app = self.app
# If I get a bigger value here, it is dangerous.
- if app.loid < loid or app.tm.getLastTID() < ltid \
- or app.pt.getID() < lptid:
+ if (loid is not None and app.loid < loid) or \
+ (ltid is not None and app.tm.getLastTID() < ltid) or \
+ (lptid is not None and app.pt.getID() < lptid):
logging.critical('got later information in verification')
raise VerificationFailure
Modified: trunk/neo/protocol.py
==============================================================================
--- trunk/neo/protocol.py [iso-8859-1] (original)
+++ trunk/neo/protocol.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -453,6 +453,9 @@
def _decode(self, body):
(loid, ltid, lptid) = unpack('!8s8s8s', body)
+ if loid == INVALID_OID:
+ loid = None
+ ltid = _decodeTID(ltid)
lptid = _decodePTID(lptid)
return (loid, ltid, lptid)
Modified: trunk/neo/storage/replicator.py
==============================================================================
--- trunk/neo/storage/replicator.py [iso-8859-1] (original)
+++ trunk/neo/storage/replicator.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -37,6 +37,8 @@
return self.tid
def setCriticalTID(self, tid):
+ if tid is None:
+ tid = '\x00' * 8
self.tid = tid
def safe(self, pending_tid_list):
Modified: trunk/neo/tests/storage/testVerificationHandler.py
==============================================================================
--- trunk/neo/tests/storage/testVerificationHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testVerificationHandler.py [iso-8859-1] Fri Mar 26 17:57:20 2010
@@ -94,8 +94,8 @@
self.app.pt = Mock({'getID': last_ptid})
self.verification.askLastIDs(conn)
oid, tid, ptid = self.checkAnswerLastIDs(conn, decode=True)
- self.assertEqual(oid, INVALID_OID)
- self.assertEqual(tid, INVALID_TID)
+ self.assertEqual(oid, None)
+ self.assertEqual(tid, None)
self.assertEqual(ptid, last_ptid)
# return value stored in db
More information about the Neo-report
mailing list