From e8d63c1a9d39018739bb37d54400cc5166f92750 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 29 Aug 2024 17:19:49 +0100 Subject: [PATCH 1/3] Fix background update for sliding sync (find previous membership) --- synapse/storage/databases/main/events_bg_updates.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index 3160e12bb30..b86f873eba2 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -1967,12 +1967,13 @@ def _find_previous_membership_txn( txn.execute( """ SELECT event_id, membership - FROM room_memberships + FROM room_memberships AS m + INNER JOIN events AS e USING (room_id, event_id) WHERE room_id = ? - AND user_id = ? - AND event_stream_ordering < ? - ORDER BY event_stream_ordering DESC + AND m.user_id = ? + AND e.stream_ordering < ? + ORDER BY e.stream_ordering DESC LIMIT 1 """, ( From 3340f18ddbe8644d9144a06942d6c1884665e0c4 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 29 Aug 2024 17:20:18 +0100 Subject: [PATCH 2/3] Newsfile --- changelog.d/17632.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/17632.misc diff --git a/changelog.d/17632.misc b/changelog.d/17632.misc new file mode 100644 index 00000000000..2f81356d127 --- /dev/null +++ b/changelog.d/17632.misc @@ -0,0 +1 @@ +Store sliding sync per-connection state in the database. From e4f731becc4c7bb97d623cd3bdd16d5665ef313f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 29 Aug 2024 17:25:23 +0100 Subject: [PATCH 3/3] Newsfile --- changelog.d/17632.misc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/17632.misc b/changelog.d/17632.misc index 2f81356d127..756918e2b21 100644 --- a/changelog.d/17632.misc +++ b/changelog.d/17632.misc @@ -1 +1 @@ -Store sliding sync per-connection state in the database. +Pre-populate room data used in experimental [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) Sliding Sync `/sync` endpoint for quick filtering/sorting.