summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-10-30 16:58:22 +0000
committerGitHub <noreply@github.com>2018-10-30 16:58:22 +0000
commit0794504bce8cc7629d992c5be1b377d634422ac3 (patch)
tree269db505b1a3dcdb7dac90b0c8817c16df137462 /synapse/storage/state.py
parentWrite some tests for the email pusher (#4095) (diff)
parentMove _find_unreferenced_groups (diff)
downloadsynapse-0794504bce8cc7629d992c5be1b377d634422ac3.tar.xz
Merge pull request #4006 from matrix-org/erikj/purge_state_groups
 Delete unreferenced state groups during purge
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index ef65929bb2..d737bd6778 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -1257,6 +1257,7 @@ class StateStore(StateGroupWorkerStore, BackgroundUpdateStore):
     STATE_GROUP_DEDUPLICATION_UPDATE_NAME = "state_group_state_deduplication"
     STATE_GROUP_INDEX_UPDATE_NAME = "state_group_state_type_index"
     CURRENT_STATE_INDEX_UPDATE_NAME = "current_state_members_idx"
+    EVENT_STATE_GROUP_INDEX_UPDATE_NAME = "event_to_state_groups_sg_index"
 
     def __init__(self, db_conn, hs):
         super(StateStore, self).__init__(db_conn, hs)
@@ -1275,6 +1276,12 @@ class StateStore(StateGroupWorkerStore, BackgroundUpdateStore):
             columns=["state_key"],
             where_clause="type='m.room.member'",
         )
+        self.register_background_index_update(
+            self.EVENT_STATE_GROUP_INDEX_UPDATE_NAME,
+            index_name="event_to_state_groups_sg_index",
+            table="event_to_state_groups",
+            columns=["state_group"],
+        )
 
     def _store_event_state_mappings_txn(self, txn, events_and_contexts):
         state_groups = {}