-
Notifications
You must be signed in to change notification settings - Fork 503
Sliding Sync: Pre-populate room data for quick filtering/sorting #17512
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
Merged
erikjohnston
merged 147 commits into
develop
from
madlittlemods/sliding-sync-pre-populate-room-meta-data
Aug 29, 2024
Merged
Changes from 18 commits
Commits
Show all changes
147 commits
Select commit
Hold shift + click to select a range
d26ac74
Start thinking about schemas
MadLittleMods e7e9cb2
Add changelog
MadLittleMods 8392d6a
Use foreign keys
MadLittleMods ad1c887
Merge branch 'develop' into madlittlemods/sliding-sync-pre-populate-r…
MadLittleMods 2b5f07d
Start of updating `sliding_sync_joined_rooms`
MadLittleMods 1a251d5
Fill in `sliding_sync_non_join_memberships` when current state changes
MadLittleMods f96d0c3
Special treatment for boolean columns
MadLittleMods 2f3bd27
Test is running
MadLittleMods cb33580
Server left room test
MadLittleMods 87d9561
Change to updating the latest membership in the room
MadLittleMods 61cea4e
Closer to right
MadLittleMods 68a3daf
Fix comparison and insert
MadLittleMods 5b1053f
Better test assertions
MadLittleMods c590474
Test non-joins
MadLittleMods a1aaa47
Add more tests
MadLittleMods bf78692
Handle to_delete
MadLittleMods 5cf3ad3
Handle server left room
MadLittleMods bc3796d
Fix some lints
MadLittleMods cc2d2b6
Fill in `stream_ordering`/`bump_stamp` when we add current state to t…
MadLittleMods ca90901
Fill in `stream_ordering`/`bump_stamp` for any event being persisted
MadLittleMods 3367422
Need to fix upsert
MadLittleMods ed47a7e
Fix bumping when events are persisted out of order
MadLittleMods 0af3b48
Refactor to `sliding_sync_membership_snapshots`
MadLittleMods 552f8f4
Update descriptions
MadLittleMods f069659
Fix lints
MadLittleMods 53232e6
Fill in for remote invites (out of band, outlier membership)
MadLittleMods ab074f5
Fix events from rooms we're not joined to affecting the joined room s…
MadLittleMods 3e1f24e
User ID is not unique because user is joined to many rooms
MadLittleMods 83a5858
Add tests for remote invites
MadLittleMods 5589ae4
Add test for remote invite rejected/retracted
MadLittleMods 3423eb7
Add test to make sure snapshot evolves with membership
MadLittleMods f600eac
Adjust test description
MadLittleMods 517946d
Fix lints
MadLittleMods eb3a185
Fix federating backfill test
MadLittleMods a90f3d4
Merge branch 'develop' into madlittlemods/sliding-sync-pre-populate-r…
MadLittleMods 32ae162
Fix rejecting invite when no_longer_in_room (and other non-join trans…
MadLittleMods dc447a6
Clarify when/why we upsert
MadLittleMods 96a4614
Update fixme comment
MadLittleMods 3566abd
Fix boolean schema for Postgres
MadLittleMods 5df94f4
Fix running into `StopIteration`
MadLittleMods 8b0e169
More realistic remote room forgotten test
MadLittleMods f49003c
No invites needed
MadLittleMods c8508f1
Clean up tables when a room is purged/deleted
MadLittleMods 9f551f0
Fix lints
MadLittleMods 1c931cb
Add background update for `sliding_sync_joined_rooms`
MadLittleMods 23e0d34
Add more tests
MadLittleMods d113e74
Fix lints
MadLittleMods 4b42e44
Work on background update for `sliding_sync_membership_snapshots`
MadLittleMods cbeff57
Use helper
MadLittleMods 6c2fc1d
Move background updates to `StateBackgroundUpdateStore`
MadLittleMods 8461faf
Add historical case to background update
MadLittleMods fb5af8f
Add background update test for `sliding_sync_membership_snapshots`
MadLittleMods ef5f0fc
Add more tests
MadLittleMods 419be7c
Finish off background update tests
MadLittleMods fa63c02
Fix lints
MadLittleMods 2ec93e3
Move function next to other helpers
MadLittleMods c89d859
Fill in docstrings
MadLittleMods d2f5247
Update comment
MadLittleMods df0c57d
Merge branch 'develop' into madlittlemods/sliding-sync-pre-populate-r…
MadLittleMods 98fb56e
Prefer `_update_sliding_sync_tables_with_new_persisted_events_txn(...…
MadLittleMods 8ee2e11
Add test to handle state reset in the meta data
MadLittleMods 574a04a
Test state reset on membership
MadLittleMods 6cc6bdb
Start of moving logic outside of the transaction (pre-process)
MadLittleMods 95d39db
Closer types
MadLittleMods 2964c56
Use dicts
MadLittleMods ac5b05c
Use `TypedDict`
MadLittleMods 45c89ec
Move pre-processing completely outside transaction
MadLittleMods 3eb77c3
Add sanity checks and fix wrong variable usage
MadLittleMods cc200ee
Merge branch 'develop' into madlittlemods/sliding-sync-pre-populate-r…
MadLittleMods 726a8e9
Attempt getting real events in backgroun update (needs work)
MadLittleMods 357132d
Go back to simpler fetching senders
MadLittleMods 0233e20
Use full event version after solving the circular import issues
MadLittleMods a5e06c6
Move back to the main store
MadLittleMods d3f90e4
Get full events for `_sliding_sync_joined_rooms_backfill`
MadLittleMods cda92af
No need to update `event_stream_ordering`/`bump_stamp` `ON CONFLICT`
MadLittleMods 772c501
Use available `stream_id`
MadLittleMods f6d7ffd
Move `_calculate_sliding_sync_table_changes(...)` after we assign `st…
MadLittleMods e7a3328
Pre-populate `membership` and `membership_event_stream_ordering`
MadLittleMods 5b1db39
Add `sender` column so we can tell leaves from kicks
MadLittleMods c612572
Move away from `stream_id`
MadLittleMods cda2311
Add `tombstone_successor_room_id` column
MadLittleMods 513ec8e
Update tests
MadLittleMods 8ddf5c7
Add tombstone to tests
MadLittleMods 0271155
Better handle none case
MadLittleMods 9724836
Log which room is strange
MadLittleMods 0a938b1
Add missing boolean column to portdb script
MadLittleMods ee2ef0b
Add `forgotten` column
MadLittleMods b45b189
Fill out docstring
MadLittleMods 31300f4
More docstring
MadLittleMods 339500d
Fix sub-query selecting multiple rows
MadLittleMods 9b8d201
Check `events_and_context` for state events
MadLittleMods fc73b6f
Rename `insert_key`/`insert_value`
MadLittleMods 980ee9a
Prefer `simple_update_txn`
MadLittleMods 6723824
Prefer `simple_delete_many_txn`
MadLittleMods d61aada
Simplify `_update_sliding_sync_tables_with_new_persisted_events_txn()`
MadLittleMods 4d87fa6
"backfill" -> "bg_update"
MadLittleMods 693c06b
Move away from backfill language
MadLittleMods bcba8cc
No need for transaction
MadLittleMods 44432e2
Move tests to dedicated file
MadLittleMods 6edc4c7
Allow for no `bump_stamp` (fix `portdb` CI job)
MadLittleMods 0726a6d
Derive best effort `stream_ordering` outside of the transaction
MadLittleMods 088a4c7
Use `simple_upsert_txn` to update `sliding_sync_joined_rooms`
MadLittleMods 4b866c4
Simplify what we need to think about to grab the best effort value
MadLittleMods fdb8b59
Correct comment
MadLittleMods 21cc97b
Use `simple_upsert_many_txn` for `sliding_sync_membership_snapshots`
MadLittleMods f8926d0
Fix partial-stated room re-syncing state but nothing has changed
MadLittleMods b6a7d2b
Use `simple_upsert_txn` for `sliding_sync_joined_rooms` in background…
MadLittleMods a57d47b
Use `simple_upsert_txn` for `sliding_sync_membership_snapshots` in ba…
MadLittleMods 9795556
Update comment
MadLittleMods addb914
Split test cases
MadLittleMods 8bddbe2
Clear out-of-date rows
MadLittleMods a94c1dd
Add more context for why
MadLittleMods 6a44686
Why it matters
MadLittleMods eb3c84c
Kick-off background update for out-of-date snapshots
MadLittleMods 53473a0
Adapt `sliding_sync_joined_rooms` background update to use `event_str…
MadLittleMods 7fe5d31
Note down caveat about `forgotten`
MadLittleMods 7a0c281
Add placeholder tests
MadLittleMods 9764f62
Fix query in Postgres
MadLittleMods c51a309
Maybe: always start background update
MadLittleMods 9a7d8c2
Start catch-up if nothing written yet
MadLittleMods 4dc9e26
Add test for catch-up background update
MadLittleMods c8e17f7
Add test when no rooms
MadLittleMods e5e7269
Add more tests
MadLittleMods 85a60c3
More tests
MadLittleMods 56a4c0b
Round out tests
MadLittleMods 9d08bc2
Remove debug logs
MadLittleMods a507f15
Use `stream_id` of some point before we fetch the current state
MadLittleMods 94e1a54
`get_events(...)` will omit events from unknown room versions
MadLittleMods 53b7309
Add `sliding_sync_joined_rooms_to_recalculate` table
MadLittleMods 8468401
Adapt to using `sliding_sync_joined_rooms_to_recalculate` table
MadLittleMods da463fb
Add unique index right away for `sliding_sync_joined_rooms_to_recalcu…
MadLittleMods 7c9c620
Remove all rooms pulled out from the queue
erikjohnston bb905cd
Only run the sliding sync background updates on the main database
erikjohnston 6f9932d
Handle old rows with null event_stream_ordering column
erikjohnston ab414f2
Use event_auth table to get previous membership
erikjohnston 90d0e03
Fix port script tests by handling empty DBs correctly
erikjohnston 6a164eb
Clarify why we return early
MadLittleMods 3f56efb
Note why it's there
MadLittleMods e12f95f
Update metric with how long it took with the index and upsert
MadLittleMods 116b833
Ignore membership where we don't have a row in `rooms` table
MadLittleMods de30d19
Fix-up `rooms` table for old out-of-band memberships
MadLittleMods 15ad7a7
Fill in placeholder issue
MadLittleMods 2f6ee08
Fix join condition not working in Postgres
MadLittleMods 6622a1c
Add `instance_name` to `sliding_sync_membership_snapshots`
MadLittleMods bcc3e50
Fully-insert `sliding_sync_joined_rooms` rows
MadLittleMods 95d5471
Merge branch 'develop' into madlittlemods/sliding-sync-pre-populate-r…
MadLittleMods b63188c
Explain more in schema
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.