Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 06806f4

Browse files
committed
Merge tag 'v1.83.0' into merge-1.83
Synapse 1.83.0 (2023-05-09) =========================== No significant changes since 1.83.0rc1. Synapse 1.83.0rc1 (2023-05-02) ============================== Features -------- - Experimental support to recursively provide relations per [MSC3981](matrix-org/matrix-spec-proposals#3981). ([\matrix-org#15315](matrix-org#15315)) - Experimental support for [MSC3970](matrix-org/matrix-spec-proposals#3970): Scope transaction IDs to devices. ([\matrix-org#15318](matrix-org#15318)) - Add an [admin API endpoint](https://matrix-org.github.io/synapse/v1.83/admin_api/experimental_features.html) to support per-user feature flags. ([\matrix-org#15344](matrix-org#15344)) - Add a module API to send an HTTP push notification. ([\matrix-org#15387](matrix-org#15387)) - Add an [admin API endpoint](https://matrix-org.github.io/synapse/v1.83/admin_api/statistics.html#get-largest-rooms-by-size-in-database) to query the largest rooms by disk space used in the database. ([\matrix-org#15482](matrix-org#15482)) Bugfixes -------- - Disable push rule evaluation for rooms excluded from sync. ([\matrix-org#15361](matrix-org#15361)) - Fix a long-standing bug where cached server key results which were directly fetched would not be properly re-used. ([\matrix-org#15417](matrix-org#15417)) - Fix a bug introduced in Synapse 1.73.0 where some experimental push rules were returned by default. ([\matrix-org#15494](matrix-org#15494)) Improved Documentation ---------------------- - Add Nginx loadbalancing example with sticky mxid for workers. ([\matrix-org#15411](matrix-org#15411)) - Update outdated development docs that mention restrictions in versions of SQLite that we no longer support. ([\matrix-org#15498](matrix-org#15498)) Internal Changes ---------------- - Speedup tests by caching HomeServerConfig instances. ([\matrix-org#15284](matrix-org#15284)) - Add denormalised event stream ordering column to membership state tables for future use. Contributed by Nick @ Beeper (@Fizzadar). ([\matrix-org#15356](matrix-org#15356)) - Always use multi-user device resync replication endpoints. ([\matrix-org#15418](matrix-org#15418)) - Add column `full_user_id` to tables `profiles` and `user_filters`. ([\matrix-org#15458](matrix-org#15458)) - Update support for [MSC3983](matrix-org/matrix-spec-proposals#3983) to allow always returning fallback-keys in a `/keys/claim` request. ([\matrix-org#15462](matrix-org#15462)) - Improve type hints. ([\matrix-org#15465](matrix-org#15465), [\matrix-org#15496](matrix-org#15496), [\matrix-org#15497](matrix-org#15497)) - Support claiming more than one OTK at a time. ([\matrix-org#15468](matrix-org#15468)) - Bump types-pyyaml from 6.0.12.8 to 6.0.12.9. ([\matrix-org#15471](matrix-org#15471)) - Bump pyasn1-modules from 0.2.8 to 0.3.0. ([\matrix-org#15473](matrix-org#15473)) - Bump cryptography from 40.0.1 to 40.0.2. ([\matrix-org#15474](matrix-org#15474)) - Bump types-netaddr from 0.8.0.7 to 0.8.0.8. ([\matrix-org#15475](matrix-org#15475)) - Bump types-jsonschema from 4.17.0.6 to 4.17.0.7. ([\matrix-org#15476](matrix-org#15476)) - Ask bug reporters to provide logs as text. ([\matrix-org#15479](matrix-org#15479)) - Add a Nix flake for use as a development environment. ([\matrix-org#15495](matrix-org#15495)) - Bump anyhow from 1.0.70 to 1.0.71. ([\matrix-org#15507](matrix-org#15507)) - Bump types-pillow from 9.4.0.19 to 9.5.0.2. ([\matrix-org#15508](matrix-org#15508)) - Bump packaging from 23.0 to 23.1. ([\matrix-org#15510](matrix-org#15510)) - Bump types-requests from 2.28.11.16 to 2.29.0.0. ([\matrix-org#15511](matrix-org#15511)) - Bump setuptools-rust from 1.5.2 to 1.6.0. ([\matrix-org#15512](matrix-org#15512)) - Update the check_schema_delta script to account for when the schema version has been bumped locally. ([\matrix-org#15466](matrix-org#15466)) # -----BEGIN PGP SIGNATURE----- # # iHUEABYIAB0WIQSTI7xPaHQ1yo0PA8uSL1esuTqr+QUCZFp2zQAKCRCSL1esuTqr # +YVzAP94u5kth80qhAB5x/vpCMrpPZC8Hk4kPTNwTuqCia7qGQEAlcEgsNXRmLnw # esBnwhQE+ntwodK4uvHKjVZafkDG2gs= # =N1Pk # -----END PGP SIGNATURE----- # gpg: Signature made Tue May 9 17:37:33 2023 BST # gpg: using EDDSA key 9323BC4F687435CA8D0F03CB922F57ACB93AABF9 # gpg: Can't check signature: No public key # Conflicts: # poetry.lock # synapse/events/utils.py # synapse/push/bulk_push_rule_evaluator.py # synapse/push/httppusher.py # synapse/server.py
2 parents b4b6ef6 + 64a11fb commit 06806f4

File tree

119 files changed

+3331
-820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3331
-820
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ body:
129129
attributes:
130130
label: Relevant log output
131131
description: |
132-
Please copy and paste any relevant log output, ideally at INFO or DEBUG log level.
132+
Please copy and paste any relevant log output as text (not images), ideally at INFO or DEBUG log level.
133133
This will be automatically formatted into code, so there is no need for backticks (`\``).
134134
135135
Please be careful to remove any personal or private data.

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ _trial_temp*/
1515
.DS_Store
1616
__pycache__/
1717

18-
# We do want the poetry and cargo lockfile.
18+
# We do want poetry, cargo and flake lockfiles.
1919
!poetry.lock
2020
!Cargo.lock
21+
!flake.lock
2122

2223
# stuff that is likely to exist when you run a server locally
2324
/*.db
@@ -38,6 +39,9 @@ __pycache__/
3839
/.envrc
3940
.direnv/
4041

42+
# For nix/devenv users
43+
.devenv/
44+
4145
# IDEs
4246
/.idea/
4347
/.ropeproject/

CHANGES.md

+59
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
Synapse 1.83.0 (2023-05-09)
2+
===========================
3+
4+
No significant changes since 1.83.0rc1.
5+
6+
7+
Synapse 1.83.0rc1 (2023-05-02)
8+
==============================
9+
10+
Features
11+
--------
12+
13+
- Experimental support to recursively provide relations per [MSC3981](https://github.com/matrix-org/matrix-spec-proposals/pull/3981). ([\#15315](https://github.com/matrix-org/synapse/issues/15315))
14+
- Experimental support for [MSC3970](https://github.com/matrix-org/matrix-spec-proposals/pull/3970): Scope transaction IDs to devices. ([\#15318](https://github.com/matrix-org/synapse/issues/15318))
15+
- Add an [admin API endpoint](https://matrix-org.github.io/synapse/v1.83/admin_api/experimental_features.html) to support per-user feature flags. ([\#15344](https://github.com/matrix-org/synapse/issues/15344))
16+
- Add a module API to send an HTTP push notification. ([\#15387](https://github.com/matrix-org/synapse/issues/15387))
17+
- Add an [admin API endpoint](https://matrix-org.github.io/synapse/v1.83/admin_api/statistics.html#get-largest-rooms-by-size-in-database) to query the largest rooms by disk space used in the database. ([\#15482](https://github.com/matrix-org/synapse/issues/15482))
18+
19+
20+
Bugfixes
21+
--------
22+
23+
- Disable push rule evaluation for rooms excluded from sync. ([\#15361](https://github.com/matrix-org/synapse/issues/15361))
24+
- Fix a long-standing bug where cached server key results which were directly fetched would not be properly re-used. ([\#15417](https://github.com/matrix-org/synapse/issues/15417))
25+
- Fix a bug introduced in Synapse 1.73.0 where some experimental push rules were returned by default. ([\#15494](https://github.com/matrix-org/synapse/issues/15494))
26+
27+
28+
Improved Documentation
29+
----------------------
30+
31+
- Add Nginx loadbalancing example with sticky mxid for workers. ([\#15411](https://github.com/matrix-org/synapse/issues/15411))
32+
- Update outdated development docs that mention restrictions in versions of SQLite that we no longer support. ([\#15498](https://github.com/matrix-org/synapse/issues/15498))
33+
34+
35+
Internal Changes
36+
----------------
37+
38+
- Speedup tests by caching HomeServerConfig instances. ([\#15284](https://github.com/matrix-org/synapse/issues/15284))
39+
- Add denormalised event stream ordering column to membership state tables for future use. Contributed by Nick @ Beeper (@fizzadar). ([\#15356](https://github.com/matrix-org/synapse/issues/15356))
40+
- Always use multi-user device resync replication endpoints. ([\#15418](https://github.com/matrix-org/synapse/issues/15418))
41+
- Add column `full_user_id` to tables `profiles` and `user_filters`. ([\#15458](https://github.com/matrix-org/synapse/issues/15458))
42+
- Update support for [MSC3983](https://github.com/matrix-org/matrix-spec-proposals/pull/3983) to allow always returning fallback-keys in a `/keys/claim` request. ([\#15462](https://github.com/matrix-org/synapse/issues/15462))
43+
- Improve type hints. ([\#15465](https://github.com/matrix-org/synapse/issues/15465), [\#15496](https://github.com/matrix-org/synapse/issues/15496), [\#15497](https://github.com/matrix-org/synapse/issues/15497))
44+
- Support claiming more than one OTK at a time. ([\#15468](https://github.com/matrix-org/synapse/issues/15468))
45+
- Bump types-pyyaml from 6.0.12.8 to 6.0.12.9. ([\#15471](https://github.com/matrix-org/synapse/issues/15471))
46+
- Bump pyasn1-modules from 0.2.8 to 0.3.0. ([\#15473](https://github.com/matrix-org/synapse/issues/15473))
47+
- Bump cryptography from 40.0.1 to 40.0.2. ([\#15474](https://github.com/matrix-org/synapse/issues/15474))
48+
- Bump types-netaddr from 0.8.0.7 to 0.8.0.8. ([\#15475](https://github.com/matrix-org/synapse/issues/15475))
49+
- Bump types-jsonschema from 4.17.0.6 to 4.17.0.7. ([\#15476](https://github.com/matrix-org/synapse/issues/15476))
50+
- Ask bug reporters to provide logs as text. ([\#15479](https://github.com/matrix-org/synapse/issues/15479))
51+
- Add a Nix flake for use as a development environment. ([\#15495](https://github.com/matrix-org/synapse/issues/15495))
52+
- Bump anyhow from 1.0.70 to 1.0.71. ([\#15507](https://github.com/matrix-org/synapse/issues/15507))
53+
- Bump types-pillow from 9.4.0.19 to 9.5.0.2. ([\#15508](https://github.com/matrix-org/synapse/issues/15508))
54+
- Bump packaging from 23.0 to 23.1. ([\#15510](https://github.com/matrix-org/synapse/issues/15510))
55+
- Bump types-requests from 2.28.11.16 to 2.29.0.0. ([\#15511](https://github.com/matrix-org/synapse/issues/15511))
56+
- Bump setuptools-rust from 1.5.2 to 1.6.0. ([\#15512](https://github.com/matrix-org/synapse/issues/15512))
57+
- Update the check_schema_delta script to account for when the schema version has been bumped locally. ([\#15466](https://github.com/matrix-org/synapse/issues/15466))
58+
59+
160
Synapse 1.82.0 (2023-04-25)
261
===========================
362

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

debian/changelog

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
matrix-synapse-py3 (1.83.0) stable; urgency=medium
2+
3+
* New Synapse release 1.83.0.
4+
5+
-- Synapse Packaging team <[email protected]> Tue, 09 May 2023 18:13:37 +0200
6+
7+
matrix-synapse-py3 (1.83.0~rc1) stable; urgency=medium
8+
9+
* New Synapse release 1.83.0rc1.
10+
11+
-- Synapse Packaging team <[email protected]> Tue, 02 May 2023 15:56:38 +0100
12+
113
matrix-synapse-py3 (1.82.0) stable; urgency=medium
214

315
* New Synapse release 1.82.0.

docs/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
- [Account Validity](admin_api/account_validity.md)
5858
- [Background Updates](usage/administration/admin_api/background_updates.md)
5959
- [Event Reports](admin_api/event_reports.md)
60+
- [Experimental Features](admin_api/experimental_features.md)
6061
- [Media](admin_api/media_admin_api.md)
6162
- [Purge History](admin_api/purge_history_api.md)
6263
- [Register Users](admin_api/register_api.md)
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Experimental Features API
2+
3+
This API allows a server administrator to enable or disable some experimental features on a per-user
4+
basis. Currently supported features are [msc3026](https://github.com/matrix-org/matrix-spec-proposals/pull/3026): busy
5+
presence state enabled, [msc2654](https://github.com/matrix-org/matrix-spec-proposals/pull/2654): enable unread counts,
6+
[msc3881](https://github.com/matrix-org/matrix-spec-proposals/pull/3881): enable remotely toggling push notifications
7+
for another client, and [msc3967](https://github.com/matrix-org/matrix-spec-proposals/pull/3967): do not require
8+
UIA when first uploading cross-signing keys.
9+
10+
11+
To use it, you will need to authenticate by providing an `access_token`
12+
for a server admin: see [Admin API](../usage/administration/admin_api/).
13+
14+
## Enabling/Disabling Features
15+
16+
This API allows a server administrator to enable experimental features for a given user. The request must
17+
provide a body containing the user id and listing the features to enable/disable in the following format:
18+
```json
19+
{
20+
"features": {
21+
"msc3026":true,
22+
"msc2654":true
23+
}
24+
}
25+
```
26+
where true is used to enable the feature, and false is used to disable the feature.
27+
28+
29+
The API is:
30+
31+
```
32+
PUT /_synapse/admin/v1/experimental_features/<user_id>
33+
```
34+
35+
## Listing Enabled Features
36+
37+
To list which features are enabled/disabled for a given user send a request to the following API:
38+
39+
```
40+
GET /_synapse/admin/v1/experimental_features/<user_id>
41+
```
42+
43+
It will return a list of possible features and indicate whether they are enabled or disabled for the
44+
user like so:
45+
```json
46+
{
47+
"features": {
48+
"msc3026": true,
49+
"msc2654": true,
50+
"msc3881": false,
51+
"msc3967": false
52+
}
53+
}
54+
```

docs/admin_api/statistics.md

+49
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,52 @@ The following fields are returned in the JSON response body:
8181
- `user_id` - string - Fully-qualified user ID (ex. `@user:server.com`).
8282
* `next_token` - integer - Opaque value used for pagination. See above.
8383
* `total` - integer - Total number of users after filtering.
84+
85+
86+
# Get largest rooms by size in database
87+
88+
Returns the 10 largest rooms and an estimate of how much space in the database
89+
they are taking.
90+
91+
This does not include the size of any associated media associated with the room.
92+
93+
Returns an error on SQLite.
94+
95+
*Note:* This uses the planner statistics from PostgreSQL to do the estimates,
96+
which means that the returned information can vary widely from reality. However,
97+
it should be enough to get a rough idea of where database disk space is going.
98+
99+
100+
The API is:
101+
102+
```
103+
GET /_synapse/admin/v1/statistics/statistics/database/rooms
104+
```
105+
106+
A response body like the following is returned:
107+
108+
```json
109+
{
110+
"rooms": [
111+
{
112+
"room_id": "!OGEhHVWSdvArJzumhm:matrix.org",
113+
"estimated_size": 47325417353
114+
}
115+
],
116+
}
117+
```
118+
119+
120+
121+
**Response**
122+
123+
The following fields are returned in the JSON response body:
124+
125+
* `rooms` - An array of objects, sorted by largest room first. Objects contain
126+
the following fields:
127+
- `room_id` - string - The room ID.
128+
- `estimated_size` - integer - Estimated disk space used in bytes by the room
129+
in the database.
130+
131+
132+
*Added in Synapse 1.83.0*

docs/development/database_schema.md

+1-33
Original file line numberDiff line numberDiff line change
@@ -155,43 +155,11 @@ def run_upgrade(
155155
Boolean columns require special treatment, since SQLite treats booleans the
156156
same as integers.
157157

158-
There are three separate aspects to this:
159-
160-
* Any new boolean column must be added to the `BOOLEAN_COLUMNS` list in
158+
Any new boolean column must be added to the `BOOLEAN_COLUMNS` list in
161159
`synapse/_scripts/synapse_port_db.py`. This tells the port script to cast
162160
the integer value from SQLite to a boolean before writing the value to the
163161
postgres database.
164162

165-
* Before SQLite 3.23, `TRUE` and `FALSE` were not recognised as constants by
166-
SQLite, and the `IS [NOT] TRUE`/`IS [NOT] FALSE` operators were not
167-
supported. This makes it necessary to avoid using `TRUE` and `FALSE`
168-
constants in SQL commands.
169-
170-
For example, to insert a `TRUE` value into the database, write:
171-
172-
```python
173-
txn.execute("INSERT INTO tbl(col) VALUES (?)", (True, ))
174-
```
175-
176-
* Default values for new boolean columns present a particular
177-
difficulty. Generally it is best to create separate schema files for
178-
Postgres and SQLite. For example:
179-
180-
```sql
181-
# in 00delta.sql.postgres:
182-
ALTER TABLE tbl ADD COLUMN col BOOLEAN DEFAULT FALSE;
183-
```
184-
185-
```sql
186-
# in 00delta.sql.sqlite:
187-
ALTER TABLE tbl ADD COLUMN col BOOLEAN DEFAULT 0;
188-
```
189-
190-
Note that there is a particularly insidious failure mode here: the Postgres
191-
flavour will be accepted by SQLite 3.22, but will give a column whose
192-
default value is the **string** `"FALSE"` - which, when cast back to a boolean
193-
in Python, evaluates to `True`.
194-
195163

196164
## `event_id` global uniqueness
197165

docs/workers.md

+64-2
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ load balancing can be done in different ways.
325325

326326
For `/sync` and `/initialSync` requests it will be more efficient if all
327327
requests from a particular user are routed to a single instance. This can
328-
be done e.g. in nginx via IP `hash $http_x_forwarded_for;` or via
329-
`hash $http_authorization consistent;` which contains the users access token.
328+
be done in reverse proxy by extracting username part from the users access token.
330329

331330
Admins may additionally wish to separate out `/sync`
332331
requests that have a `since` query parameter from those that don't (and
@@ -335,6 +334,69 @@ when a user logs in on a new device and can be *very* resource intensive, so
335334
isolating these requests will stop them from interfering with other users ongoing
336335
syncs.
337336

337+
Example `nginx` configuration snippet that handles the cases above. This is just an
338+
example and probably requires some changes according to your particular setup:
339+
340+
```nginx
341+
# Choose sync worker based on the existence of "since" query parameter
342+
map $arg_since $sync {
343+
default synapse_sync;
344+
'' synapse_initial_sync;
345+
}
346+
347+
# Extract username from access token passed as URL parameter
348+
map $arg_access_token $accesstoken_from_urlparam {
349+
# Defaults to just passing back the whole accesstoken
350+
default $arg_access_token;
351+
# Try to extract username part from accesstoken URL parameter
352+
"~syt_(?<username>.*?)_.*" $username;
353+
}
354+
355+
# Extract username from access token passed as authorization header
356+
map $http_authorization $mxid_localpart {
357+
# Defaults to just passing back the whole accesstoken
358+
default $http_authorization;
359+
# Try to extract username part from accesstoken header
360+
"~Bearer syt_(?<username>.*?)_.*" $username;
361+
# if no authorization-header exist, try mapper for URL parameter "access_token"
362+
"" $accesstoken_from_urlparam;
363+
}
364+
365+
upstream synapse_initial_sync {
366+
# Use the username mapper result for hash key
367+
hash $mxid_localpart consistent;
368+
server 127.0.0.1:8016;
369+
server 127.0.0.1:8036;
370+
}
371+
372+
upstream synapse_sync {
373+
# Use the username mapper result for hash key
374+
hash $mxid_localpart consistent;
375+
server 127.0.0.1:8013;
376+
server 127.0.0.1:8037;
377+
server 127.0.0.1:8038;
378+
server 127.0.0.1:8039;
379+
}
380+
381+
# Sync initial/normal
382+
location ~ ^/_matrix/client/(r0|v3)/sync$ {
383+
proxy_pass http://$sync;
384+
}
385+
386+
# Normal sync
387+
location ~ ^/_matrix/client/(api/v1|r0|v3)/events$ {
388+
proxy_pass http://synapse_sync;
389+
}
390+
391+
# Initial_sync
392+
location ~ ^/_matrix/client/(api/v1|r0|v3)/initialSync$ {
393+
proxy_pass http://synapse_initial_sync;
394+
}
395+
location ~ ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ {
396+
proxy_pass http://synapse_initial_sync;
397+
}
398+
```
399+
338400
Federation and client requests can be balanced via simple round robin.
339401

340402
The inbound federation transaction request `^/_matrix/federation/v1/send/`

0 commit comments

Comments
 (0)