synapse-product/synapse/storage/databases/main
Eric Eastwood 29269d9d3f
Fix have_seen_event cache not being invalidated (#13863)
Fix https://github.com/matrix-org/synapse/issues/13856
Fix https://github.com/matrix-org/synapse/issues/13865

> Discovered while trying to make Synapse fast enough for [this MSC2716 test for importing many batches](https://github.com/matrix-org/complement/pull/214#discussion_r741678240). As an example, disabling the `have_seen_event` cache saves 10 seconds for each `/messages` request in that MSC2716 Complement test because we're not making as many federation requests for `/state` (speeding up `have_seen_event` itself is related to https://github.com/matrix-org/synapse/issues/13625) 
> 
> But this will also make `/messages` faster in general so we can include it in the [faster `/messages` milestone](https://github.com/matrix-org/synapse/milestone/11).
> 
> *-- https://github.com/matrix-org/synapse/issues/13856*


### The problem

`_invalidate_caches_for_event` doesn't run in monolith mode which means we never even tried to clear the `have_seen_event` and other caches. And even in worker mode, it only runs on the workers, not the master (AFAICT).

Additionally there was bug with the key being wrong so `_invalidate_caches_for_event` never invalidates the `have_seen_event` cache even when it does run.

Because we were using the `@cachedList` wrong, it was putting items in the cache under keys like `((room_id, event_id),)` with a `set` in a `set` (ex. `(('!TnCIJPKzdQdUlIyXdQ:test', '$Iu0eqEBN7qcyF1S9B3oNB3I91v2o5YOgRNPwi_78s-k'),)`) and we we're trying to invalidate with just `(room_id, event_id)` which did nothing.
2022-09-27 15:55:43 -05:00
..
__init__.py Handle the case of remote users leaving a partial join room for device lists (#13885) 2022-09-27 13:01:08 +01:00
account_data.py Speed up fetching large numbers of push rules (#13592) 2022-08-23 13:15:43 +01:00
appservice.py
cache.py Simplify cache invalidation after event persist txn (#13796) 2022-09-26 16:26:35 +01:00
censor_events.py
client_ips.py
deviceinbox.py
devices.py Handle the case of remote users leaving a partial join room for device lists (#13885) 2022-09-27 13:01:08 +01:00
directory.py
e2e_room_keys.py
end_to_end_keys.py Cancel the processing of key query requests when they time out. (#13680) 2022-09-07 12:03:32 +01:00
event_federation.py Only try to backfill event if we haven't tried before recently (#13635) 2022-09-23 14:01:29 -05:00
event_push_actions.py Improve tests for get_unread_push_actions_for_user_in_range_*. (#13893) 2022-09-26 18:28:12 +00:00
events_bg_updates.py
events_forward_extremities.py
events_worker.py Fix have_seen_event cache not being invalidated (#13863) 2022-09-27 15:55:43 -05:00
events.py Handle the case of remote users leaving a partial join room for device lists (#13885) 2022-09-27 13:01:08 +01:00
filtering.py
keys.py
lock.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
media_repository.py
metrics.py
monthly_active_users.py
openid.py
presence.py
profile.py
purge_events.py Add support to purge rows from MSC2716 and other tables when purging a room (#13825) 2022-09-16 10:56:56 -05:00
push_rule.py Port the push rule classes to Rust. (#13768) 2022-09-20 12:10:31 +01:00
pusher.py Track device IDs for pushers (#13831) 2022-09-21 15:31:53 +00:00
receipts.py Accept & store thread IDs for receipts (implement MSC3771). (#13782) 2022-09-23 14:33:28 +00:00
registration.py Add timestamp to user's consent (#13741) 2022-09-08 15:41:48 +00:00
rejections.py
relations.py Properly paginate forward in the /relations API. (#13840) 2022-09-22 12:47:49 +00:00
room_batch.py
room.py Add new columns tracking when we partial-joined (#13892) 2022-09-27 17:26:35 +01:00
roommember.py Handle the case of remote users leaving a partial join room for device lists (#13885) 2022-09-27 13:01:08 +01:00
search.py
session.py
signatures.py
state_deltas.py
state.py Instrument get_metadata_for_events for tracing (#13730) 2022-09-07 11:41:52 -05:00
stats.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
stream.py Properly paginate forward in the /relations API. (#13840) 2022-09-22 12:47:49 +00:00
tags.py
transactions.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
ui_auth.py
user_directory.py
user_erasure_store.py