Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Faster joins: Update room stats and user directory on workers when done
Browse files Browse the repository at this point in the history
When finishing a partial state join to a room, we update the current
state of the room without persisting additional events. Workers receive
notice of the current state update over replication, but neglect to wake
the room stats and user directory updaters, which then get incidentally
triggered the next time an event is persisted or an unrelated event
persister sends out a stream position update.

We wake the room stats and user directory updaters at the appropriate
time in this commit.

Part of #12814 and #12815.

Signed-off-by: Sean Quah <[email protected]>
  • Loading branch information
Sean Quah committed Jan 19, 2023
1 parent a7b54ca commit e921504
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/14874.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: Fix a bug in worker deployments where the room stats and user directory would not get updated when finishing a fast join until another event is sent or received.
4 changes: 0 additions & 4 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1735,10 +1735,6 @@ async def _sync_partial_state_room(
# Poke the notifier so that other workers see the write to
# the un-partial-stated rooms stream.
self._notifier.notify_replication()

# TODO(faster_joins) update room stats and user directory?
# https://github.com/matrix-org/synapse/issues/12814
# https://github.com/matrix-org/synapse/issues/12815
return

# we raced against more events arriving with partial state. Go round
Expand Down
5 changes: 5 additions & 0 deletions synapse/replication/tcp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ async def on_rdata(
# we don't need to optimise this for multiple rows.
for row in rows:
if row.type != EventsStreamEventRow.TypeId:
# The row's data is an `EventsStreamCurrentStateRow`.
# When finishing up a partial state join, the current state of a
# room will change without any new events being persisted, so we
# must poke the replication callbacks ourselves.
self.notifier.notify_replication()
continue
assert isinstance(row, EventsStreamRow)
assert isinstance(row.data, EventsStreamEventRow)
Expand Down
2 changes: 0 additions & 2 deletions synapse/storage/controllers/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ async def get_current_state_deltas(
up to date.
"""
# FIXME(faster_joins): what do we do here?
# https://github.com/matrix-org/synapse/issues/12814
# https://github.com/matrix-org/synapse/issues/12815
# https://github.com/matrix-org/synapse/issues/13008

return await self.stores.main.get_partial_current_state_deltas(
Expand Down

0 comments on commit e921504

Please sign in to comment.