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: use new DB tables #17630

Merged
merged 25 commits into from
Sep 1, 2024
Merged

Sliding sync: use new DB tables #17630

merged 25 commits into from
Sep 1, 2024

Conversation

erikjohnston
Copy link
Member

@erikjohnston erikjohnston commented Aug 29, 2024

Based on #17629

Utilizing the new sliding sync tables added in #17512 for fast acquisition of rooms for the user and filtering/sorting.

@erikjohnston erikjohnston changed the title Erikj/ss new tables Sliding sync: use new DB tables Aug 29, 2024
@erikjohnston erikjohnston marked this pull request as ready for review August 29, 2024 18:14
@erikjohnston erikjohnston requested a review from a team as a code owner August 29, 2024 18:14
synapse/handlers/sliding_sync/room_lists.py Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Show resolved Hide resolved
synapse/storage/databases/main/events_bg_updates.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/roommember.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
) -> Dict[str, RoomsForUserSlidingSync]:
sql = """
SELECT m.room_id, m.sender, m.membership, m.membership_event_id,
r.room_version,
Copy link
Contributor

@MadLittleMods MadLittleMods Aug 30, 2024

Choose a reason for hiding this comment

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

It looks like we're simply fetching out room_version_id just because that's what's in a RoomsForUser. We don't use it anywhere in the Sliding Sync code (as far as I can tell).

  • We can remove it from RoomsForUserSlidingSync
  • We should just use a different data type. Probably the same as RoomsForUser but without room_version_id. We could have RoomsForUserSlidingSync and RoomsForUserSlidingSyncWithState for example

Copy link
Contributor

Choose a reason for hiding this comment

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

This could be addressed in a future PR. Probably would be good to create an issue for this one

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yeah. So, I had the same thought about removing it, but it turns out that sync v2 specifically checks that the room version is known and so we should probably do something similar in sliding sync as well.

Base automatically changed from erikj/ss_room_list_split to develop September 1, 2024 09:52
@erikjohnston erikjohnston merged commit 709b736 into develop Sep 1, 2024
39 checks passed
@erikjohnston erikjohnston deleted the erikj/ss_new_tables branch September 1, 2024 10:25
erikjohnston added a commit that referenced this pull request Sep 4, 2024
Broke in #17630

---------

Co-authored-by: Andrew Morgan <[email protected]>
MadLittleMods added a commit that referenced this pull request Sep 11, 2024
…ng_sync_rooms_for_user(...)` (#17692)

We need to bust the `get_sliding_sync_rooms_for_user`
cache when the room encryption is updated and any
other field that is used in the query.

Follow-up to #17630

- Bust cache for membership change (cross-reference
`get_rooms_for_user`)
- Bust cache for room `encryption` (cross-reference
`get_room_encryption`)
- Bust cache for `forgotten` (cross-reference
`did_forget`/`get_forgotten_rooms_for_user`)
MadLittleMods added a commit that referenced this pull request Sep 12, 2024
Move filters tests to rest layer in order to test the new (with sliding
sync tables) and fallback paths that Sliding Sync can use.

Also found a bug in the new path because it's not being tested which is
also fixed in this PR. We now take into account `has_known_state` when
filtering.

Spawning from
#17662 (comment).
This should have been done when we started using the new sliding sync
tables in #17630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants