[Neo-report] r2087 gregory - in /trunk/neo: master/recovery.py tests/master/testRecovery.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri May 7 16:49:30 CEST 2010
Author: gregory
Date: Fri May 7 16:49:29 2010
New Revision: 2087
Log:
Store the PTID out of the manager until the partition is received.
There was an inconsistency between the ptid and the partition table stored
in the manager between the processing of the AnswerLastIDs and the
AnswerPartitionTable packets. A storage could disconnect leaving the
master with a wrong partition table.
Modified:
trunk/neo/master/recovery.py
trunk/neo/tests/master/testRecovery.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 May 7 16:49:29 2010
@@ -33,7 +33,7 @@
def __init__(self, app):
super(RecoveryManager, self).__init__(app)
# The target node's uuid to request next.
- self.target_uuid = None
+ self.target_ptid = None
def getHandler(self):
return self
@@ -116,8 +116,6 @@
def answerLastIDs(self, conn, loid, ltid, lptid):
app = self.app
- pt = app.pt
-
# Get max values.
if loid is not None:
if app.loid is None:
@@ -126,19 +124,17 @@
app.loid = max(loid, app.loid)
if ltid is not None:
self.app.tm.setLastTID(ltid)
- if lptid > pt.getID():
+ if lptid > self.target_ptid:
# something newer
- self.target_uuid = conn.getUUID()
- app.pt.setID(lptid)
+ self.target_ptid = lptid
conn.ask(Packets.AskPartitionTable([]))
def answerPartitionTable(self, conn, ptid, row_list):
- uuid = conn.getUUID()
app = self.app
- if uuid != self.target_uuid:
+ if ptid != self.target_ptid:
# If this is not from a target node, ignore it.
- logging.warn('got answer partition table from %s while waiting ' \
- 'for %s', dump(uuid), dump(self.target_uuid))
+ logging.warn('Got %s while waiting %s', dump(ptid),
+ dump(self.target_ptid))
return
# load unknown storage nodes
new_nodes = []
Modified: trunk/neo/tests/master/testRecovery.py
==============================================================================
--- trunk/neo/tests/master/testRecovery.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testRecovery.py [iso-8859-1] Fri May 7 16:49:29 2010
@@ -112,7 +112,7 @@
recovery.answerLastIDs(conn, new_oid, new_tid, new_ptid)
self.assertEquals(new_oid, self.app.loid)
self.assertEquals(new_tid, self.app.tm.getLastTID())
- self.assertEquals(new_ptid, self.app.pt.getID())
+ self.assertEquals(new_ptid, recovery.target_ptid)
def test_10_answerPartitionTable(self):
@@ -126,7 +126,8 @@
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
- recovery.answerPartitionTable(conn, None, cell_list)
+ recovery.target_ptid = 2
+ recovery.answerPartitionTable(conn, 1, cell_list)
cells = self.app.pt.getRow(offset)
for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE)
@@ -148,7 +149,7 @@
self.assertFalse(self.app.pt.hasOffset(offset))
cell_list = [(offset, ((uuid, NodeStates.DOWN,),),)]
self.checkProtocolErrorRaised(recovery.answerPartitionTable, conn,
- None, cell_list)
+ 2, cell_list)
if __name__ == '__main__':
More information about the Neo-report
mailing list