Commit aeda6d88 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Partial revert of the previous commit. A dead lock was introduced instead of

fix a potential bug. The ptid attribute on app is still removed.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1079 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 9e4f6725
## #
# 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
...@@ -389,7 +389,7 @@ class Application(object): ...@@ -389,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.
...@@ -398,12 +398,12 @@ class Application(object): ...@@ -398,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):
...@@ -731,7 +731,7 @@ class Application(object): ...@@ -731,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:
...@@ -889,7 +889,7 @@ class Application(object): ...@@ -889,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,13 +150,15 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -150,13 +150,15 @@ class PrimaryNotificationsHandler(BaseHandler):
finally: finally:
app._cache_lock_release() app._cache_lock_release()
# For the two methods below, we must not use app._getPartitionTable()
# to avoid a dead lock. It is safe to not check the master connection
# because it's in the master handler, so the connection is already
# established.
def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list): def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list):
pt = self.app.getPartitionTable() self.app.pt.update(ptid, cell_list, self.app.nm)
pt.update(ptid, cell_list, self.app.nm)
def handleSendPartitionTable(self, conn, packet, ptid, row_list): def handleSendPartitionTable(self, conn, packet, ptid, row_list):
pt = self.app.getPartitionTable() self.app.pt.load(ptid, row_list, self.app.nm)
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