summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-08-10 17:56:09 +0100
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-08-10 17:56:09 +0100
commit794897e5016213894af5c7ab8238f73be8b8b439 (patch)
tree755f76256ad508efa468c059218b0365cb0af38f
parentMention specific version in rc2 notes (diff)
downloadsynapse-794897e5016213894af5c7ab8238f73be8b8b439.tar.xz
Add some logging
-rw-r--r--synapse/storage/controllers/persist_events.py7
-rw-r--r--synapse/storage/databases/main/events.py21
2 files changed, 20 insertions, 8 deletions
diff --git a/synapse/storage/controllers/persist_events.py b/synapse/storage/controllers/persist_events.py
index cf98b0ab48..2065feb4d0 100644
--- a/synapse/storage/controllers/persist_events.py
+++ b/synapse/storage/controllers/persist_events.py
@@ -655,6 +655,8 @@ class EventsPersistenceStorageController:
                         with Measure(
                             self._clock, "persist_events.get_new_state_after_events"
                         ):
+                            logger.debug("old extremities: %r", latest_event_ids)
+                            logger.debug("new extremities: %r", new_latest_event_ids)
                             res = await self._get_new_state_after_events(
                                 room_id,
                                 ev_ctx_rm,
@@ -662,6 +664,11 @@ class EventsPersistenceStorageController:
                                 new_latest_event_ids,
                             )
                             current_state, delta_ids, new_latest_event_ids = res
+                            logger.debug(
+                                "delta IDs: %r, new latest event IDs: %r",
+                                delta_ids,
+                                new_latest_event_ids,
+                            )
 
                             # there should always be at least one forward extremity.
                             # (except during the initial persistence of the send_join
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
index 1f600f1190..8695b7d72d 100644
--- a/synapse/storage/databases/main/events.py
+++ b/synapse/storage/databases/main/events.py
@@ -209,14 +209,19 @@ class PersistEventsStore:
             for (event, _), stream in zip(events_and_contexts, stream_orderings):
                 event.internal_metadata.stream_ordering = stream
 
-            await self.db_pool.runInteraction(
-                "persist_events",
-                self._persist_events_txn,
-                events_and_contexts=events_and_contexts,
-                inhibit_local_membership_updates=inhibit_local_membership_updates,
-                state_delta_for_room=state_delta_for_room,
-                new_forward_extremities=new_forward_extremities,
-            )
+            try:
+                await self.db_pool.runInteraction(
+                    "persist_events",
+                    self._persist_events_txn,
+                    events_and_contexts=events_and_contexts,
+                    inhibit_local_membership_updates=inhibit_local_membership_updates,
+                    state_delta_for_room=state_delta_for_room,
+                    new_forward_extremities=new_forward_extremities,
+                )
+            except Exception:
+                logger.debug("events_and_contexts: %r", events_and_contexts)
+                logger.debug("state_delta_for_room: %r", state_delta_for_room)
+                raise
             persist_event_counter.inc(len(events_and_contexts))
 
             if not use_negative_stream_ordering: