From 664065a44eafb24c6c3b1df227d65a8c8ad1be76 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 22 Aug 2024 19:59:21 -0500 Subject: [PATCH] Trace current_state_events --- synapse/storage/databases/main/events.py | 2 ++ tests/handlers/test_federation.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index 37d7ae6912..f4d89f6142 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -1155,6 +1155,8 @@ class PersistEventsStore: to_delete = delta_state.to_delete to_insert = delta_state.to_insert + logger.info("asdf _update_current_state_txn: %s %s", to_delete, to_insert) + # Figure out the changes of membership to invalidate the # `get_rooms_for_user` cache. # We find out which membership events we may have deleted diff --git a/tests/handlers/test_federation.py b/tests/handlers/test_federation.py index 9847893fce..2e568be69f 100644 --- a/tests/handlers/test_federation.py +++ b/tests/handlers/test_federation.py @@ -681,6 +681,17 @@ class PartialJoinTestCase(unittest.FederatingHomeserverTestCase): f" failed do_invite_join!", ) + # Sanity check that we're not leaving behind any current state events. + current_state_check_rows = self.get_success( + store.db_pool.simple_select_list( + table="current_state_events", + keyvalues={"room_id": room_id}, + retcols=("event_id",), + desc="check current_state_events in test", + ) + ) + self.assertEqual(len(current_state_check_rows), 0) + def test_duplicate_partial_state_room_syncs(self) -> None: """ Tests that concurrent partial state syncs are not started for the same room.