-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix background update for sliding sync (find previous membership) (v2) #17632
Conversation
ORDER BY event_stream_ordering DESC | ||
AND m.user_id = ? | ||
AND e.stream_ordering < ? | ||
ORDER BY e.stream_ordering DESC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For onlookers, see context in #17631 (comment)
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double-checking that looking it up this way isn't slow vs just by (event_id)
The events
table does have "events_room_stream" btree (room_id, stream_ordering)
so I think this could work fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, empirically seems fast. Also helped by the fact these rooms should have very few events in them (generally just an invite then rejection)
Follow-up to #17631 and #17632 to fix-up #17599 --------- Co-authored-by: Eric Eastwood <[email protected]>
This reverts commit ab414f2.
Introduced in #17512