summary refs log tree commit diff
path: root/synapse/storage/databases/main/cache.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Batch fetch bundled references (#14508)Patrick Cloke2022-11-221-0/+1
| | | | | | | | | Avoid an n+1 query problem and fetch the bundled aggregations for m.reference relations in a single query instead of a query per event. This applies similar logic for as was previously done for edits in 8b309adb436c162510ed1402f33b8741d71fc058 (#11660; threads in b65acead428653b988351ae8d7b22127a22039cd (#11752); and annotations in 1799a54a545618782840a60950ef4b64da9ee24d (#14491).
* Invalidate rooms for user caches when receiving membership events (#14155)Nick Mills-Barrett2022-10-171-0/+4
| | | | | This should fix a race where the event notification comes in over replication before the state replication, leaving a window during which a sync may get an incorrect list of rooms for the user.
* Accept threaded receipts for events related to the root event. (#14174)Patrick Cloke2022-10-141-0/+1
| | | | | | | | | The root node of a thread (and events related to it) are considered "part of a thread" when validating receipts. This allows clients which show the root node in both the main timeline and the threaded timeline to easily send receipts in either. Note that threaded notifications are not created for these events, these events created notifications on the main timeline.
* Properly invalidate get_thread_id cache. (#14163)Patrick Cloke2022-10-141-0/+1
| | | This was missed in 2b6d41ebd685fb546e52acdbcb0024dfcf5a5db1 (#13824).
* Add an API for listing threads in a room. (#13394)Patrick Cloke2022-10-131-0/+1
| | | | | | | | | Implement the /threads endpoint from MSC3856. This is currently unstable and behind an experimental configuration flag. It includes a background update to backfill data, results from the /threads endpoint will be partial until that finishes.
* Remove the experimental implementation of MSC3772. (#14094)Patrick Cloke2022-10-121-3/+0
| | | MSC3772 has been abandoned.
* Optimise get_rooms_for_user (drop with_stream_ordering) (#13787)Nick Mills-Barrett2022-09-291-0/+1
|
* Simplify cache invalidation after event persist txn (#13796)Nick Mills-Barrett2022-09-261-13/+21
| | | | | This moves all the invalidations into a single place and de-duplicates the code involved in invalidating caches for a given event by using the base class method.
* Add cache invalidation across workers to module API (#13667)Mathieu Velten2022-09-211-6/+14
| | | Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
* Use cache store remove base slaved (#13329)Nick Mills-Barrett2022-07-211-0/+26
| | | This comes from two identical definitions in each of the base stores, and means the base slaved store is now empty and can be removed.
* Revert "Make all `process_replication_rows` methods async (#13304)" (#13312)Erik Johnston2022-07-181-2/+2
| | | This reverts commit 5d4028f217f178fcd384d5bfddd92225b4e78c51.
* Make all `process_replication_rows` methods async (#13304)Nick Mills-Barrett2022-07-171-2/+2
| | | | | More prep work for asyncronous caching, also makes all process_replication_rows methods consistent (presence handler already is so). Signed off by Nick @ Beeper (@Fizzadar)
* Async get event cache prep (#13242)Nick Mills-Barrett2022-07-151-2/+5
| | | | | Some experimental prep work to enable external event caching based on #9379 & #12955. Doesn't actually move the cache at all, just lays the groundwork for async implemented caches. Signed off by Nick @ Beeper (@Fizzadar)
* Add index to cache invalidations (#12747)Erik Johnston2022-05-171-0/+8
| | | | | For workers that rarely write to the cache the `get_all_updated_caches` query can become expensive if the worker falls behind when reading the cache.
* Add cache for `get_membership_from_event_ids` (#12272)Erik Johnston2022-03-251-0/+4
| | | | | This should speed up push rule calculations for rooms with large numbers of local users when the main push rule cache fails. Co-authored-by: reivilibre <oliverw@matrix.org>
* Add some missing type hints to cache datastore. (#12216)Patrick Cloke2022-03-161-21/+36
|
* Allow retrieving the relations of a redacted event. (#12130)Patrick Cloke2022-03-101-0/+4
| | | | | | | | | This is allowed per MSC2675, although the original implementation did not allow for it and would return an empty chunk / not bundle aggregations. The main thing to improve is that the various caches get cleared properly when an event is redacted, and that edits must not leak if the original event is redacted (as that would presumably leak something similar to the original event content).
* Invalidate caches when an event with a relation is redacted. (#12121)Patrick Cloke2022-03-071-0/+2
| | | | | The caches for the target of the relation must be cleared so that the bundled aggregations are re-calculated after the redaction is processed.
* Invalidate the get_users_in_room{_with_profile} caches only when necessary. ↵Patrick Cloke2022-02-021-5/+11
| | | | | | | (#11878) The get_users_in_room and get_users_in_room_with_profiles are now only invalidated when the membership of a room changes, instead of during any state change in the room.
* Type hint the constructors of the data store classes (#11555)Sean Quah2021-12-131-2/+7
|
* Add type hints for most `HomeServer` parameters (#11095)Sean Quah2021-10-221-2/+5
|
* add a cache to have_seen_event (#9953)Richard van der Hoff2021-06-011-0/+1
| | | Empirically, this helped my server considerably when handling gaps in Matrix HQ. The problem was that we would repeatedly call have_seen_events for the same set of (50K or so) auth_events, each of which would take many minutes to complete, even though it's only an index scan.
* Combine `LruCache.invalidate` and `invalidate_many` (#9973)Richard van der Hoff2021-05-271-3/+3
| | | | | | | | | | * Make `invalidate` and `invalidate_many` do the same thing ... so that we can do either over the invalidation replication stream, and also because they always confused me a bit. * Kill off `invalidate_many` * changelog
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Separate `get_current_token` into two. (#8113)Erik Johnston2020-08-191-2/+2
| | | | | | | | | | | | The function is used for two purposes: 1) for subscribers of streams to get a token they can use to get further updates with, and 2) for replication to track position of the writers of the stream. For streams with a single writer the two scenarios produce the same result, however the situation becomes complicated for streams with multiple writers. The current `MultiWriterIdGenerator` does not correctly handle the first case (which is not an issue as its only used for the `caches` stream which nothing subscribes to outside of replication).
* Revert #7736 (#8039)Brendan Abolivier2020-08-061-1/+0
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+307