Commit 609531fa authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fix issue with replication, storager node ask for the partition table and the

node informations before entering in service/replication stage. 


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@735 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 127fe975
...@@ -651,7 +651,7 @@ class Application(object): ...@@ -651,7 +651,7 @@ class Application(object):
# a node seems dead and should be dropped frop the # a node seems dead and should be dropped frop the
# partition table. This should not be done # partition table. This should not be done
# automaticaly to avoid data lost. # automaticaly to avoid data lost.
#node.setState(DOWN_STATE) node.setState(DOWN_STATE)
#self.broadcastNodeInformation(node) #self.broadcastNodeInformation(node)
#cell_list = self.pt.dropNode(node) #cell_list = self.pt.dropNode(node)
#self.broadcastPartitionChanges(self.pt.setNextID(), cell_list) #self.broadcastPartitionChanges(self.pt.setNextID(), cell_list)
......
...@@ -22,6 +22,7 @@ from struct import unpack, pack ...@@ -22,6 +22,7 @@ from struct import unpack, pack
from collections import deque from collections import deque
from neo.config import ConfigurationManager from neo.config import ConfigurationManager
from neo import protocol
from neo.protocol import TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \ from neo.protocol import TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \
INVALID_UUID, INVALID_PTID, partition_cell_states, HIDDEN_STATE INVALID_UUID, INVALID_PTID, partition_cell_states, HIDDEN_STATE
from neo.node import NodeManager, MasterNode, StorageNode, ClientNode from neo.node import NodeManager, MasterNode, StorageNode, ClientNode
...@@ -69,6 +70,10 @@ class Application(object): ...@@ -69,6 +70,10 @@ class Application(object):
self.primary_master_node = None self.primary_master_node = None
self.replicator = None self.replicator = None
self.listening_conn = None self.listening_conn = None
self.master_conn = None
self.has_node_information = False
self.has_partition_table = False
self.dm.setup(reset) self.dm.setup(reset)
self.loadConfiguration() self.loadConfiguration()
...@@ -140,6 +145,7 @@ class Application(object): ...@@ -140,6 +145,7 @@ class Application(object):
self.listening_conn = None self.listening_conn = None
# look for the primary master # look for the primary master
self.connectToPrimaryMaster() self.connectToPrimaryMaster()
assert self.master_conn is not None
if self.uuid == INVALID_UUID: if self.uuid == INVALID_UUID:
raise RuntimeError, 'No UUID supplied from the primary master' raise RuntimeError, 'No UUID supplied from the primary master'
# Make a listening port when connected to the primary # Make a listening port when connected to the primary
...@@ -226,6 +232,7 @@ class Application(object): ...@@ -226,6 +232,7 @@ class Application(object):
if node is self.primary_master_node: if node is self.primary_master_node:
# Yes, I have. # Yes, I have.
conn.setHandler(VerificationEventHandler(self)) conn.setHandler(VerificationEventHandler(self))
self.master_conn = conn
return return
def verifyData(self): def verifyData(self):
...@@ -243,6 +250,12 @@ class Application(object): ...@@ -243,6 +250,12 @@ class Application(object):
while not self.operational: while not self.operational:
em.poll(1) em.poll(1)
# ask node list
self.master_conn.ask(protocol.askNodeInformation())
self.master_conn.ask(protocol.askPartitionTable(()))
while not self.has_node_information or not self.has_partition_table:
em.poll(1)
def doOperation(self): def doOperation(self):
"""Handle everything, including replications and transactions.""" """Handle everything, including replications and transactions."""
logging.info('doing operation') logging.info('doing operation')
......
...@@ -117,6 +117,14 @@ class VerificationEventHandler(StorageEventHandler): ...@@ -117,6 +117,14 @@ class VerificationEventHandler(StorageEventHandler):
p = protocol.answerLastIDs(oid, tid, app.ptid) p = protocol.answerLastIDs(oid, tid, app.ptid)
conn.answer(p, packet) conn.answer(p, packet)
def handleAnswerNodeInformation(self, conn, packet, node_list):
assert not node_list
self.app.has_node_information = True
def handleAnswerPartitionTable(self, conn, packet, ptid, row_list):
assert not row_list
self.app.has_partition_table = True
@decorators.client_connection_required @decorators.client_connection_required
def handleAskPartitionTable(self, conn, packet, offset_list): def handleAskPartitionTable(self, conn, packet, offset_list):
app = self.app 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