Commit 9e4f6725 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove an XXX: _getPartition is no more private because it's now used by the

master handler to ensure that the master connection is well established. Check
of greater ptid received with incremental partition table update is now done by
the PartitionTable class.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1078 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1b28f75a
# ##
# Copyright (C) 2006-2009 Nexedi SA # Copyright (C) 2006-2009 Nexedi SA
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
...@@ -272,7 +272,6 @@ class Application(object): ...@@ -272,7 +272,6 @@ class Application(object):
self.uuid = None self.uuid = None
self.mq_cache = MQ() self.mq_cache = MQ()
self.new_oid_list = [] self.new_oid_list = []
self.ptid = None
self.last_oid = '\0' * 8 self.last_oid = '\0' * 8
self.storage_event_handler = storage.StorageEventHandler(self, self.dispatcher) self.storage_event_handler = storage.StorageEventHandler(self, self.dispatcher)
self.storage_bootstrap_handler = storage.StorageBootstrapHandler(self) self.storage_bootstrap_handler = storage.StorageBootstrapHandler(self)
...@@ -390,7 +389,7 @@ class Application(object): ...@@ -390,7 +389,7 @@ class Application(object):
finally: finally:
self._connecting_to_master_node_release() self._connecting_to_master_node_release()
def _getPartitionTable(self): def getPartitionTable(self):
""" Return the partition table manager, reconnect the PMN if needed """ """ Return the partition table manager, reconnect the PMN if needed """
# this ensure the master connection is established and the partition # this ensure the master connection is established and the partition
# table is up to date. # table is up to date.
...@@ -399,12 +398,12 @@ class Application(object): ...@@ -399,12 +398,12 @@ class Application(object):
def _getCellListForOID(self, oid, readable=False, writable=False): def _getCellListForOID(self, oid, readable=False, writable=False):
""" Return the cells available for the specified OID """ """ Return the cells available for the specified OID """
pt = self._getPartitionTable() pt = self.getPartitionTable()
return pt.getCellListForOID(oid, readable, writable) return pt.getCellListForOID(oid, readable, writable)
def _getCellListForTID(self, tid, readable=False, writable=False): def _getCellListForTID(self, tid, readable=False, writable=False):
""" Return the cells available for the specified TID """ """ Return the cells available for the specified TID """
pt = self._getPartitionTable() pt = self.getPartitionTable()
return pt.getCellListForTID(tid, readable, writable) return pt.getCellListForTID(tid, readable, writable)
def _connectToPrimaryMasterNode(self): def _connectToPrimaryMasterNode(self):
...@@ -732,7 +731,7 @@ class Application(object): ...@@ -732,7 +731,7 @@ class Application(object):
ext = dumps(transaction._extension) ext = dumps(transaction._extension)
oid_list = self.local_var.data_dict.keys() oid_list = self.local_var.data_dict.keys()
# Store data on each node # Store data on each node
pt = self._getPartitionTable() pt = self.getPartitionTable()
cell_list = self._getCellListForTID(self.local_var.tid, writable=True) cell_list = self._getCellListForTID(self.local_var.tid, writable=True)
self.local_var.voted_counter = 0 self.local_var.voted_counter = 0
for cell in cell_list: for cell in cell_list:
...@@ -890,7 +889,7 @@ class Application(object): ...@@ -890,7 +889,7 @@ class Application(object):
# First get a list of transactions from all storage nodes. # First get a list of transactions from all storage nodes.
# Each storage node will return TIDs only for UP_TO_DATE_STATE and # Each storage node will return TIDs only for UP_TO_DATE_STATE and
# FEEDING_STATE cells # FEEDING_STATE cells
pt = self._getPartitionTable() pt = self.getPartitionTable()
storage_node_list = pt.getNodeList() storage_node_list = pt.getNodeList()
self.local_var.node_tids = {} self.local_var.node_tids = {}
......
...@@ -150,19 +150,13 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -150,19 +150,13 @@ class PrimaryNotificationsHandler(BaseHandler):
finally: finally:
app._cache_lock_release() app._cache_lock_release()
def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list): def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list):
# XXX: delegate this test to the partition table and use the pt.getID() pt = self.app.getPartitionTable()
# instead of app.ptid pt.update(ptid, cell_list, self.app.nm)
app = self.app
if app.ptid >= ptid:
# Ignore this packet.
return
app.ptid = ptid
self.app.pt.update(ptid, cell_list, self.app.nm)
def handleSendPartitionTable(self, conn, packet, ptid, row_list): def handleSendPartitionTable(self, conn, packet, ptid, row_list):
self.app.pt.load(ptid, row_list, self.app.nm) pt = self.app.getPartitionTable()
pt.load(ptid, row_list, self.app.nm)
def handleNotifyNodeInformation(self, conn, packet, node_list): def handleNotifyNodeInformation(self, conn, packet, node_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