This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
Add developer documentation to explain room DAG concepts like
outliers
andstate_groups
#10464Add developer documentation to explain room DAG concepts like
outliers
andstate_groups
#10464Changes from 4 commits
a2d3aff
785abe4
63fd9cc
3127f20
2d68492
12c0b89
7392b63
abe66d1
885a880
e79502c
85e66d6
997a4be
64ebf42
9e1e92c
e9f58df
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's slightly different. The thing that makes an
outlier
an outlier is that we haven't figured out the state for the room at that point in the DAG.We won't necessarily have its prev_events in the database, but it's entirely possible that we will. Conversely, it's possible for us not to have all the prev_events for non-outlier event (in which case, that event would be a "backward extremity").
The process of transforming an outlier to a non-outlier involves figuring out the room state at that point in the DAG - either by having the state at all the
prev_events
and resolving the state between them, or simply by asking another server.auth events are a whole extra level of complexity, but even for an outlier we should have all the events in the auth chain.
synapse/synapse/handlers/federation.py
Lines 2196 to 2199 in cd5fcd2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all info @richvdh 😀
These seem so closely coupled and aren't mutually exclusive in real life situations so it's hard for me to make a clear description 🤯
I've updated with something more inline with your description but feel free to rewrite.
I've mainly been working with floating outliers so I don't think I had the complete picture.
I feel like I don't understand where an
outlier
becomes anex_outlier
.Say we fetch a missing auth event for an event, we mark that auth event as an
outlier
. Then at what point later, do we get the event again as a non-outlier? From your statement, it's not when we have fetched all of theprev_events
as those could already be all persisted in the db.There is
_update_outliers_txn
which handlesex_outlier
stuff but it's confusing where/when we will come across the sameoutlier
event again while persisting.Based on the DAG below, as a remote federating server, my assumption is that we process event
D
which fetches thestate_event
as anoutlier
. Then as we backfill more, and processstate_event
directly, it becomes anex_outlier
.Mermaid live editor playground link
I'm still a bit wary on a situation where we could have all of the
prev_events
for thestate_event
but still mark it as anoutlier
. Perhaps with gaps in the DAG and the event hits it just right 🤷There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I might have misled you here. From Synapse's point of view, all outliers are considered to be floating, and in the majority of cases we indeed won't have their prev events. However, it's possible for the stars to align in a way that we do actually have their prev events in the database - at least as outliers themselves.
To take a simple example:
Two of the auth events for a
join
event in an invite-only room are thejoin_rules
event and an invite event for the joiner. So let's suppose we fetch both of those events as outliers. Let's also suppose that the invite was issued immediately after changing the join rules - so thejoin_rules
is the only prev-event of theinvite
event.In that case, it so happens that we have all the prev-events of the invite event - but we're still considering it an outlier.
So I don't want you to imagine there is a distinction between "floating outliers" and "regular outliers" - they are all just outliers in terms of how we handle them in Synapse.
right. It becomes a non-outlier in the situation where we process it as a regular event as part of the timeline - normally via backfill.
exactly so, yes.
yup. Imagine there is another fork in the DAG pointing to A:
When we receive Y, we'll backfill A. So then we have
state_event
'sprev_events
- butstate_event
is still an outlier at this point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification here. I've added a paragraph explaining that there is no distinction.
I like these examples and edge cases. I'm tempted to add them into the docs but I think I'll save that for another iteration.