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

Fix deduplicating of membership events to not create unused state groups. #17164

Merged
merged 6 commits into from
May 30, 2024

Conversation

erikjohnston
Copy link
Member

We try and deduplicate in two places: 1) really early on, and 2) just before we persist the event. The first case was broken due to it occuring before the profile information was added, and so it thought the event contents were different.

The second case did catch it and handle it correctly, however doing so creates a redundant state group leading to bloat.

Fixes #3791

We try and deduplicate in two places: 1) really early on, and 2) just
before we persist the event. The first case was broken due to it
occuring before the profile information was added, and so it thought the
event contents were different.

The second case did catch it and handle it correctly, however doing so
creates a redundant state group leading to bloat.
@erikjohnston erikjohnston marked this pull request as ready for review May 7, 2024 14:56
@erikjohnston erikjohnston requested a review from a team as a code owner May 7, 2024 14:56
Copy link
Member

@devonh devonh left a comment

Choose a reason for hiding this comment

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

This fix looks good to me & makes sense as to why it fixes the issue.
I would feel more comfortable if someone more familiar with this section of code also takes a look before this PR is approved.

tests/handlers/test_room_member.py Outdated Show resolved Hide resolved
synapse/handlers/message.py Show resolved Hide resolved
@devonh
Copy link
Member

devonh commented May 14, 2024

This line in the create_event function doc is now out of date:

Adds display names to Join membership events.

@erikjohnston erikjohnston requested a review from a team May 15, 2024 11:44
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

A couple nits, but otherwise LGTM!

@@ -106,6 +106,13 @@ def __init__(self, hs: "HomeServer"):
self.event_auth_handler = hs.get_event_auth_handler()
self._worker_lock_handler = hs.get_worker_locks_handler()

self.membership_types_to_include_profile_data_in = {
Copy link
Member

Choose a reason for hiding this comment

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

nit: self.membership_types_to_include_profile_data_in should have a leading underscore.

tests/handlers/test_room_member.py Outdated Show resolved Hide resolved
erikjohnston and others added 2 commits May 30, 2024 11:28
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
@erikjohnston erikjohnston enabled auto-merge (squash) May 30, 2024 10:30
@erikjohnston erikjohnston merged commit 4e3868d into develop May 30, 2024
38 checks passed
@erikjohnston erikjohnston deleted the erikj/properly_deduplicate branch May 30, 2024 11:33
H-Shay pushed a commit to H-Shay/hq_synapse that referenced this pull request May 31, 2024
…ups. (element-hq#17164)

We try and deduplicate in two places: 1) really early on, and 2) just
before we persist the event. The first case was broken due to it
occuring before the profile information was added, and so it thought the
event contents were different.

The second case did catch it and handle it correctly, however doing so
creates a redundant state group leading to bloat.

Fixes element-hq#3791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

we create redundant state groups when we get a no-op membership update
3 participants