Maxwell G
12611bfcdd
Add support for pydantic v2 via pydantic.v1 compat module ( #16332 )
...
While maintaining support with pydantic v1.
2023-09-25 15:19:08 +00:00
Patrick Cloke
7ec0a141b4
Convert more cached return values to immutable types ( #16356 )
2023-09-20 07:48:55 -04:00
Patrick Cloke
d7c89c5908
Return immutable objects for cachedList decorators ( #16350 )
2023-09-19 15:26:44 -04:00
dependabot[bot]
eee2b6642d
Bump ruff from 0.0.286 to 0.0.290 ( #16342 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Patrick Cloke <patrickc@matrix.org>
2023-09-18 11:30:43 -04:00
Hanadi
eef2b9e344
Filter locked users in the admin API ( #16328 )
...
Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
2023-09-18 15:37:51 +01:00
Patrick Cloke
c1e244c8f7
Make cached account data/tags/admin types immutable ( #16325 )
2023-09-18 09:55:04 -04:00
Patrick Cloke
85bfd4735e
Return an immutable value from get_latest_event_ids_in_room. ( #16326 )
2023-09-18 09:29:05 -04:00
Jason Little
2a0f86f88f
Convert `_insert_graph_receipts_txn` to `simple_upsert` ( #16299 )
2023-09-15 09:16:45 +01:00
Erik Johnston
329597022e
Some minor performance fixes for task schedular ( #16313 )
2023-09-14 16:20:47 +01:00
Erik Johnston
954921736b
Refactor `get_user_by_id` ( #16316 )
2023-09-14 12:46:30 +01:00
Hanadi
7afb5e0410
Fix using dehydrated devices (MSC2697) & refresh tokens ( #16288 )
...
Refresh tokens were not correctly moved to the rehydrated
device (similar to how the access token is currently handled).
This resulted in invalid refresh tokens after rehydration.
2023-09-13 08:33:39 -04:00
Patrick Cloke
d38d0dffc9
Use StrCollection in additional places. ( #16301 )
2023-09-13 07:57:19 -04:00
Patrick Cloke
16ef6f1e3c
Stop purging tables which are slated for removal. ( #16273 )
2023-09-12 07:12:31 -04:00
Erik Johnston
2b35626b6b
Refactor storing of server keys ( #16261 )
2023-09-12 11:08:04 +01:00
David Robertson
edd83f23b7
Improve type hints for attrs classes ( #16276 )
2023-09-08 19:29:38 +01:00
Patrick Cloke
aa483cb4c9
Update ruff config ( #16283 )
...
Enable additional checks & clean-up unneeded configuration.
2023-09-08 11:24:36 -04:00
David Robertson
c1c6c95d72
Log values at DEBUG level with execute_values ( #16281 )
2023-09-08 14:50:13 +01:00
Erik Johnston
1cd410a783
Recheck if remote device is cached before requesting it ( #16252 )
...
This fixes a bug where we could get stuck re-requesting the device over
replication again and again.
2023-09-07 12:45:43 +00:00
Erik Johnston
8940d1b28e
Add `/notifications` endpoint to workers ( #16265 )
2023-09-07 09:26:07 +00:00
Patrick Cloke
32fb264120
Merge remote-tracking branch 'origin/release-v1.92' into develop
2023-09-06 13:08:22 -04:00
Patrick Cloke
55c20da4a3
Merge remote-tracking branch 'origin/release-v1.91' into release-v1.92
2023-09-06 11:25:28 -04:00
Quentin Gliech
1940d990a3
Revert MSC3861 introspection cache, admin impersonation and account lock ( #16258 )
2023-09-06 15:19:51 +01:00
Mathieu Velten
4f1840a88a
Delete device messages asynchronously and in staged batches ( #16240 )
2023-09-06 09:30:53 +02:00
Will Hunt
1e571cd664
Fix appservices being unable to handle to_device messages for multiple users ( #16251 )
2023-09-05 15:46:57 -04:00
Erik Johnston
c9cec2daed
Fix bug where we kept re-requesting a remote server's key repeatedly. ( #16257 )
...
* Correctly handle multiple rows per server/key
* Newsfile
2023-09-05 20:27:41 +01:00
Erik Johnston
d35bed8369
Don't wake up destination transaction queue if they're not due for retry. ( #16223 )
2023-09-04 17:14:09 +01:00
Mathieu Velten
dcb2778341
Add last_seen_ts to the admin users API ( #16218 )
2023-09-04 18:13:28 +02:00
David Robertson
6525fd65ee
Log the details of background update failures ( #16212 )
2023-09-01 12:41:56 +01:00
Erik Johnston
a2e0d4cd60
Fix rare bug that broke looping calls ( #16210 )
...
* Fix rare bug that broke looping calls
We can't interact with the reactor from the main thread via looping
call.
Introduced in v1.90.0 / #15791 .
* Newsfile
2023-08-30 14:18:42 +01:00
Patrick Cloke
ebd8374fb5
Stop writing to the event_txn_id table ( #16175 )
2023-08-30 11:10:56 +01:00
Patrick Cloke
9ec3da06da
Bump mypy-zope & mypy. ( #16188 )
2023-08-29 10:38:56 -04:00
dependabot[bot]
001fc7bd19
Bump ruff from 0.0.277 to 0.0.286 ( #16198 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-29 09:41:43 -04:00
Patrick Cloke
33fa82a34c
Stabilize support for MSC3958 (suppress notifications from edits). ( #16113 )
2023-08-23 13:22:34 -04:00
Erik Johnston
18279631e9
Fix rare deadlock when using read/write locks ( #16169 )
2023-08-23 16:24:30 +01:00
Neil Johnson
ec662bbe41
Filter out unwanted user_agents from udv. ( #16124 )
2023-08-23 14:00:34 +01:00
Erik Johnston
4adaba9acf
Fix rare deadlock when using read/write locks ( #16133 )
2023-08-23 13:45:25 +01:00
Erik Johnston
7cd79ce051
Reduce DB contention on worker locks ( #16160 )
2023-08-23 13:45:19 +01:00
Erik Johnston
86ecd341ec
Always update `retry_last_ts` ( #16164 )
2023-08-23 13:04:46 +01:00
Mathieu Velten
873971a8b9
Task scheduler: mark task as active if we are scheduling ASAP ( #16165 )
2023-08-23 13:37:51 +02:00
DeepBlueV7.X
19a1cda084
Properly update retry_last_ts when hitting the maximum retry interval ( #16156 )
...
* Properly update retry_last_ts when hitting the maximum retry interval
This was broken in 1.87 when the maximum retry interval got changed from
almost infinite to a week (and made configurable).
fixes #16101
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
* Add changelog
* Change fix + add test
* Add comment
---------
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
Co-authored-by: Mathieu Velten <mathieuv@matrix.org>
2023-08-23 09:35:23 +01:00
Erik Johnston
3b3fed7229
Increase perf of read/write locks ( #16149 )
...
We do this by marking the tables as `UNLOGGED` in PostgreSQL.
2023-08-23 09:23:22 +01:00
Shay
69048f7b48
Add an admin endpoint to allow authorizing server to signal token revocations ( #16125 )
2023-08-22 14:15:34 +00:00
Mathieu Velten
358896e1b8
Implements a task scheduler for resumable potentially long running tasks ( #15891 )
2023-08-21 14:17:13 +02:00
Erik Johnston
bd558a6dc3
Speed up state res in rare case we don't have all events ( #16116 )
...
If we don't have all the auth events in a room then not all state events will have a chain cover index. Even so, we can still use the chain cover index on the events that do have it, rather than bailing and using the slower functions.
This situation should not arise for newly persisted rooms, as we check we have the full auth chain for each event, but can happen for existing rooms.
c.f. #15245
2023-08-18 15:32:06 +01:00
Alexander Fechler
54317d34b7
Allow filtering for admins in the list accounts admin API ( #16114 )
2023-08-18 12:26:38 +01:00
Erik Johnston
0aba4a4eaa
Add cache to `get_server_keys_json_for_remote` ( #16123 )
2023-08-18 11:05:01 +01:00
Erik Johnston
eb0dbab15b
Fix database performance of read/write worker locks ( #16061 )
...
We were seeing serialization errors when taking out multiple read locks.
The transactions were retried, so isn't causing any failures.
Introduced in #15782 .
2023-08-17 14:07:57 +01:00
Shay
0377cb4fab
Override global statement timeout when creating indexes in Postgres ( #16085 )
2023-08-17 10:30:02 +01:00
Mathieu Velten
8c3bcea2da
Rename pagination&purge locks and add comments explaining them ( #16112 )
2023-08-16 16:19:54 +02:00
Patrick Cloke
ad3f43be9a
Run pyupgrade for python 3.7 & 3.8. ( #16110 )
2023-08-15 08:11:20 -04:00
Mathieu Velten
dac97642e4
Implements admin API to lock an user (MSC3939) ( #15870 )
2023-08-10 09:10:55 +00:00
Shay
0328b56468
Support MSC3814: Dehydrated Devices Part 2 ( #16010 )
2023-08-08 12:04:46 -07:00
reivilibre
f3dc6dc19f
Remove old rows from the `cache_invalidation_stream_by_instance` table automatically. (This table is not used when Synapse is configured to use SQLite.) ( #15868 )
...
* Add a cache invalidation clean-up task
* Run the cache invalidation stream clean-up on the background worker
* Tune down
* call_later is in millis!
* Newsfile
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* fixup! Add a cache invalidation clean-up task
* Update synapse/storage/databases/main/cache.py
Co-authored-by: Eric Eastwood <erice@element.io>
* Update synapse/storage/databases/main/cache.py
Co-authored-by: Eric Eastwood <erice@element.io>
* MILLISEC -> MS
* Expand on comment
* Move and tweak comment about Postgres
* Use `wrap_as_background_process`
---------
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
Co-authored-by: Eric Eastwood <erice@element.io>
2023-08-08 11:10:07 +01:00
Patrick Cloke
d98a43d922
Stabilize support for MSC3970: updated transaction semantics (scope to `device_id`) ( #15629 )
...
For now this maintains compatible with old Synapses by falling back
to using transaction semantics on a per-access token. A future version
of Synapse will drop support for this.
2023-08-04 07:47:18 -04:00
Erik Johnston
ae55cc1e6b
Add ability to wait for locks and add locks to purge history / room deletion ( #15791 )
...
c.f. #13476
2023-07-31 10:58:03 +01:00
Anshul Madnawat
58f8305114
Inline SQL queries using boolean parameters ( #15525 )
...
SQLite now supports TRUE and FALSE constants, simplify some
queries by inlining those instead of passing them as arguments.
2023-07-26 18:45:47 +00:00
Mathieu Velten
8ebfd577e2
Bump DB version to 79 since synapse v1.88 was already there ( #15998 )
2023-07-26 14:51:44 +02:00
Shay
f08d05dd2c
Actually stop reading from column `user_id` of tables `profiles` ( #15955 )
2023-07-23 16:30:54 -07:00
Erik Johnston
fc1e534e41
Speed up updating state in large rooms ( #15971 )
...
This should speed up updating state in rooms with lots of state.
2023-07-20 15:51:28 +01:00
Erik Johnston
19796e20aa
Fix bad merge of #15933 ( #15958 )
...
This was because we reverted the bump of the schema version, so we were not applying the new deltas.
2023-07-19 12:17:08 +00:00
Erik Johnston
40a3583ba1
Fix race in triggers for read/write locks. ( #15933 )
2023-07-19 12:06:38 +01:00
Shay
cb6e2c6cc7
Fix background schema updates failing over a large upgrade gap ( #15887 )
2023-07-18 16:59:27 -07:00
Olivier Wilkinson (reivilibre)
8e8431bc6e
Merge branch 'master' into develop
2023-07-18 16:45:39 +01:00
Patrick Cloke
6d81aec09f
Support room version 11 ( #15912 )
...
And fix a bug in the implementation of the updated redaction
format (MSC2174) where the top-level redacts field was not
properly added for backwards-compatibility.
2023-07-18 08:44:59 -04:00
Shay
e625c3dca0
Revert "Stop writing to column `user_id` of tables `profiles` and `user_filters`. ( #15953 )
...
* Revert "Stop writing to column `user_id` of tables `profiles` and `user_filters` (#15787 )"
This reverts commit f25b0f8808
.
* newsfragement
2023-07-18 11:44:09 +01:00
Mathieu Velten
8eb7bb975e
Mark get_user_in_directory private since only used in tests ( #15884 )
2023-07-12 11:09:13 +02:00
Erik Johnston
e55a9b3e41
Fix downgrading to previous version of Synapse ( #15907 )
...
We do this by marking the constraint as deferrable.
2023-07-10 16:24:42 +01:00
Shay
f25b0f8808
Stop writing to column `user_id` of tables `profiles` and `user_filters` ( #15787 )
2023-07-07 09:23:27 -07:00
Erik Johnston
39d131b016
Add basic read/write lock ( #15782 )
2023-07-05 17:25:00 +01:00
Eric Eastwood
ce857c05d5
Add tracing to media `/upload` endpoint ( #15850 )
...
Add tracing instrumentation to media `/upload` code paths to investigate https://github.com/matrix-org/synapse/issues/15841
2023-07-05 10:22:21 -05:00
Jason Little
4cf9f92f39
Fix could not serialize access due to concurrent `DELETE` from presence_stream ( #15826 )
...
* Change update_presence to have a isolation level of READ_COMMITTED
* changelog
2023-07-05 11:44:02 +01:00
Erik Johnston
95a96b21eb
Add foreign key constraint to `event_forward_extremities`. ( #15751 )
2023-07-05 09:43:19 +00:00
Michael Weimann
c8e81898b6
Add not_user_type param to the list accounts admin API ( #15844 )
...
Signed-off-by: Michael Weimann <michaelw@element.io>
2023-07-04 15:03:20 -07:00
pacien
07d7cbfe69
devices: use combined ANY clause for faster cleanup ( #15861 )
...
Old device entries for the same user were being removed in individual
SQL commands, making the batch take way longer than necessary.
This combines the commands into a single one with a IN/ANY clause.
Example of log entry before the change, regularly observed with
"log_min_duration_statement = 10000" in PostgreSQL's config:
LOG: duration: 42538.282 ms statement:
DELETE FROM device_lists_stream
WHERE user_id = '@someone' AND device_id = 'someid1'
AND stream_id < 123456789
;
DELETE FROM device_lists_stream
WHERE user_id = '@someone' AND device_id = 'someid2'
AND stream_id < 123456789
;
[repeated for each device ID of that user, potentially a lot...]
With the patch applied on my instance for the past couple of days, I
no longer notice overly long statements of that particular kind.
Signed-off-by: pacien <pacien.trangirard@pacien.net>
2023-07-03 16:39:38 +02:00
reivilibre
53aa26eddc
Add a timeout that aborts any Postgres statement taking more than 1 hour. ( #15853 )
...
* Add a timeout to Postgres statements
* Newsfile
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
---------
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
2023-07-03 11:38:57 +01:00
Shay
78cfa55dad
Fix sqlite `user_filters` upgrade ( #15817 )
2023-06-27 09:41:42 +01:00
Nicolas Werner
e0c39d6bb5
Fix forgotten rooms missing in initial sync ( #15815 )
...
If you leave a room and forget it, then rejoin it, the room would be
missing from the next initial sync.
fixes #13262
Signed-off-by: Nicolas Werner <n.werner@famedly.com>
2023-06-21 14:56:31 +01:00
Eric Eastwood
0f02f0b4da
Remove experimental MSC2716 implementation to incrementally import history into existing rooms ( #15748 )
...
Context for why we're removing the implementation:
- https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1487441010
- https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1504262734
Anyone wanting to continue MSC2716, should also address these leftover tasks: https://github.com/matrix-org/synapse/issues/10737
Closes https://github.com/matrix-org/synapse/issues/10737 in the fact that it is not longer necessary to track those things.
2023-06-16 14:12:24 -05:00
Andrew Morgan
2ac6c3bbb5
Don't always lock "user_ips" table when performing non-native upsert ( #15788 )
2023-06-16 15:25:44 +01:00
Jason Little
21fea6b749
Prefill events after invalidate not before when persisting events ( #15758 )
...
Fixes #15757
2023-06-14 09:42:18 +01:00
Shay
553f2f53e7
Replace `EventContext` fields `prev_group` and `delta_ids` with field `state_group_deltas` ( #15233 )
2023-06-13 13:22:06 -07:00
Erik Johnston
c485ed1c5a
Clear event caches when we purge history ( #15609 )
...
This should help a little with #13476
---------
Co-authored-by: Patrick Cloke <patrickc@matrix.org>
2023-06-08 13:14:40 +01:00
David Robertson
d162aecaac
Quick & dirty metric for background update status ( #15740 )
...
* Quick & dirty metric for background update status
* Changelog
* Remove debug
Co-authored-by: Mathieu Velten <mathieuv@matrix.org>
* Actually write to _aborted
---------
Co-authored-by: Mathieu Velten <mathieuv@matrix.org>
2023-06-07 17:12:23 +00:00
Eric Eastwood
e536f02f68
Remove superfluous `room_memberships` join from background update ( #15733 )
...
Spawning from https://github.com/matrix-org/synapse/pull/15731
2023-06-07 11:47:01 -05:00
Erik Johnston
8934c11935
Merge branch 'master' into develop
2023-06-07 14:45:19 +01:00
Erik Johnston
f7c6553ebc
Fix schema delta error in 1.85 ( #15739 )
...
Some users seem to have multiple rows per user / room with a null thread
ID, which we need to handle.
2023-06-07 13:02:42 +01:00
Erik Johnston
a701c089fa
Fix schema delta error in 1.85 ( #15738 )
...
There appears to be a race where you can end up with entries in
`event_push_summary` with both a `NULL` and `main` thread ID.
Fixes #15736
Introduced in #15597
2023-06-07 10:50:32 +01:00
Eric Eastwood
9d911b0da6
No need for the extra join since `membership` is built-in to `current_state_events` ( #15731 )
...
This helps with the upstream `is_host_joined()` and `is_host_invited()` functions.
`membership` was added to `current_state_events` in https://github.com/matrix-org/synapse/pull/5706 and forced in https://github.com/matrix-org/synapse/pull/13745
2023-06-06 22:19:57 -05:00
Shay
6ee96e9366
Improve performance of user directory search ( #15729 )
2023-06-06 21:16:03 +01:00
Patrick Cloke
f880e64b11
Stabilize support for MSC3952: Intentional mentions. ( #15520 )
2023-06-06 09:11:07 +01:00
Shay
d0c4257f14
`N + 3`: Read from column `full_user_id` rather than `user_id` of tables `profiles` and `user_filters` ( #15649 )
2023-06-02 17:24:13 -07:00
Mathieu Velten
e0f2429d13
Add a catch-all * to the supported relation types when redacting ( #15705 )
...
This is an update to MSC3912 implementation
2023-06-02 13:13:50 +00:00
H. Shay
8af29155ec
Merge branch 'release-v1.85' into develop
2023-06-01 10:26:37 -07:00
Erik Johnston
5ed0e8c61f
Cache requests for user's devices from federation ( #15675 )
...
This should mitigate the issue where lots of different servers requests
the same user's devices all at once.
2023-06-01 13:25:20 +00:00
Shay
6d9e2fd878
Speed up background jobs populate_full_user_id_user_filters and populate_full_user_id_profiles ( #15700 )
2023-05-31 15:13:48 -07:00
reivilibre
11e15d79b8
Fix a performance issue introduced in Synapse v1.83.0 which meant that purging rooms was very slow and database-intensive. ( #15693 )
...
* Add indices required to efficiently validate new foreign key constraints on stream_ordering
* Newsfile
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
---------
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
2023-05-31 14:59:56 +01:00
Gabriel Féron
daf3a67908
Add get_canonical_room_alias to module API ( #15450 )
...
Co-authored-by: Boxdot <d@zerovolt.org>
2023-05-31 09:18:37 -04:00
Patrick Cloke
2ad91ec628
Set thread_id column to non-null for event_push_{actions,actions_staging,summary} ( #15597 )
...
Updates the database schema to require a thread_id (by adding a
constraint that the column is non-null) for event_push_actions,
event_push_actions_staging, and event_push_actions_summary.
For PostgreSQL we add the constraint as NOT VALID, then
VALIDATE the constraint a background job to avoid locking
the table during an upgrade.
Each table is updated as a separate schema delta to avoid
deadlocks between them.
For SQLite we simply rebuild the table & copy the data.
2023-05-26 13:16:08 -04:00
Eric Eastwood
77156a4bc1
Process previously failed backfill events in the background ( #15585 )
...
Process previously failed backfill events in the background because they are bound to fail again and we don't need to waste time holding up the request for something that is bound to fail again.
Fix https://github.com/matrix-org/synapse/issues/13623
Follow-up to https://github.com/matrix-org/synapse/issues/13621 and https://github.com/matrix-org/synapse/issues/13622
Part of making `/messages` faster: https://github.com/matrix-org/synapse/issues/13356
2023-05-24 23:22:24 -05:00
Erik Johnston
c7e9c1d5ae
Speed up user directory rebuild for users some more... ( #15665 )
2023-05-24 14:13:28 +00:00