Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially-stated room that we fail to join updates current state and indicates that it's in the room #17602

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions synapse/storage/controllers/persist_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/handlers/test_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading