Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 97ef147

Browse files
authored
Wait for current_state_events_membership before populate_stats_process_rooms (#7387)
populate_stats_process_rooms was added in #5971 / v1.4.0; current_state_events_membership was added in #5706 / v1.3.0. Fixes #7380.
1 parent 0e719f2 commit 97ef147

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

UPGRADE.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,37 @@ for example:
7575
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
7676
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
7777
78+
Upgrading to v1.13.0
79+
====================
80+
81+
Incorrect database migration in old synapse versions
82+
----------------------------------------------------
83+
84+
A bug was introduced in Synapse 1.4.0 which could cause the room directory to
85+
be incomplete or empty if Synapse was upgraded directly from v1.2.1 or earlier,
86+
to versions between v1.4.0 and v1.12.x.
87+
88+
This will *not* be a problem for Synapse installations which were:
89+
* created at v1.4.0 or later,
90+
* upgraded via v1.3.x, or
91+
* upgraded straight from v1.2.1 or earlier to v1.13.0 or later.
92+
93+
If completeness of the room directory is a concern, installations which are
94+
affected can be repaired as follows:
95+
96+
1. Run the following sql from a `psql` or `sqlite3` console:
97+
98+
.. code:: sql
99+
100+
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
101+
('populate_stats_process_rooms', '{}', 'current_state_events_membership');
102+
103+
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
104+
('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
105+
106+
2. Restart synapse.
107+
108+
78109
Upgrading to v1.12.0
79110
====================
80111

changelog.d/7387.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug which would cause the room durectory to be incorrectly populated if Synapse was upgraded directly from v1.2.1 or earlier to v1.4.0 or later. Note that this fix does not apply retrospectively; see the [upgrade notes](UPGRADE.rst#upgrading-to-v1130) for more information.

synapse/storage/data_stores/main/schema/delta/56/stats_separated.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ DELETE FROM background_updates WHERE update_name IN (
3535
'populate_stats_cleanup'
3636
);
3737

38+
-- this relies on current_state_events.membership having been populated, so add
39+
-- a dependency on current_state_events_membership.
3840
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
39-
('populate_stats_process_rooms', '{}', '');
41+
('populate_stats_process_rooms', '{}', 'current_state_events_membership');
4042

43+
-- this also relies on current_state_events.membership having been populated, but
44+
-- we get that as a side-effect of depending on populate_stats_process_rooms.
4145
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
4246
('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
4347

0 commit comments

Comments
 (0)