Commit 12c970c6 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Client node use PartitionTable.load() and ask node informations before partition

table.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1073 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 03b71f1e
......@@ -489,14 +489,14 @@ class Application(object):
conn.lock()
try:
msg_id = conn.ask(self.local_var.queue,
protocol.askPartitionTable([]))
protocol.askNodeInformation())
finally:
conn.unlock()
self._waitMessage(conn, msg_id, handler=self.primary_bootstrap_handler)
conn.lock()
try:
msg_id = conn.ask(self.local_var.queue,
protocol.askNodeInformation())
protocol.askPartitionTable([]))
finally:
conn.unlock()
self._waitMessage(conn, msg_id, handler=self.primary_bootstrap_handler)
......
......@@ -152,41 +152,17 @@ class PrimaryNotificationsHandler(BaseHandler):
def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list):
# XXX: delegate this test to the partition table and use the pt.getID()
# instead of app.ptid
app = self.app
if app.ptid >= ptid:
# Ignore this packet.
return
return
app.ptid = ptid
app.pt.update(ptid, cell_list, app.nm)
self.app.pt.update(ptid, cell_list, self.app.nm)
def handleSendPartitionTable(self, conn, packet, ptid, row_list):
# This handler is in PrimaryBootstrapHandler, since this
# basicaly is an answer to askPrimaryMaster.
# Extract from P-NEO-Protocol.Description:
# Connection to primary master node (PMN in service state)
# CN -> PMN : askPrimaryMaster
# PMN -> CN : answerPrimaryMaster containing primary uuid and no
# known master list
# PMN -> CN : notifyNodeInformation containing list of all
# ASK_STORE_TRANSACTION# PMN -> CN : sendPartitionTable containing partition table id and
# list of rows
# notifyNodeInformation is valid as asynchrounous event, but
# sendPartitionTable is only triggered after askPrimaryMaster.
uuid = conn.getUUID()
app = self.app
nm = app.nm
pt = app.pt
if app.ptid != ptid:
app.ptid = ptid
pt.clear()
for offset, row in row_list:
for uuid, state in row:
node = nm.getNodeByUUID(uuid)
if node is None:
node = StorageNode(uuid = uuid)
node.setState(TEMPORARILY_DOWN_STATE)
nm.add(node)
pt.setCell(offset, node, state)
self.app.pt.load(ptid, row_list, self.app.nm)
def handleNotifyNodeInformation(self, conn, packet, node_list):
app = self.app
......
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