diff options
author | Erik Johnston <erik@matrix.org> | 2020-01-28 13:44:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-28 13:44:21 +0000 |
commit | 02b44db922f01a35787d2535a834c9774b68020b (patch) | |
tree | 0633655539933d9d054f7f0e774b66e6e2ec00f0 /docs/postgres.md | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-02b44db922f01a35787d2535a834c9774b68020b.tar.xz |
Warn if postgres database has non-C locale. (#6734)
As using non-C locale can cause issues on upgrading OS.
Diffstat (limited to 'docs/postgres.md')
-rw-r--r-- | docs/postgres.md | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/postgres.md b/docs/postgres.md index 7cb1ad18d4..e0793ecee8 100644 --- a/docs/postgres.md +++ b/docs/postgres.md @@ -32,7 +32,7 @@ Assuming your PostgreSQL database user is called `postgres`, first authenticate su - postgres # Or, if your system uses sudo to get administrative rights sudo -u postgres bash - + Then, create a user ``synapse_user`` with: createuser --pwprompt synapse_user @@ -63,6 +63,24 @@ You may need to enable password authentication so `synapse_user` can connect to the database. See <https://www.postgresql.org/docs/11/auth-pg-hba-conf.html>. +### Fixing incorrect `COLLATE` or `CTYPE` + +Synapse will refuse to set up a new database if it has the wrong values of +`COLLATE` and `CTYPE` set, and will log warnings on existing databases. Using +different locales can cause issues if the locale library is updated from +underneath the database, or if a different version of the locale is used on any +replicas. + +The safest way to fix the issue is to take a dump and recreate the database with +the correct `COLLATE` and `CTYPE` parameters (as per +[docs/postgres.md](docs/postgres.md)). It is also possible to change the +parameters on a live database and run a `REINDEX` on the entire database, +however extreme care must be taken to avoid database corruption. + +Note that the above may fail with an error about duplicate rows if corruption +has already occurred, and such duplicate rows will need to be manually removed. + + ## Tuning Postgres The default settings should be fine for most deployments. For larger |