Commit 49e7d17f authored by Julien Muchembled's avatar Julien Muchembled

neolog: do not die when a table is corrupted

parent ad379295
...@@ -107,20 +107,37 @@ class Log(object): ...@@ -107,20 +107,37 @@ class Log(object):
self._reload(p[0]) self._reload(p[0])
except StopIteration: except StopIteration:
p = None p = None
for date, name, cluster, nid, level, pathname, lineno, msg in nl: except sqlite3.DatabaseError, e:
while p and p[0] < date: yield time.time(), None, 'PACKET', self._exc(e)
yield self._packet(*p) p = None
p = next(np, None) try:
self._log_date = date for date, name, cluster, nid, level, pathname, lineno, msg in nl:
yield (date, self._node(name, cluster, nid), while p and p[0] < date:
getLevelName(level), msg.splitlines()) yield self._packet(*p)
try:
p = next(np, None)
except sqlite3.DatabaseError, e:
yield time.time(), None, 'PACKET', self._exc(e)
p = None
self._log_date = date
yield (date, self._node(name, cluster, nid),
getLevelName(level), msg.splitlines())
except sqlite3.DatabaseError, e:
yield time.time(), None, 'LOG', self._exc(e)
if p: if p:
yield self._packet(*p) yield self._packet(*p)
for p in np: try:
yield self._packet(*p) for p in np:
yield self._packet(*p)
except sqlite3.DatabaseError, e:
yield time.time(), None, 'PACKET', self._exc(e)
finally: finally:
self._db.rollback() self._db.rollback()
@staticmethod
def _exc(e):
return ('%s: %s' % (type(e).__name__, e)).splitlines()
def _node(self, name, cluster, nid): def _node(self, name, cluster, nid):
if nid and not self._no_nid: if nid and not self._no_nid:
name = self.uuid_str(nid) name = self.uuid_str(nid)
......
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