Commit 0a511052 authored by Julien Muchembled's avatar Julien Muchembled

storage: code simplication, dead code removal

parent 900d4908
...@@ -76,8 +76,6 @@ class Application(object): ...@@ -76,8 +76,6 @@ class Application(object):
# ready is True when operational and got all informations # ready is True when operational and got all informations
self.ready = False self.ready = False
self.has_node_information = False
self.has_partition_table = False
self.dm.setup(reset=config.getReset()) self.dm.setup(reset=config.getReset())
self.loadConfiguration() self.loadConfiguration()
...@@ -278,15 +276,11 @@ class Application(object): ...@@ -278,15 +276,11 @@ class Application(object):
self.master_conn.setHandler(handler) self.master_conn.setHandler(handler)
# ask node list and partition table # ask node list and partition table
self.has_node_information = False
self.has_partition_table = False
self.has_last_ids = False
self.pt.clear() self.pt.clear()
self.master_conn.ask(Packets.AskLastIDs()) self.master_conn.ask(Packets.AskLastIDs())
self.master_conn.ask(Packets.AskNodeInformation()) self.master_conn.ask(Packets.AskNodeInformation())
self.master_conn.ask(Packets.AskPartitionTable()) self.master_conn.ask(Packets.AskPartitionTable())
while not self.has_node_information or not self.has_partition_table \ while self.master_conn.isPending():
or not self.has_last_ids:
_poll() _poll()
self.ready = True self.ready = True
self.replicator.populate() self.replicator.populate()
......
...@@ -23,7 +23,7 @@ from neo.lib import protocol ...@@ -23,7 +23,7 @@ from neo.lib import protocol
class InitializationHandler(BaseMasterHandler): class InitializationHandler(BaseMasterHandler):
def answerNodeInformation(self, conn): def answerNodeInformation(self, conn):
self.app.has_node_information = True pass
def notifyNodeInformation(self, conn, node_list): def notifyNodeInformation(self, conn, node_list):
# the whole node list is received here # the whole node list is received here
...@@ -53,11 +53,9 @@ class InitializationHandler(BaseMasterHandler): ...@@ -53,11 +53,9 @@ class InitializationHandler(BaseMasterHandler):
app.dm.dropPartitions(num_partitions, unassigned_set) app.dm.dropPartitions(num_partitions, unassigned_set)
app.dm.setPartitionTable(ptid, cell_list) app.dm.setPartitionTable(ptid, cell_list)
self.app.has_partition_table = True
def answerLastIDs(self, conn, loid, ltid, lptid): def answerLastIDs(self, conn, loid, ltid, lptid):
self.app.dm.setLastOID(loid) self.app.dm.setLastOID(loid)
self.app.has_last_ids = True
def notifyPartitionChanges(self, conn, ptid, cell_list): def notifyPartitionChanges(self, conn, ptid, cell_list):
# XXX: This is safe to ignore those notifications because all of the # XXX: This is safe to ignore those notifications because all of the
......
...@@ -24,9 +24,6 @@ from . import BaseMasterHandler ...@@ -24,9 +24,6 @@ from . import BaseMasterHandler
class MasterOperationHandler(BaseMasterHandler): class MasterOperationHandler(BaseMasterHandler):
""" This handler is used for the primary master """ """ This handler is used for the primary master """
def answerLastIDs(self, conn, loid, ltid, lptid):
self.app.replicator.setCriticalTID(ltid)
def answerUnfinishedTransactions(self, conn, max_tid, ttid_list): def answerUnfinishedTransactions(self, conn, max_tid, ttid_list):
self.app.replicator.setUnfinishedTIDList(max_tid, ttid_list) self.app.replicator.setUnfinishedTIDList(max_tid, ttid_list)
......
...@@ -164,20 +164,6 @@ class StorageMasterHandlerTests(NeoUnitTestBase): ...@@ -164,20 +164,6 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
calls[0].checkArgs(tid) calls[0].checkArgs(tid)
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
def test_30_answerLastIDs(self):
# set critical TID on replicator
conn = self.getFakeConnection()
self.app.replicator = Mock()
self.operation.answerLastIDs(
conn=conn,
loid=INVALID_OID,
ltid=INVALID_TID,
lptid=INVALID_TID,
)
calls = self.app.replicator.mockGetNamedCalls('setCriticalTID')
self.assertEqual(len(calls), 1)
calls[0].checkArgs(INVALID_TID)
def test_31_answerUnfinishedTransactions(self): def test_31_answerUnfinishedTransactions(self):
# set unfinished TID on replicator # set unfinished TID on replicator
conn = self.getFakeConnection() conn = self.getFakeConnection()
......
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