-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
Refactor forward extremities #1556
Conversation
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.
Can you please summarise in a PR comment for posterity how the previous algorithm was wrong and how this PR fixes it. I grok your actions but I don't know how this is more correct than before.
There are two things that this PR fixes. The first is that, beforehand, we were checking if any event known to the roomserver was referencing a forward extremity rather than just known extremities. This included outliers and other events that weren't woven into the room topology yet, so it could cause us to accidentally get rid of forward extremities when we didn't really mean to (and any state after them in the process). The PR now ensures that we're only checking references between extremities, so we might accumulate more extremities as a result, but we won't get rid of any until they've actually been superseded on the graph. The second is that, because of the fact that we could potentially invalidate all of our extremities by outliers, that meant that we could potentially fall back on just using the new event and all of it's associated state, and it would never be resolved against potentially other good extremities. |
This is another refactor of forward extremities so that we don't check for references from outliers etc, which we were seemingly getting wrong even before the deep-checking PR.
It also adds a
resolve-state
utility for probing the resolved state for one or more state snapshots from the database, which is a useful debugging tool when trying to figure out where state changed/disappeared.