synapse-product/synapse/storage
Erik Johnston 5c9e39e619
Track device list updates per room. (#12321)
This is a first step in dealing with #7721.

The idea is basically that rather than calculating the full set of users a device list update needs to be sent to up front, we instead simply record the rooms the user was in at the time of the change. This will allow a few things:

1. we can defer calculating the set of remote servers that need to be poked about the change; and
2. during `/sync` and `/keys/changes` we can avoid also avoid calculating users who share rooms with other users, and instead just look at the rooms that have changed.

However, care needs to be taken to correctly handle server downgrades. As such this PR writes to both `device_lists_changes_in_room` and the `device_lists_outbound_pokes` table synchronously. In a future release we can then bump the database schema compat version to `69` and then we can assume that the new `device_lists_changes_in_room` exists and is handled.

There is a temporary option to disable writing to `device_lists_outbound_pokes` synchronously, allowing us to test the new code path does work (and by implication upgrading to a future release and downgrading to this one will work correctly).

Note: Ideally we'd do the calculation of room to servers on a worker (e.g. the background worker), but currently only master can write to the `device_list_outbound_pokes` table.
2022-04-04 15:25:20 +01:00
..
databases Track device list updates per room. (#12321) 2022-04-04 15:25:20 +01:00
engines Refuse to start if DB has an unsafe locale (#12262) 2022-03-23 10:23:05 -07:00
schema Track device list updates per room. (#12321) 2022-04-04 15:25:20 +01:00
util Use auto_attribs/native type hints for attrs classes. (#11692) 2022-01-13 13:49:28 +00:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
_base.py Invalidate the get_users_in_room{_with_profile} caches only when necessary. (#11878) 2022-02-02 12:24:07 -05:00
background_updates.py Add config settings for background update parameters (#11980) 2022-03-11 10:46:45 -08:00
database.py Update LoggingTransaction.call_after and call_on_exception docstrings (#12315) 2022-03-29 12:31:05 +01:00
keys.py Use auto_attribs/native type hints for attrs classes. (#11692) 2022-01-13 13:49:28 +00:00
persist_events.py Add cache for get_membership_from_event_ids (#12272) 2022-03-25 14:58:56 +00:00
prepare_database.py Minor updates, and docs, for schema delta files (#11823) 2022-01-25 14:11:13 +00:00
purge_events.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
push_rule.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
roommember.py Do not include rooms with an unknown room version in a sync response. (#10644) 2021-08-19 11:12:55 -04:00
state.py Raise an exception when getting state at an outlier (#12191) 2022-04-01 13:01:49 +01:00
types.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00