-
Notifications
You must be signed in to change notification settings - Fork 429
Pass leave from remote invite rejection down Sliding Sync #18375
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
Conversation
MadLittleMods
left a comment
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.
Note: I haven't reviewed the logic of get_sliding_sync_membership_changes
| ] | ||
|
|
||
| @trace | ||
| async def get_sliding_sync_membership_changes( |
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.
Since this uses the sliding_sync_membership_snapshots table, we have to gate it behind self.store.have_finished_sliding_sync_background_jobs().
It looks like we're using it in the fallback case as well right now:
- ✅
_compute_interested_rooms_new_tables->_get_newly_joined_and_left_rooms->get_sliding_sync_membership_changes - ❌
_compute_interested_rooms_fallback->get_room_membership_for_user_at_to_token->_get_newly_joined_and_left_rooms->get_sliding_sync_membership_changes
As one solution, per the comment in the following code, we could also just make this foreground update now as those tables originally shipped with Synapse 1.115.0rc1 (2024-09-10) (see #17512) and remove the fallback path.
synapse/synapse/handlers/sliding_sync/room_lists.py
Lines 206 to 223 in d59bbd8
| if await self.store.have_finished_sliding_sync_background_jobs(): | |
| return await self._compute_interested_rooms_new_tables( | |
| sync_config=sync_config, | |
| previous_connection_state=previous_connection_state, | |
| to_token=to_token, | |
| from_token=from_token, | |
| ) | |
| else: | |
| # FIXME: This can be removed once we bump `SCHEMA_COMPAT_VERSION` and run the | |
| # foreground update for | |
| # `sliding_sync_joined_rooms`/`sliding_sync_membership_snapshots` (tracked by | |
| # https://github.com/element-hq/synapse/issues/17623) | |
| return await self._compute_interested_rooms_fallback( | |
| sync_config=sync_config, | |
| previous_connection_state=previous_connection_state, | |
| to_token=to_token, | |
| from_token=from_token, | |
| ) |
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.
Hmm, after looking into it a bit, that seems like a large undertaking that would block this fix unnecessarily.
Mainly - what would we do about populating the sliding_sync_joined_rooms_to_recalculate table in a foreground update and converting the 2 background jobs over to a foreground update is quite involved as they are pretty complex.
I think it may be better to split the impl & keep the old logic for the fallback case.
That means the fallback case would still have the bug, but realistically, who is still operating in the fallback case zone at this point?
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 changed it to do just that for now.
It uses the old way while using the fallback case, which means the bug is still present.
But uses the new way when using the new tables.
If we aren't happy with this and want to wait until we have completed the DB transition for sliding sync then that PR will need to be created & merged before we can merge this one.
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 think it may be better to split the impl & keep the old logic for the fallback case.
That means the fallback case would still have the bug, but realistically, who is still operating in the fallback case zone at this point?
Sounds reasonable to me.
We may want to consider refactoring GetRoomMembershipForUserAtToTokenTestCase/GetRoomMembershipForUserAtToTokenShardTestCase to work against compute_interested_rooms(...) (instead of get_room_membership_for_user_at_to_token(...) which only applies to the fallback path) so we have some better coverage of this logic. If you're feeling up for it, I think it could be useful to be more confident in these changes otherwise we can just add a future FIXME in both of those docstrings that we should tackle it in the future:
FIXME: We should refactor these tests to run against `compute_interested_rooms(...)`
instead of just `get_room_membership_for_user_at_to_token(...)` which is only used
in the fallback path (`_compute_interested_rooms_fallback(...)`). These scenarios do
well to stress that logic and we shouldn't remove them just because we're removing
the fallback path (tracked by https://github.com/element-hq/synapse/issues/17623).
We do still have a good set of end-to-end rest layer tests to cover us in a lot of scenarios.
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 agree with the idea.
I started down that path but it looks like it'll be quite involved to do properly.
It should happen in a future PR that exclusively converts the tests over to handle the new code.
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 entirely comfortable merging these changes until those tests have been converted so we can ensure everything is still working as intended.
It'll take me quite a while to convert the tests due to a lack of simplified sliding sync knowledge. It's not too hard to technically change them over. But deciding what is okay to change requires intimate knowledge of the spec.
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.
Hmm. So after converting that test, 12 of the tests fail when using the new tables (they pass when using the fallback tables).
But those same 12 tests also fail against the develop branch, so I don't think the changes here are making things any worse.
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.
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.
The tests have now been updated & #18399 has been merged. Let's see if these changes are still happy.
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
| ] | ||
|
|
||
| @trace | ||
| async def get_sliding_sync_membership_changes( |
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 think it may be better to split the impl & keep the old logic for the fallback case.
That means the fallback case would still have the bug, but realistically, who is still operating in the fallback case zone at this point?
Sounds reasonable to me.
We may want to consider refactoring GetRoomMembershipForUserAtToTokenTestCase/GetRoomMembershipForUserAtToTokenShardTestCase to work against compute_interested_rooms(...) (instead of get_room_membership_for_user_at_to_token(...) which only applies to the fallback path) so we have some better coverage of this logic. If you're feeling up for it, I think it could be useful to be more confident in these changes otherwise we can just add a future FIXME in both of those docstrings that we should tackle it in the future:
FIXME: We should refactor these tests to run against `compute_interested_rooms(...)`
instead of just `get_room_membership_for_user_at_to_token(...)` which is only used
in the fallback path (`_compute_interested_rooms_fallback(...)`). These scenarios do
well to stress that logic and we shouldn't remove them just because we're removing
the fallback path (tracked by https://github.com/element-hq/synapse/issues/17623).
We do still have a good set of end-to-end rest layer tests to cover us in a lot of scenarios.
…oms` (#18399) Spawning from #18375 (comment), This updates some sliding sync tests to use a higher level function in order to move test coverage to cover both fallback & new tables. Important when #18375 is merged. In other words, adjust tests to target `compute_interested_room(...)` (relevant to both new and fallback path) instead of the lower level `get_room_membership_for_user_at_to_token(...)` that only applies to the fallback path. ### Dev notes ``` SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync.ComputeInterestedRoomsTestCase_new ``` ``` SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.rest.client.sliding_sync ``` ``` SYNAPSE_POSTGRES=1 SYNAPSE_POSTGRES_USER=postgres SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync.ComputeInterestedRoomsTestCase_new.test_display_name_changes_leave_after_token_range ``` ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Eric Eastwood <[email protected]>
…oms` (element-hq#18399) Spawning from element-hq#18375 (comment), This updates some sliding sync tests to use a higher level function in order to move test coverage to cover both fallback & new tables. Important when element-hq#18375 is merged. In other words, adjust tests to target `compute_interested_room(...)` (relevant to both new and fallback path) instead of the lower level `get_room_membership_for_user_at_to_token(...)` that only applies to the fallback path. ### Dev notes ``` SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync.ComputeInterestedRoomsTestCase_new ``` ``` SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.rest.client.sliding_sync ``` ``` SYNAPSE_POSTGRES=1 SYNAPSE_POSTGRES_USER=postgres SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync.ComputeInterestedRoomsTestCase_new.test_display_name_changes_leave_after_token_range ``` ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Eric Eastwood <[email protected]>
|
FTR we should not be doing index creation or deletion in a delta file, and instead use the background updates helpers to do so. Otherwise we block start up, and if you forget |
Follow on from #18375. This prevents blocking startup on creating the index, which can take a while --------- Co-authored-by: Devon Hudson <[email protected]>
Fixes #17753
Dev notes
The
sliding_sync_membership_snapshotsandsliding_sync_joined_roomsdatabase tables were added in #17512Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.(run the linters)