0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-12 04:52:26 +01:00

Faster joins: Update room stats and the user directory on workers when finishing join (#14874)

* Faster joins: Update room stats and user directory on workers when done

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 <seanq@matrix.org>

* fixup comment

Signed-off-by: Sean Quah <seanq@matrix.org>
This commit is contained in:
Sean Quah 2023-01-23 10:31:36 +00:00 committed by GitHub
parent 22cc93afe3
commit 2ec9c58496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 5 deletions

1
changelog.d/14874.bugfix Normal file
View file

@ -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.

View file

@ -1880,9 +1880,10 @@ class FederationHandler:
room_id room_id
) )
# TODO(faster_joins) update room stats and user directory? # Poke the notifier so that other workers see the write to
# https://github.com/matrix-org/synapse/issues/12814 # the un-partial-stated rooms stream.
# https://github.com/matrix-org/synapse/issues/12815 self._notifier.notify_replication()
return return
# we raced against more events arriving with partial state. Go round # we raced against more events arriving with partial state. Go round

View file

@ -207,6 +207,12 @@ class ReplicationDataHandler:
# we don't need to optimise this for multiple rows. # we don't need to optimise this for multiple rows.
for row in rows: for row in rows:
if row.type != EventsStreamEventRow.TypeId: if row.type != EventsStreamEventRow.TypeId:
# The row's data is an `EventsStreamCurrentStateRow`.
# When we recompute the current state of a room based on forward
# extremities (see `update_current_state`), no new events are
# persisted, so we must poke the replication callbacks ourselves.
# This functionality is used when finishing up a partial state join.
self.notifier.notify_replication()
continue continue
assert isinstance(row, EventsStreamRow) assert isinstance(row, EventsStreamRow)
assert isinstance(row.data, EventsStreamEventRow) assert isinstance(row.data, EventsStreamEventRow)

View file

@ -493,8 +493,6 @@ class StateStorageController:
up to date. up to date.
""" """
# FIXME(faster_joins): what do we do here? # 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 # https://github.com/matrix-org/synapse/issues/13008
return await self.stores.main.get_partial_current_state_deltas( return await self.stores.main.get_partial_current_state_deltas(