Clean up some logging (#6515)

This just makes some of the logging easier to follow when things start going
wrong.
This commit is contained in:
Richard van der Hoff 2019-12-11 14:32:25 +00:00 committed by GitHub
parent adb3a873fd
commit 7c429f92d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

1
changelog.d/6515.misc Normal file
View File

@ -0,0 +1 @@
Clean up some logging when handling incoming events over federation.

View File

@ -183,7 +183,7 @@ class FederationHandler(BaseHandler):
room_id = pdu.room_id room_id = pdu.room_id
event_id = pdu.event_id event_id = pdu.event_id
logger.info("[%s %s] handling received PDU: %s", room_id, event_id, pdu) logger.info("handling received PDU: %s", pdu)
# We reprocess pdus when we have seen them only as outliers # We reprocess pdus when we have seen them only as outliers
existing = yield self.store.get_event( existing = yield self.store.get_event(
@ -279,9 +279,15 @@ class FederationHandler(BaseHandler):
len(missing_prevs), len(missing_prevs),
) )
yield self._get_missing_events_for_pdu( try:
origin, pdu, prevs, min_depth yield self._get_missing_events_for_pdu(
) origin, pdu, prevs, min_depth
)
except Exception as e:
raise Exception(
"Error fetching missing prev_events for %s: %s"
% (event_id, e)
)
# Update the set of things we've seen after trying to # Update the set of things we've seen after trying to
# fetch the missing stuff # fetch the missing stuff
@ -293,14 +299,6 @@ class FederationHandler(BaseHandler):
room_id, room_id,
event_id, event_id,
) )
elif missing_prevs:
logger.info(
"[%s %s] Not recursively fetching %d missing prev_events: %s",
room_id,
event_id,
len(missing_prevs),
shortstr(missing_prevs),
)
if prevs - seen: if prevs - seen:
# We've still not been able to get all of the prev_events for this event. # We've still not been able to get all of the prev_events for this event.
@ -345,6 +343,12 @@ class FederationHandler(BaseHandler):
affected=pdu.event_id, affected=pdu.event_id,
) )
logger.info(
"Event %s is missing prev_events: calculating state for a "
"backwards extremity",
event_id,
)
# Calculate the state after each of the previous events, and # Calculate the state after each of the previous events, and
# resolve them to find the correct state at the current event. # resolve them to find the correct state at the current event.
auth_chains = set() auth_chains = set()
@ -365,10 +369,7 @@ class FederationHandler(BaseHandler):
# know about # know about
for p in prevs - seen: for p in prevs - seen:
logger.info( logger.info(
"[%s %s] Requesting state at missing prev_event %s", "Requesting state at missing prev_event %s", event_id,
room_id,
event_id,
p,
) )
room_version = yield self.store.get_room_version(room_id) room_version = yield self.store.get_room_version(room_id)
@ -612,8 +613,8 @@ class FederationHandler(BaseHandler):
failed_to_fetch = desired_events - event_map.keys() failed_to_fetch = desired_events - event_map.keys()
if failed_to_fetch: if failed_to_fetch:
logger.warning( logger.warning(
"Failed to fetch missing state/auth events for %s: %s", "Failed to fetch missing state/auth events for %s %s",
room_id, event_id,
failed_to_fetch, failed_to_fetch,
) )