-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
purge_history_api.rst: add example script #1034
Conversation
Can one of the admins verify this patch? |
4 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
# $ synctl start | ||
|
||
# This could be set, so you don't need to prune every time after deleting some rows: | ||
# $ sqlite3 homeserver.db "PRAGMA auto_vacuum = FULL;" |
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.
It seems like auto_vacuum = FULL
does not have any effect?
I fixed the database is locked problem with a pragma busy timeout, so this can be merged now |
Would be nice if this supported Postgres too, but you should probably recommend stopping synapse before running the query against the sqlite3 DB, because multiple writers to an sqlite3 DB is a recipe for corruption. |
I thought the busy_timeout will sort this out further? |
This was helpful, thanks! BTW the pragma busy timeout adds an additional line of output to BUFFER which prevents awk from properly selecting the event ID. |
@rryan do you mean we have to change something more? or do you just explain, why I used this?
|
FYI #1621 |
The API has changed now, so I'm afraid this is out of date. |
@richvdh: the changes are not relevant to my script |
I added hints how to solve this in Postgres too. And I added the command to really delete local events and messages, which is what users want to achieve mostly i think. |
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.
This PR is missing a changelog (that's why the build fails) https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst#changelog
…pi.rst Signed-off-by: Ruben Barkow <[email protected]>
changelog added and commits squashed. |
You could easily adapt the script to delete all rooms with a loop like
with a more sophisticated select command you can select only the rooms that are not encrypted already:
|
But I suggest to only purge old history in rooms with many users, for example more than 10 users:
instead of purging before a certain ageI think better it is to only purge messages in rooms that are more than 1000 messages ago, so you keep old conversations, that someone might still be interested in. I think this would be the select for the right event to start the purge upon:
|
sorry, I don't think we're going to be able to accept a script of this complexity into the official documentation; we won't have the resources to maintain it. We could consider putting something into |
I created a new PR in #4155 that adds the script to |
In this pull request I add an example Script To The Purge API Readme, that automatically purchase all data older than certain time with the option to really delete the data on your home server.
Signed-off-by: Ruben Barkow [email protected]