fix: provide remote servers a way to find out about an event created during the remote join handshake #19390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.TLDR
Use a "dummy" event to tie together forward extremities, and proactively send it to all servers in the room. This allows recently joined servers to become aware of recent events that would otherwise have "slipped through the cracks" and thus not be retrievable.
NOTE: While this does send the "dummy" event to all servers in the room, regardless of if they should care or not, at some point a new event will reference this dummy event and require it's retrieval. Since it was proactively sent, this will now not be necessary. This assists in preventing forks in the DAG
Alternatives
Unlike famedly/synapse#51 which 'pushes' the missing event directly, this causes the event to be 'pulled' by referencing it as a
prev_eventof a dummy event. Since the 'dummy event' does not get passed into the client, it is effectively invisible.Draw-backs of famedly/synapse#51 meant it was not always certain if the 'pushed event' would show up in
/syncor in/messages, but usually was in/sync. This method always has the 'missing event' show up in/messages, which I feel is more technically correct as that event was(albeit just barely) created before the 'join event' is persisted.The Process
The order of events:
make_joinfrom remote server, response sentsend_joinfrom remote server, response from local server. Message A is not in this(as it is not state and is not referenced in any events that are included). Join event is persisted on local server.A. Creates a
org.matrix.dummy_eventthat hasprev_eventscontaining both the join and message A.B. Sends this dummy event to all servers in the room.
/sendendpoint, saves it in a queue until the partial state join begins syncing additional room state