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: Reset forgotten status when membership changes (like rejoining a room) #17835

Merged
merged 12 commits into from
Oct 22, 2024

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Oct 15, 2024

Reset sliding_sync_membership_snapshots -> forgotten status when membership changes (like rejoining a room).

Fix #17781

What was the problem before?

Previously, if someone used /forget on one of their rooms, it would update sliding_sync_membership_snapshots as expected but when someone rejoined the room (or had any membership change), the upsert didn't overwrite and reset the forgotten status so it remained forgotten and invisible down the Sliding Sync endpoint.

(downside of having two sources of truth)

Todo

  • Add background update to fix existing databases that have been running with this flaw

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. 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.
  • Code style is correct
    (run the linters)

Comment on lines +2949 to +2952
# XXX: Is this how we actually want it to behave? It seems like ideally, the
# room forgotten status should only be reset when the user decides to join again
# (or is invited/knocks). This way the room remains forgotten for any ban/leave
# transitions.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a future task in any case but thought this current behavior is a bit weird.

@MadLittleMods MadLittleMods marked this pull request as ready for review October 15, 2024 22:31
@MadLittleMods MadLittleMods requested a review from a team as a code owner October 15, 2024 22:31
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Looks good, I think we can simplify the BG update a bit though.

synapse/storage/databases/main/events_bg_updates.py Outdated Show resolved Hide resolved
@@ -19,7 +19,7 @@
#
#

SCHEMA_VERSION = 88 # remember to update the list below when updating
SCHEMA_VERSION = 89 # remember to update the list below when updating
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to bump the schema version. We only need to do so if we want to rely on schema delta having happened.

Copy link
Contributor Author

@MadLittleMods MadLittleMods Oct 16, 2024

Choose a reason for hiding this comment

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

Reverted. I assume we will want to describe the changes when we do bump it eventaully so I've left the description in Changes in SCHEMA_VERSION = 89 below

synapse/storage/databases/main/events_bg_updates.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/events_bg_updates.py Outdated Show resolved Hide resolved
synapse/storage/schema/__init__.py Outdated Show resolved Hide resolved
@erikjohnston erikjohnston merged commit a5e16a4 into develop Oct 22, 2024
39 checks passed
@erikjohnston erikjohnston deleted the madlittlemods/17781-sliding-sync-fix-forgotten branch October 22, 2024 10:06
@MadLittleMods
Copy link
Contributor Author

Thanks for the review and merge @erikjohnston 🦙

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.

Some rooms do not get sent down via sliding sync; rooms impacted differ per account
2 participants