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.