瀏覽代碼

Use C collation for Postgres to appease Synapse

pull/352/head
Slavi Pantaleev 6 年之前
父節點
當前提交
9d3d538a2d
共有 3 個檔案被更改,包括 27 行新增2 行删除
  1. +17
    -0
      CHANGELOG.md
  2. +6
    -1
      roles/matrix-postgres/tasks/upgrade_postgres.yml
  3. +4
    -1
      roles/matrix-postgres/templates/env-postgres-server.j2

+ 17
- 0
CHANGELOG.md 查看文件

@@ -1,3 +1,20 @@
# 2020-01-21

## Postgres collation changes (action required!)

By default, we've been using a UTF-8 collation for Postgres. This is known to cause Synapse some troubles (see the [relevant issue](https://github.com/matrix-org/synapse/issues/6722)) on systems that use [glibc](https://www.gnu.org/software/libc/). We run Postgres in an [Alpine Linux](https://alpinelinux.org/) container (which uses [musl](https://www.musl-libc.org/), and not glibc), so our users are likely not affected by the index corruption problem observed by others.

Still, we might become affected in the future. In any case, it's imminent that Synapse will complain about databases which do not use a C collation.

To avoid future problems, we recommend that you run the following command:

```
ansible-playbook -i inventory/hosts setup.yml --tags=upgrade-postgres --extra-vars='{"postgres_force_upgrade": true}'
```

It forces a [Postgres database upgrade](docs/maintenance-postgres.md#upgrading-postgresql), which would recreate your Postgres database using the proper (`C`) collation. If you are low on disk space, or run into trouble, refer to the Postgres database upgrade documentation page.


# 2020-01-14

## Added support for Appservice Webhooks


+ 6
- 1
roles/matrix-postgres/tasks/upgrade_postgres.yml 查看文件

@@ -20,6 +20,11 @@
postgres_start_wait_time: 15
when: "postgres_start_wait_time|default('') == ''"

- name: Set postgres_force_upgrade, if not provided
set_fact:
postgres_force_upgrade: false
when: "postgres_force_upgrade|default('') == ''"

- name: Fail, if trying to upgrade external Postgres database
fail:
msg: "Your configuration indicates that you're not using Postgres from this role. There is nothing to upgrade."
@@ -45,7 +50,7 @@
- name: Abort, if already at latest Postgres version
fail:
msg: "You are already running the latest Postgres version supported ({{ matrix_postgres_docker_image_latest }}). Nothing to do"
when: "matrix_postgres_detected_version_corresponding_docker_image == matrix_postgres_docker_image_latest"
when: "matrix_postgres_detected_version_corresponding_docker_image == matrix_postgres_docker_image_latest and not postgres_force_upgrade"

- debug:
msg: "Upgrading database from {{ matrix_postgres_detected_version_corresponding_docker_image }} to {{ matrix_postgres_docker_image_latest }}"


+ 4
- 1
roles/matrix-postgres/templates/env-postgres-server.j2 查看文件

@@ -1,4 +1,7 @@
#jinja2: lstrip_blocks: "True"
POSTGRES_USER={{ matrix_postgres_connection_username }}
POSTGRES_PASSWORD={{ matrix_postgres_connection_password }}
POSTGRES_DB={{ matrix_postgres_db_name }}
POSTGRES_DB={{ matrix_postgres_db_name }}
# Synapse refuses to run if collation is not C.
# See https://github.com/matrix-org/synapse/issues/6722
POSTGRES_INITDB_ARGS=--lc-collate C --lc-ctype C --encoding UTF8

Loading…
取消
儲存