-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Non lazy loading sync not blocking during fast join #14831
Conversation
39a0ddc
to
6b43520
Compare
abbfb9d
to
13ea6fa
Compare
Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
13ea6fa
to
3bad02f
Compare
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.
Seems reasonable. Do you have any complement tests for this? (i.e. how do we know this works?)
Yes, I've just opened a PR with Complement side of the changes. |
Co-authored-by: David Robertson <davidr@element.io>
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.
LGTM. Would be good to double-check #14831 (comment) if you get a chance though
Perhaps I have missed something, but when a room is un-partial stated while an incremental sync is waiting for updates, do we wake up the sync? |
also do we want / need to do anything for rooms that become un-partial stated after we leave them? |
Oh sorry I missed your comment. I think I came to the conclusion that it was handled generically by the stream code but I'll double check, and add a test for it indeed, thanks. |
@@ -1819,8 +1819,12 @@ async def _generate_sync_entry_for_rooms( | |||
|
|||
# Retrieve rooms that got un partial stated in the meantime, only useful in case | |||
# of a non lazy-loading-members sync. | |||
# We also skip calculating that in case of initial sync since we don't need it. |
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.
I'm not following you here. I thought we want to exclude partially-joined rooms from all non-lazy load syncs. Why should that not also apply to an initial, non-lazy sync?
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 skip calculating the rooms that got unpartialstated because in case of initial, we have another piece of code that already exclude any partial stated rooms. The stream of unpartialstated rooms is only useful to know which ones have been unpartialed between 2 syncs, for an initial sync we just directly check the DB.
I have a test, and I was wrong, it doesn't work :/ I am trying to fix it right now.
I'll put some thoughts into that after fixing the notifying behavior. |
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.
I'm not seeing where we exclude things for partially joined rooms during incremental, non-lazy syncs. C.f. matrix-org/complement#584 (review)
I'm finding this tricky to follow in general. It might be worth pairing tomorrow to try and chop this up into some smaller pieces, if you're up for that
# Retrieve rooms that got un partial stated in the meantime, only useful in case | ||
# of a non lazy-loading-members sync. | ||
# We also skip calculating that in case of initial sync since we don't need it. |
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.
Comment: For nonlazy, incremental syncs: find all the rooms we excluded in previous nonlazy syncs that we can now disclose to the user.
have_changed = await self._have_rooms_changed( | ||
sync_result_builder, un_partial_stated_rooms | ||
) |
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.
Every un-psed room during the sync period is considered to have "changed", i.e., client needs to be informed.
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.
Rooms which are partial stated need to not sure up in a non-lazy sync. Where is this done? Should this be here?
EJ: this method is better called "should_we_tell_the_client_about_this_room_lol"
entry = RoomSyncResultBuilder( | ||
room_id=room_id, | ||
rtype="joined", | ||
events=None, |
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.
EJ: are we going to lose events from room_events
? Maybe... but we should treat this like a newly_joined room (it is from the client's perspective) so I think this is fine
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.
EJ: Does newly_joined_rooms need to be updated to include un-partial-stated rooms and exclude those which are currently partial stated? See the return value of this function
# Do not include rooms that we don't have the full state yet | ||
# in case of non lazy-loading-members sync. | ||
if ( | ||
not sync_config.filter_collection.lazy_load_members() | ||
) and await self.store.is_partial_state_room(event.room_id): | ||
continue | ||
|
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.
In an initial sync, we completely ignore rooms that are currently partially stated
synapse/handlers/sync.py
Outdated
since_token | ||
and not sync_result_builder.sync_config.filter_collection.lazy_load_members() | ||
): | ||
un_partial_stated_rooms_since = 0 | ||
if sync_result_builder.since_token is not None: | ||
un_partial_stated_rooms_since = ( |
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.
Because we're checking since_token on +1825, we always hit +1830. So 1828 and 1829 are redundant.
Proper wake up of the long polling syncs has been added, and a matching test has been added to complement. |
@squahtx Putting aside the fact that we can't leave during partial state yet... (oh, I guess you could be kicked)... We think this should be okay.
Worth a complement test though. I'll add it as a todo on the leave-during-resync issue. |
Superseded by #14870 |
Fix #12989.
DMR built on this in #14870
Pull Request Checklist
(run the linters)