MatrixSynapse/tests/storage
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
..
databases Fix `have_seen_event` cache not being invalidated (#13863) 2022-09-27 15:55:43 -05:00
util Wait for lazy join to complete when getting current state (#12872) 2022-06-01 16:02:53 +01:00
__init__.py
test__base.py
test_account_data.py
test_appservice.py
test_background_update.py
test_base.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
test_cleanup_extrems.py
test_client_ips.py
test_database.py
test_devices.py Additional constants for EDU types. (#12884) 2022-05-27 07:14:36 -04:00
test_directory.py
test_e2e_room_keys.py
test_end_to_end_keys.py
test_event_chain.py Rename storage classes (#12913) 2022-05-31 12:17:50 +00:00
test_event_federation.py Only try to backfill event if we haven't tried before recently (#13635) 2022-09-23 14:01:29 -05:00
test_event_metrics.py
test_event_push_actions.py Improve tests for get_unread_push_actions_for_user_in_range_*. (#13893) 2022-09-26 18:28:12 +00:00
test_events.py Faster room joins: avoid blocking when pulling events with missing prevs (#13355) 2022-07-26 12:39:23 +01:00
test_id_generators.py
test_keys.py
test_main.py
test_monthly_active_users.py
test_profile.py
test_purge.py Async get event cache prep (#13242) 2022-07-15 09:30:46 +00:00
test_receipts.py Accept & store thread IDs for receipts (implement MSC3771). (#13782) 2022-09-23 14:33:28 +00:00
test_redaction.py Rename storage classes (#12913) 2022-05-31 12:17:50 +00:00
test_registration.py Add timestamp to user's consent (#13741) 2022-09-08 15:41:48 +00:00
test_rollback_worker.py
test_room.py Remove obsolete RoomEventsStoreTestCase (#13200) 2022-07-07 13:47:26 +01:00
test_room_search.py Rename storage classes (#12913) 2022-05-31 12:17:50 +00:00
test_roommember.py Fix that user cannot `/forget` rooms after the last member has left (#13546) 2022-08-30 09:58:38 +00:00
test_state.py Make DictionaryCache have better expiry properties (#13292) 2022-07-21 17:13:44 +01:00
test_stream.py
test_transactions.py
test_txn_limit.py
test_unsafe_locale.py
test_user_directory.py Remove remaining bits of groups code. (#12936) 2022-06-01 09:41:25 -04:00