diff --git a/synapse/storage/controllers/persist_events.py b/synapse/storage/controllers/persist_events.py index d0e015bf19c..b002d482b12 100644 --- a/synapse/storage/controllers/persist_events.py +++ b/synapse/storage/controllers/persist_events.py @@ -1114,6 +1114,9 @@ async def _calculate_state_delta( if ev_id != existing_state.get(key) } + logger.info("asdf _calculate_state_delta existing_state %s", existing_state) + logger.info("asdf _calculate_state_delta current_state %s", current_state) + return DeltaState(to_delete=to_delete, to_insert=to_insert) async def _is_server_still_joined( diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index 1f7acdb8592..f4d89f6142c 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -1131,6 +1131,8 @@ async def update_current_state( ) -> None: """Update the current state stored in the datatabase for the given room""" + logger.info("asdf state_delta: %s", state_delta) + if state_delta.is_noop(): return @@ -1153,6 +1155,8 @@ def _update_current_state_txn( 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 9847893fce7..2e568be69f9 100644 --- a/tests/handlers/test_federation.py +++ b/tests/handlers/test_federation.py @@ -681,6 +681,17 @@ def test_failed_partial_join_is_clean(self) -> None: 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.