Commit 073ce093 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make pt.log() more robust. Do not delete cell lists in protocol handling (what was this for?).

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@206 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1154f37b
......@@ -18,6 +18,7 @@ from neo.master.verification import VerificationEventHandler
from neo.master.service import ServiceEventHandler
from neo.master.secondary import SecondaryEventHandler
from neo.pt import PartitionTable
from neo.util import dump
class Application(object):
"""The master node application."""
......@@ -401,11 +402,15 @@ class Application(object):
if self.lptid != prev_lptid or not self.pt.filled():
# I got something newer or the target is dead.
logging.debug('self.lptid = %s, prev_lptid = %s',
dump(self.lptid), dump(prev_lptid))
self.pt.log()
continue
# Wait until the cluster gets operational or the Partition Table ID
# turns out to be not the latest.
logging.debug('waiting for the cluster to be operational')
self.pt.log()
while 1:
em.poll(1)
if self.pt.operational():
......
......@@ -316,6 +316,8 @@ class RecoveryEventHandler(MasterEventHandler):
return
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',
dump(uuid), dump(app.target_uuid))
return
for offset, cell_list in row_list:
......
......@@ -790,7 +790,6 @@ class Packet(object):
index += 18
cell_list.append(cell)
row_list.append((offset, cell_list))
del cell_list[:]
except:
raise ProtocolError(self, 'invalid answer partition table')
return ptid, row_list
......@@ -810,7 +809,6 @@ class Packet(object):
index += 18
cell_list.append(cell)
row_list.append((offset, tuple(cell_list)))
del cell_list[:]
except:
raise ProtocolError(self, 'invalid send partition table')
return ptid, row_list
......
......@@ -152,11 +152,14 @@ class PartitionTable(object):
FEEDING_STATE: 'F' }
for offset, row in enumerate(self.partition_list):
desc_list = []
for cell in row:
i = node_dict[cell.getNode()]
cell_state = cell_state_dict[cell.getState()]
node_state = node_state_dict[cell.getNodeState()]
desc_list.append('%d %s %s' % (i, cell_state, node_state))
if row is None:
desc_list.append('None')
else:
for cell in row:
i = node_dict[cell.getNode()]
cell_state = cell_state_dict[cell.getState()]
node_state = node_state_dict[cell.getNodeState()]
desc_list.append('%d %s %s' % (i, cell_state, node_state))
logging.debug('pt: row %d: %s', offset, ', '.join(desc_list))
def operational(self):
......
......@@ -252,6 +252,7 @@ class Replicator(object):
pass
def _askCriticalTID(self):
logging.debug('self.new_partition_list = %r', self.new_partition_list)
conn = self.primary_master_connection
msg_id = conn.getNextId()
conn.addPacket(Packet().askLastIDs(msg_id))
......@@ -268,7 +269,7 @@ class Replicator(object):
def _askUnfinishedTIDs(self):
conn = self.primary_master_connection
msg_id = conn.getNextId()
conn.addPacket(Packet().askUnfinishedTIDs(msg_id))
conn.addPacket(Packet().askUnfinishedTransactions(msg_id))
conn.expectMessage(msg_id)
self.waiting_for_unfinished_tids = True
......
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