summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-02-17 11:30:50 +0000
committerGitHub <noreply@github.com>2020-02-17 11:30:50 +0000
commit46fa66bbfd367b2c1fbdf585107cec75fa1bb193 (patch)
treec92baa43fbb6a43cbab177d7905371933c381606
parentAdd type hints to the spam check module (#6915) (diff)
downloadsynapse-46fa66bbfd367b2c1fbdf585107cec75fa1bb193.tar.xz
wait for current_state_events_membership before delete_old_current_state_events (#6924)
-rw-r--r--changelog.d/6924.bugfix1
-rw-r--r--synapse/storage/data_stores/main/schema/delta/57/delete_old_current_state_events.sql7
2 files changed, 6 insertions, 2 deletions
diff --git a/changelog.d/6924.bugfix b/changelog.d/6924.bugfix
new file mode 100644
index 0000000000..33e6611929
--- /dev/null
+++ b/changelog.d/6924.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.10.0 which would cause room state to be cleared in the database if Synapse was upgraded direct from 1.2.1 or earlier to 1.10.0.
diff --git a/synapse/storage/data_stores/main/schema/delta/57/delete_old_current_state_events.sql b/synapse/storage/data_stores/main/schema/delta/57/delete_old_current_state_events.sql
index a133d87a19..aec06c8261 100644
--- a/synapse/storage/data_stores/main/schema/delta/57/delete_old_current_state_events.sql
+++ b/synapse/storage/data_stores/main/schema/delta/57/delete_old_current_state_events.sql
@@ -15,5 +15,8 @@
 
 -- Add background update to go and delete current state events for rooms the
 -- server is no longer in.
-INSERT into background_updates (update_name, progress_json)
-    VALUES ('delete_old_current_state_events', '{}');
+--
+-- this relies on the 'membership' column of current_state_events, so make sure
+-- that's populated first!
+INSERT into background_updates (update_name, progress_json, depends_on)
+    VALUES ('delete_old_current_state_events', '{}', 'current_state_events_membership');