Synapse: garbage collect forgotten rooms

Created on 23 Feb 2019  路  8Comments  路  Source: matrix-org/synapse

if everyone on a server has left and forgotten a given room, we should GC it from the DB

enhancement help wanted p2

Most helpful comment

Alternatively, it could simply purge immediately, within the "last member left" operation. For me, waiting a few days doesn't add any value.

All 8 comments

I'm surprised we don't already have this, but I can't find it if we do.

Related:

This should probably get a Mozilla label https://bugzilla.mozilla.org/show_bug.cgi?id=1622403

This seems like no-brainer to me. I just deleted gigabytes of data from my postgres DB just by manually removing abandoned rooms.

Do you have a (relatively) safe script to do that @schildbach ?

@peterhoeg you can get a list of rooms and remove them via the admin api: https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/rooms.md

Directly modifying the database is error prone and should not be done.

Also synapse admin ui can let you click around instead of writing code for the API: https://github.com/Awesome-Technologies/synapse-admin

@peterhoeg I used the instructions provided here. Yes, it uses the admin API for write operations. Still, I think synapse could automatically purge a room if the last local user left it.

I suspect to have this done automatically we would want to:

  1. Add a background update that searches for rooms with 0 joined members.
  2. Iterates over them and calls purge.

There's a couple of tricky pieces here:

  1. Do we care how long ago this had no members in it? (Do you want to immediately purge the room or wait a few days?)
  2. Some logic to ensure only a single background update is running at once, as purging can take a while.

Alternatively, it could simply purge immediately, within the "last member left" operation. For me, waiting a few days doesn't add any value.

Was this page helpful?
0 / 5 - 0 ratings