Commit 520c5f01 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove unused variable declarations. Fix typo on logging method.

Remove an assert in Connection class that check a sub-class attribute.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@822 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5feef375
......@@ -291,7 +291,6 @@ class Connection(BaseConnection):
pass
except ConnectorConnectionRefusedException:
# should only occur while connecting
assert self.connecting
self.handler.connectionFailed(self)
self.close()
except ConnectorConnectionClosedException:
......@@ -432,7 +431,7 @@ class ClientConnection(Connection):
except ConnectorConnectionRefusedException:
handler.connectionFailed(self)
self.close()
except ConnectorException, msg:
except ConnectorException:
# unhandled connector exception
handler.connectionFailed(self)
self.close()
......
......@@ -377,7 +377,7 @@ class Application(object):
logging.info('begin the recovery of the status')
self.changeClusterState(protocol.RECOVERING)
em, nm = self.em, self.nm
em = self.em
self.loid = INVALID_OID
self.ltid = INVALID_TID
......
......@@ -170,7 +170,6 @@ class PartitionTable(neo.pt.PartitionTable):
for offset, row in enumerate(self.partition_list):
removed_cell_list = []
feeding_cell = None
out_of_date_cell_present = False
out_of_date_cell_list = []
up_to_date_cell_list = []
for cell in row:
......
......@@ -126,7 +126,6 @@ class RecoveryEventHandler(MasterEventHandler):
def handleAnswerPartitionTable(self, conn, packet, ptid, row_list):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
if uuid != app.target_uuid:
# If this is not from a target node, ignore it.
logging.warn('got answer partition table from %s while waiting for %s',
......
......@@ -171,8 +171,6 @@ class ClientServiceEventHandler(ServiceEventHandler):
del app.finishing_transaction_dict[tid]
def handleAbortTransaction(self, conn, packet, tid):
uuid = conn.getUUID()
node = self.app.nm.getNodeByUUID(uuid)
try:
del self.app.finishing_transaction_dict[tid]
except KeyError:
......@@ -180,24 +178,18 @@ class ClientServiceEventHandler(ServiceEventHandler):
pass
def handleAskNewTID(self, conn, packet):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
tid = app.getNextTID()
app.finishing_transaction_dict[tid] = FinishingTransaction(conn)
conn.answer(protocol.answerNewTID(tid), packet)
def handleAskNewOIDs(self, conn, packet, num_oids):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
oid_list = app.getNewOIDList(num_oids)
conn.answer(protocol.answerNewOIDs(oid_list), packet)
def handleFinishTransaction(self, conn, packet, oid_list, tid):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
# If the given transaction ID is later than the last TID, the peer
# is crazy.
if app.ltid < tid:
......@@ -303,9 +295,7 @@ class StorageServiceEventHandler(ServiceEventHandler):
pass
def handleAnswerLastIDs(self, conn, packet, loid, ltid, lptid):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
# If I get a bigger value here, it is dangerous.
if app.loid < loid or app.ltid < ltid or app.pt.getID() < lptid:
logging.critical('got later information in service')
......
......@@ -109,9 +109,7 @@ class VerificationEventHandler(MasterEventHandler):
app.broadcastNodeInformation(node)
def handleAnswerLastIDs(self, conn, packet, loid, ltid, lptid):
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
# If I get a bigger value here, it is dangerous.
if app.loid < loid or app.ltid < ltid or app.lptid < lptid:
logging.critical('got later information in verification')
......@@ -122,7 +120,6 @@ class VerificationEventHandler(MasterEventHandler):
logging.info('got unfinished transactions %s from %s:%d',
tid_list, *(conn.getAddress()))
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.asking_uuid_dict.get(uuid, True):
# No interest.
return
......@@ -135,7 +132,6 @@ class VerificationEventHandler(MasterEventHandler):
logging.info('got OIDs %s for %s from %s:%d',
oid_list, tid, *(conn.getAddress()))
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.asking_uuid_dict.get(uuid, True):
# No interest.
return
......@@ -154,7 +150,6 @@ class VerificationEventHandler(MasterEventHandler):
uuid = conn.getUUID()
logging.info('TID not found: %s', message)
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.asking_uuid_dict.get(uuid, True):
# No interest.
return
......@@ -165,7 +160,6 @@ class VerificationEventHandler(MasterEventHandler):
uuid = conn.getUUID()
logging.info('object %s:%s found', dump(oid), dump(tid))
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.asking_uuid_dict.get(uuid, True):
# No interest.
return
......@@ -175,7 +169,6 @@ class VerificationEventHandler(MasterEventHandler):
uuid = conn.getUUID()
logging.info('OID not found: %s', message)
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.asking_uuid_dict.get(uuid, True):
# No interest.
return
......
......@@ -268,7 +268,6 @@ class Application(object):
logging.info('doing operation')
em = self.em
nm = self.nm
handler = handlers.MasterOperationHandler(self)
self.master_conn.setHandler(handler)
......@@ -320,8 +319,8 @@ class Application(object):
l = len(self.event_queue)
p = self.event_queue.popleft
for i in xrange(l):
callable, args, kwargs = p()
callable(*args, **kwargs)
_callable, args, kwargs = p()
_callable(*args, **kwargs)
def getPartition(self, oid_or_tid):
return unpack('!Q', oid_or_tid)[0] % self.num_partitions
......
......@@ -28,7 +28,6 @@ class BootstrapHandler(BaseStorageHandler):
"""This class deals with events for a bootstrap phase."""
def connectionCompleted(self, conn):
app = self.app
conn.ask(protocol.askPrimaryMaster())
BaseStorageHandler.connectionCompleted(self, conn)
......
......@@ -80,7 +80,6 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
BaseClientAndStorageOperationHandler.connectionCompleted(self, conn)
def handleAbortTransaction(self, conn, packet, tid):
uuid = conn.getUUID()
app = self.app
try:
t = app.transaction_dict[tid]
......
......@@ -100,7 +100,6 @@ class BaseMasterHandler(BaseStorageHandler):
# XXX it might be better to implement this callback in each handler.
uuid = conn.getUUID()
app = self.app
node = app.nm.getNodeByUUID(uuid)
if app.primary_master_node is None \
or app.primary_master_node.getUUID() != uuid:
return
......
......@@ -52,8 +52,6 @@ class HiddenHandler(BaseStorageHandler):
return
for node_type, ip_address, port, uuid, state in node_list:
addr = (ip_address, port)
if node_type == STORAGE_NODE_TYPE:
if uuid == INVALID_UUID:
# No interest.
......
......@@ -40,8 +40,7 @@ class IdentificationHandler(BaseStorageHandler):
# reject any incoming connections if not ready
if not self.app.ready:
raise protocol.NotReadyError
app, nm = self.app, self.app.nm
server = (ip_address, port)
app = self.app
node = app.nm.getNodeByUUID(uuid)
if node is None:
logging.error('reject an unknown node %s', dump(uuid))
......
......@@ -132,8 +132,7 @@ class Replicator(object):
partition.setCriticalTID(tid)
del self.critical_tid_dict[msg_id]
except KeyError:
logging.infor("setCriticalTID raised KeyError for msg_id %s" %(msg_id,))
pass
logging.info("setCriticalTID raised KeyError for msg_id %s" %(msg_id,))
def _askCriticalTID(self):
conn = self.primary_master_connection
......
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