Track unconverted device list outbound pokes using a position instead (#14516)
When a local device list change is added to
`device_lists_changes_in_room`, the `converted_to_destinations` flag is
set to `FALSE` and the `_handle_new_device_update_async` background
process is started. This background process looks for unconverted rows
in `device_lists_changes_in_room`, copies them to
`device_lists_outbound_pokes` and updates the flag.
To update the `converted_to_destinations` flag, the database performs a
`DELETE` and `INSERT` internally, which fragments the table. To avoid
this, track unconverted rows using a `(stream ID, room ID)` position
instead of the flag.
From now on, the `converted_to_destinations` column indicates rows that
need converting to outbound pokes, but does not indicate whether the
conversion has already taken place.
Closes #14037.
Signed-off-by:
Sean Quah <seanq@matrix.org>
Showing
- changelog.d/14516.misc 1 addition, 0 deletionschangelog.d/14516.misc
- synapse/handlers/device.py 27 additions, 3 deletionssynapse/handlers/device.py
- synapse/storage/database.py 7 additions, 6 deletionssynapse/storage/database.py
- synapse/storage/databases/main/devices.py 69 additions, 38 deletionssynapse/storage/databases/main/devices.py
- synapse/storage/schema/main/delta/73/12refactor_device_list_outbound_pokes.sql 53 additions, 0 deletions...a/main/delta/73/12refactor_device_list_outbound_pokes.sql
- tests/storage/test_devices.py 1 addition, 2 deletionstests/storage/test_devices.py
Loading
Please register or sign in to comment