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

Consider purging redundant data when the proxy leaves a room #270

Open
DMRobertson opened this issue Aug 23, 2023 · 0 comments
Open

Consider purging redundant data when the proxy leaves a room #270

DMRobertson opened this issue Aug 23, 2023 · 0 comments

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented Aug 23, 2023

Suppose Alice is in a room. The proxy keeps a copy of messages in that room and state in that room.

The messages do not need to be kept forever because clients use /messages to backfill, not /sync (beyond a brief "give me an initial timeline" of ~20 messages). The state needs to be kept for longer. Neither are needed when none of the proxy's users are joined to the room.

Nothing will go wrong if we hold on to that state. But it means the next time someone joins the room we'll hit the "gappy state" logic, which can have performance problems (see #211 et al). The "full" solution to 211 (regularly creating fresh snapshots) would avoid this, but it may be simpler to just deleting the room from the snapshots table. This would mean we create a fresh snapshot the next time we see the room.

A more nuclear approach would involve deleting all record of the room as a whole from the database. I think the tables involved are:

  • events
  • rooms
  • snapshots
  • receipts and receipts_private
  • txns?
  • spaces?
  • invites

If we did any of this, we'd have to ensure the delete doesn't race with another concurrent join. We'd also have to keep in-memory caches up-to-date somehow.

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

No branches or pull requests

1 participant