-
Notifications
You must be signed in to change notification settings - Fork 54
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
Marker events as state - MSC2716 #371
Conversation
// Paginate the /messages endpoint until we find all of the expectedEventIds | ||
// (order does not matter). If any event in denyListEventIDs is found, an error | ||
// will be thrown. | ||
func paginateUntilMessageCheckOff(t *testing.T, c *client.CSAPI, roomID string, fromPaginationToken string, expectedEventIDs []string, denyListEventIDs []string) { |
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.
This function is originally from #214 but saw that we could use it here before that merges
… current state to process See matrix-org/synapse#12718 (comment)
// Marker events should have unique state_key so they all show up in the current state to process. | ||
unique_state_key := getTxnID("marker_state_key") | ||
// We can't use as.SendEventSynced(...) because application services can't use the /sync API. | ||
markerSendRes := as.MustDoFunc(t, "PUT", []string{"_matrix", "client", "r0", "rooms", roomID, "state", markerEvent.Type, unique_state_key}, client.WithJSONBody(t, markerEvent.Content)) |
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.
Sending marker events as state now so they are always able to be seen by homeservers (not lost in some timeline gap).
Marker events should be sent with a unique state_key
so that they can all resolve in the current state to easily be discovered.
- If we re-use the same
state_key
(like""
), then we would have to fetch previous snapshots of state up through time to find all of the marker events. This way we can avoid all of that. - Also avoids state resolution conflicts where only one of the marker events win
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.
From a design/protocol perspective, this feels sub-optimal. What you really wanted was something like MSC2836 which would allow you to walk back up marker events over federation without needing to put things into state, but oh well.
// Marker events should have unique state_key so they all show up in the current state to process. | ||
unique_state_key := getTxnID("marker_state_key") | ||
// We can't use as.SendEventSynced(...) because application services can't use the /sync API. | ||
markerSendRes := as.MustDoFunc(t, "PUT", []string{"_matrix", "client", "r0", "rooms", roomID, "state", markerEvent.Type, unique_state_key}, client.WithJSONBody(t, markerEvent.Content)) |
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.
From a design/protocol perspective, this feels sub-optimal. What you really wanted was something like MSC2836 which would allow you to walk back up marker events over federation without needing to put things into state, but oh well.
Sending marker events as state now so they are always able to be seen by homeservers (not lost in some timeline gap). Part of [MSC2716](matrix-org/matrix-spec-proposals#2716) Complement tests: matrix-org/complement#371 As initially discussed at matrix-org/matrix-spec-proposals#2716 (comment) and matrix-org/matrix-spec-proposals#2716 (comment) When someone joins a room, process all of the marker events we see in the current state. Marker events should be sent with a unique `state_key` so that they can all resolve in the current state to easily be discovered. Marker events as state - If we re-use the same `state_key` (like `""`), then we would have to fetch previous snapshots of state up through time to find all of the marker events. This way we can avoid all of that. This PR was originally doing this but then thought of the smarter way to tackle in an [out of band discussion with @erikjohnston](https://docs.google.com/document/d/1JJDuPfcPNX75fprdTWlxlaKjWOdbdJylbpZ03hzo638/edit#bookmark=id.sm92fqyq7vpp). - Also avoids state resolution conflicts where only one of the marker events win As a homeserver, when we see new marker state, we know there is new history imported somewhere back in time and should process it to fetch the insertion event where the historical messages are and set it as an insertion extremity. This way we know where to backfill more messages when someone asks for scrollback.
Thanks for the review @kegsay 🦢 |
Synapse change: matrix-org/synapse#12718
Part of MSC2716
We're testing to make sure historical messages show up for a remote federated homeserver even when the homeserver is missing the part of the timeline where the marker events were sent and it paginates before they occured to see if the history is available. Making sure the homeserver processes all of the markers from the current state instead of just when it sees them in the timeline.
Sending marker events as state now so they are always able to be seen by homeservers (not lost in some timeline gap).
Marker events should be sent with a unique
state_key
so that they can all resolve in the current state to easily be discovered.state_key
(like""
), then we would have to fetch previous snapshots of state up through time to find all of the marker events. This way we can avoid all of that.As a homeserver, when we see new marker state, we know there is new history imported somewhere back in time and should process it to fetch the insertion event where the historical messages are and set it as an insertion extremity. This way we know where to backfill more messages when someone asks for scrollback.
Dev notes