-
Notifications
You must be signed in to change notification settings - Fork 399
MSC3706: Extensions to /_matrix/federation/v2/send_join/{roomId}/{eventId}
for partial state
#3706
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6363ec0
proposal for /send_join extensions
richvdh 232d1aa
unstable identifiers, typo
richvdh 342bd40
Optimise auth_events
richvdh ce34482
clarify
richvdh ec55451
fix typo
richvdh 195ba79
clarify that servers_in_room is required
richvdh 7162140
Fix up TODOs and other cleanups
richvdh 913859e
minor edits
richvdh d531524
Fix a couple typos
anoadragon453 dd5d643
Update proposals/3706-partial-state-in-send-join.md
richvdh 6fb4e9c
Rename "partial state" parameter
richvdh 12e11ec
s/member_events/members/
richvdh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# MSC3706: Extensions to `/_matrix/federation/v2/send_join/{roomId}/{eventId}` for partial state | ||
|
||
## Background | ||
|
||
It is well known that joining large rooms over federation can be very slow (see, | ||
for example, [synapse#1211](https://github.com/matrix-org/synapse/issues/1211)). | ||
|
||
Much of the reason for this is the large number of events which are returned by | ||
the [`/send_join`](https://spec.matrix.org/v1.2/server-server-api/#put_matrixfederationv2send_joinroomideventid) | ||
API, and must be validated and stored. | ||
|
||
[MSC3902](https://github.com/matrix-org/matrix-doc/pull/3902) gives an overview | ||
of changes to the matrix protocol to improve this situation. This MSC focuses | ||
on a specific aspect of those suggestions by proposing specific changes to the | ||
`/send_join` API. | ||
|
||
## Proposal | ||
|
||
[`PUT /_matrix/federation/v2/send_join/{roomId}/{eventId}/send_join`](https://spec.matrix.org/v1.2/server-server-api/#put_matrixfederationv2send_joinroomideventid) | ||
is extended to support "partial state" in its responses. This involves the | ||
following changes. | ||
|
||
### New query parameter | ||
|
||
`partial_state` is added as a new query parameter. This can take the values | ||
`true` or `false`; other values should be rejected with an HTTP 400 error with | ||
matrix error code `M_INVALID_PARAM`. | ||
|
||
Calling servers use this parameter to indicate support for partial state in | ||
`send_join`. If it is not set to `true`, receiving servers continue to behave | ||
as they do today. | ||
|
||
### Changes to the response | ||
|
||
Receiving servers are not obliged to implement partial state: they are also | ||
free to support it for some rooms and not others. | ||
|
||
The following changes are made to the response: | ||
|
||
* `partial_state`: a new boolean field is added. This should be set to `true` | ||
to indicate that partial state is being returned. It must otherwise be set | ||
to `false` or omitted. | ||
|
||
* `state`: if partial state is being returned, then state events with event | ||
type `m.room.member` are omitted from the response. All other room state is | ||
returned as normal. (See 'Alternatives' for discussion on why only | ||
`m.room.member` events are omitted.) | ||
DMRobertson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* `auth_chain`: The spec currently defines this as "The auth chain for the | ||
entire current room state". We instead rephrase this as: | ||
|
||
> All events in the auth chain for the returned join event, as well as | ||
> those in the auth chains for any events returned in `state`. | ||
|
||
(Note that in the case that full state is being returned, the two | ||
definitions are equivalent.) | ||
|
||
* If the `partial_state` query parameter was set, we make a further | ||
optimisation to `auth_chain`: | ||
|
||
> Any events returned within `state` can be omitted from `auth_chain`. | ||
|
||
For example: the `m.room.create` event is part of the room state, so | ||
must be included in `state`. However, it also forms part of the auth chain | ||
for all of the returned events, so in the current spec, must *also* be | ||
included in `auth_chain`. However, this is redundant, so we should omit it | ||
for calling servers which opt into that via the `partial_state` query param. | ||
|
||
* `servers_in_room`: A new field of type `[string]`, listing the servers | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
active in the room (ie, those with joined members) before the join. | ||
|
||
This is to be used by the joining server to send outgoing federation | ||
transactions while it synchronises the full state. | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This field is **required** if the `partial_state` response field is true; it | ||
is otherwise optional. | ||
|
||
## Potential issues | ||
|
||
None at present. | ||
|
||
## Alternatives | ||
|
||
* In future, the list of event types to omit could be expanded. (Some rooms | ||
may have large numbers of other state events). | ||
|
||
Currently, `m.room.member` events are by far the biggest problem. For | ||
example, a `/send_join` request for Matrix HQ returns approximately 85000 | ||
events in `state`, of which all but 44 are `m.room.member`. | ||
|
||
In order to reduce the scope of the change, we have therefore decided to | ||
focus on `m.room.member` events for now. Future MSCs might provde a | ||
mechanism for omitting other event types. | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Security considerations | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
No security issues are currently foreseen with this specific MSC, though the | ||
larger topic of incremental synchronisation of state has several concerns; | ||
these will be discussed in other MSCs such as MSC3902. | ||
|
||
## Unstable prefix | ||
|
||
The following mapping will be used for identifiers in this MSC during | ||
development: | ||
|
||
Proposed final identifier | Purpose | Development identifier | ||
------------------------------- | ------- | ---- | ||
`partial_state` | query parameter, response field | `org.matrix.msc3706.partial_state` | ||
`servers_in_room` | response field | `org.matrix.msc3706.servers_in_room` | ||
|
||
|
||
## Dependencies | ||
|
||
This MSC does not build on any existing unaccepted MSCs. |
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.
Uh oh!
There was an error while loading. Please reload this page.