Skip to content
Snippets Groups Projects
Unverified Commit 169851b4 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Merge pull request #4109 from matrix-org/erikj/repl_devices

A couple of replication fixes for device lists
parents 00fdfbc2 39f41986
No related branches found
No related tags found
No related merge requests found
Reduce replication traffic for device lists
...@@ -589,10 +589,14 @@ class DeviceStore(SQLBaseStore): ...@@ -589,10 +589,14 @@ class DeviceStore(SQLBaseStore):
combined list of changes to devices, and which destinations need to be combined list of changes to devices, and which destinations need to be
poked. `destination` may be None if no destinations need to be poked. poked. `destination` may be None if no destinations need to be poked.
""" """
# We do a group by here as there can be a large number of duplicate
# entries, since we throw away device IDs.
sql = """ sql = """
SELECT stream_id, user_id, destination FROM device_lists_stream SELECT MAX(stream_id) AS stream_id, user_id, destination
FROM device_lists_stream
LEFT JOIN device_lists_outbound_pokes USING (stream_id, user_id, device_id) LEFT JOIN device_lists_outbound_pokes USING (stream_id, user_id, device_id)
WHERE ? < stream_id AND stream_id <= ? WHERE ? < stream_id AND stream_id <= ?
GROUP BY user_id, destination
""" """
return self._execute( return self._execute(
"get_all_device_list_changes_for_remotes", None, "get_all_device_list_changes_for_remotes", None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment