[Neo-report] r2091 gregory - in /trunk/neo/master: pt.py recovery.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri May 7 16:50:16 CEST 2010
Author: gregory
Date: Fri May 7 16:50:15 2010
New Revision: 2091
Log:
Implement master-dedicated PartitionTable.load() method.
A master load a partition table from the network only during recovery, this
operation requires a different behaviour than the load() for other nodes.
Check incoming data and raise before any change on the partition table to
avoid inconsistency between ptid and partition table data.
Modified:
trunk/neo/master/pt.py
trunk/neo/master/recovery.py
Modified: trunk/neo/master/pt.py
==============================================================================
--- trunk/neo/master/pt.py [iso-8859-1] (original)
+++ trunk/neo/master/pt.py [iso-8859-1] Fri May 7 16:50:15 2010
@@ -103,6 +103,28 @@
pass
return cell_list
+
+ def load(self, ptid, row_list, nm):
+ """
+ Load a partition table from a storage node during the recovery.
+ Return the new storage nodes registered
+ """
+ # check offsets
+ for offset, _row in row_list:
+ if offset >= self.getPartitions():
+ raise IndexError, offset
+ # store the partition table
+ self.clear()
+ self.id = ptid
+ new_nodes = []
+ for offset, row in row_list:
+ for uuid, state in row:
+ node = nm.getByUUID(uuid)
+ if node is None:
+ node = nm.createStorage(uuid=uuid)
+ new_nodes.append(node)
+ self.setCell(offset, node, state)
+ return new_nodes
def addNode(self, node):
"""Add a node. Take it into account that it might not be really a new
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:50:15 2010
@@ -136,22 +136,12 @@
logging.warn('Got %s while waiting %s', dump(ptid),
dump(self.target_ptid))
return
- # load unknown storage nodes
- new_nodes = []
- for _offset, row in row_list:
- for uuid, _state in row:
- node = app.nm.getByUUID(uuid)
- if node is None:
- new_nodes.append(app.nm.createStorage(uuid=uuid))
- # notify about new nodes
- if new_nodes:
- self.app.broadcastNodesInformation(new_nodes)
- # load partition in memory
try:
- self.app.pt.load(ptid, row_list, self.app.nm)
+ new_nodes = self.app.pt.load(ptid, row_list, self.app.nm)
except IndexError:
raise ProtocolError('Invalid offset')
else:
+ self.app.broadcastNodesInformation(new_nodes)
# notify the admin nodes
for node in self.app.nm.getAdminList(only_identified=True):
self.app.sendPartitionTable(node.getConnection())
More information about the Neo-report
mailing list