mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-07-14 18:52:50 +03:00
Document Synapse database restore pitfalls per the official backup guide
Add the two remaining hints from the official Synapse backup guide: - never import a dump into a database that already has tables present (at best it errors, at worst it causes subtle inconsistencies) - when restoring a backup older than the server's current state, truncate e2e_one_time_keys_json before starting Synapse, so used one-time keys are not re-issued (which causes decryption errors); our pg_dumpall-based backup commands include that table Fixes #4004 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,11 @@ The migration might be a good moment, to "reset" a not properly working bridge.
|
||||
|
||||
Before doing the actual import, **you need to upload your Postgres dump file to the server** (any path is okay).
|
||||
|
||||
> [!WARNING]
|
||||
> Do not import into a database that already contains tables (e.g. one that a service has already initialized and used). As the [official Synapse backup guide](https://element-hq.github.io/synapse/latest/usage/administration/backups.html) puts it: at best this will error, at worst it will lead to subtle database inconsistencies. Import into an empty (freshly created) database instead.
|
||||
|
||||
**Note for Synapse users restoring an older backup**: if the server kept running (and users kept chatting) after the backup you are restoring was made, truncate the `e2e_one_time_keys_json` table after importing and before starting Synapse. Restoring an older backup can otherwise cause already-used one-time keys to be re-issued, leading to message decryption errors for your users. You can do this by [getting a database terminal](maintenance-postgres.md#getting-a-database-terminal), connecting to the Synapse database (`\c synapse`) and running `TRUNCATE e2e_one_time_keys_json;`. Clients will generate and upload fresh one-time keys automatically.
|
||||
|
||||
## Importing
|
||||
|
||||
To import, run this command (make sure to replace `SERVER_PATH_TO_POSTGRES_DUMP_FILE` with a file path on your server):
|
||||
|
||||
@@ -76,6 +76,8 @@ If you are using an [external Postgres server](configuring-playbook-external-pos
|
||||
|
||||
Restoring a backup made this way can be done by [importing it](importing-postgres.md).
|
||||
|
||||
**Note for Synapse users**: the [official Synapse backup guide](https://element-hq.github.io/synapse/latest/usage/administration/backups.html) recommends that the `e2e_one_time_keys_json` table either not be backed up, or be truncated after restoring (before Synapse is started). The full-server dump command above does include it, so if you ever restore a backup that is older than the server's current state, remember to truncate that table as described in [the importing guide](importing-postgres.md).
|
||||
|
||||
## Upgrading PostgreSQL
|
||||
|
||||
Unless you are using an [external Postgres server](configuring-playbook-external-postgres.md), this playbook initially installs Postgres for you.
|
||||
|
||||
Reference in New Issue
Block a user