-
Notifications
You must be signed in to change notification settings - Fork 190
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
Sliding Sync: Fix outlier re-persisting causing problems with sliding sync tables #17635
Sliding Sync: Fix outlier re-persisting causing problems with sliding sync tables #17635
Conversation
(room_id, event_stream_ordering, bump_stamp, {", ".join(sliding_sync_updates_keys)}) | ||
VALUES ( | ||
?, | ||
(SELECT stream_ordering FROM events WHERE room_id = ? ORDER BY stream_ordering DESC LIMIT 1), |
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.
This could be simplified to remove ORDER BY stream_ordering DESC
. This just gives a more correct answer but we will end up with the correct answer anyway when _update_sliding_sync_tables_with_new_persisted_events_txn()
runs right after this.
(SELECT stream_ordering FROM events WHERE room_id = ? ORDER BY stream_ordering DESC LIMIT 1), | |
(SELECT stream_ordering FROM events WHERE room_id = ? LIMIT 1), |
Up to you
remaining_events = await self.store.get_events( | ||
current_state_ids_map.values() | ||
) | ||
remaining_events = await self.store.get_events(missing_event_ids) |
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.
Found this logic bug because of the new tests. This is a separate problem though that we're fixing.
Now we're actually fetching the missing_event_ids
if we have any.
…ugs-with-sliding-sync-tables
Thanks for the review and merge @erikjohnston 🐁 |
VALUES ( | ||
?, ?, ?, ?, ?, | ||
(SELECT stream_ordering FROM events WHERE event_id = ?), | ||
(SELECT instance_name FROM events WHERE 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.
We should have fallen back to "master"
when this isn't filled in
(SELECT instance_name FROM events WHERE event_id = ?) | |
(SELECT COALESCE(instance_name, 'master') FROM events WHERE event_id = ?) |
Fixed up in #17636 ⏩
Fix outlier re-persisting causing problems with sliding sync tables
Follow-up to #17512
When running on
matrix.org
, we discovered that a remote invite is first persisted as anoutlier
and then re-persisted again where it is de-outliered. The first the time, theoutlier
is persisted with onestream_ordering
but when persisted again and de-outliered, it is assigned a differentstream_ordering
that won't end up being used. Since we call_calculate_sliding_sync_table_changes()
before_update_outliers_txn()
which fixes this discrepancy (always use thestream_ordering
from the first time it was persisted), we're working with an unreliablestream_ordering
value that will possibly be unused and not make it into theevents
table.TODO
Developer notes
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)