From 6c2f8fac44ae9278619b3f594dcdad4fce71ce4e Mon Sep 17 00:00:00 2001 From: reivilibre Date: Thu, 19 May 2022 13:17:22 +0000 Subject: deploy: 66a5f6c40018018cccffd79aded0850d13efe513 --- develop/upgrade.html | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'develop/upgrade.html') diff --git a/develop/upgrade.html b/develop/upgrade.html index 0d9864a874..d25faa39d0 100644 --- a/develop/upgrade.html +++ b/develop/upgrade.html @@ -232,6 +232,69 @@ dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb +

Upgrading to v1.60.0

+

Adding a new unique index to state_group_edges could fail if your database is corrupted

+

This release of Synapse will add a unique index to the state_group_edges table, in order +to prevent accidentally introducing duplicate information (for example, because a database +backup was restored multiple times).

+

Duplicate rows being present in this table could cause drastic performance problems; see +issue 11779 for more details.

+

If your Synapse database already has had duplicate rows introduced into this table, +this could fail, with either of these errors:

+

On Postgres:

+
synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
+synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
+...
+psycopg2.errors.UniqueViolation: could not create unique index "state_group_edges_unique_idx"
+DETAIL:  Key (state_group, prev_state_group)=(2, 1) is duplicated.
+
+

(The numbers may be different.)

+

On SQLite:

+
synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
+synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
+...
+sqlite3.IntegrityError: UNIQUE constraint failed: state_group_edges.state_group, state_group_edges.prev_state_group
+
+
+Expand this section for steps to resolve this problem +

On Postgres

+

Connect to your database with psql.

+
BEGIN;
+DELETE FROM state_group_edges WHERE (ctid, state_group, prev_state_group) IN (
+  SELECT row_id, state_group, prev_state_group
+  FROM (
+    SELECT
+      ctid AS row_id,
+      MIN(ctid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
+      state_group,
+      prev_state_group
+    FROM state_group_edges
+  ) AS t1
+  WHERE row_id <> min_row_id
+);
+COMMIT;
+
+

On SQLite

+

At the command-line, use sqlite3 path/to/your-homeserver-database.db:

+
BEGIN;
+DELETE FROM state_group_edges WHERE (rowid, state_group, prev_state_group) IN (
+  SELECT row_id, state_group, prev_state_group
+  FROM (
+    SELECT
+      rowid AS row_id,
+      MIN(rowid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
+      state_group,
+      prev_state_group
+    FROM state_group_edges
+  )
+  WHERE row_id <> min_row_id
+);
+COMMIT;
+
+

For more details

+

This comment on issue 11779 +has queries that can be used to check a database for this problem in advance.

+

Upgrading to v1.59.0

Device name lookup over federation has been disabled by default

The names of user devices are no longer visible to users on other homeservers by default. -- cgit 1.5.1