Skip to content
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: various fixups to the sliding sync joined room background job #17673

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

erikjohnston
Copy link
Member

@erikjohnston erikjohnston commented Sep 5, 2024

Follow-up to #17652, #17641, #17634, #17631 and #17632 to fix-up #17512

@erikjohnston erikjohnston changed the title Sliding sync: various fixups to the sliding syncj oined Sliding sync: various fixups to the sliding sync joined room background job Sep 5, 2024
This has two advantages: the first is we only read rooms that the server
is joined to. The second is that we can end up locked for ages waiting
for various delete room jobs that are running (which lock the rooms
rows).
We somehow have a room where the only non-outlier event has a negative
stream ordering. It is unclear how this happened.
@erikjohnston erikjohnston marked this pull request as ready for review September 6, 2024 08:15
@erikjohnston erikjohnston requested a review from a team as a code owner September 6, 2024 08:15
Comment on lines -1725 to -1728
assert most_recent_event_stream_ordering > 0, (
"We should have at-least one event in the room (our own join membership event for example) "
+ "that isn't backfilled (negative `stream_ordering`) if we are joined to the room."
)
Copy link
Contributor

@MadLittleMods MadLittleMods Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there is a room where this is possible? We should add a comment in this asserts place that ideally we could assert this but there is actually some case where it happens.

                # If we've just joined a remote room, then the last bump event may
                # have been backfilled (and so have a negative stream ordering).
                # These negative stream orderings can't sensibly be compared, but TODO

We need some value since the event_stream_ordering is a NOT NULL column. Negative works but we avoid doing it in other places since it would send the room to the bottom of the list on the client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1602 to +1603
SELECT DISTINCT room_id FROM local_current_membership
WHERE membership = 'join'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you've tested that this is fast enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ideal, but it completes in a few minutes on matrix.org, so should be fast enough everywhere else.

@erikjohnston erikjohnston merged commit b3047f3 into develop Sep 10, 2024
39 checks passed
@erikjohnston erikjohnston deleted the erikj/ss_fix_bg_update_joined branch September 10, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants