summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-02-14 15:44:51 +0000
committerRichard van der Hoff <richard@matrix.org>2018-02-14 15:44:51 +0000
commit278d21b5e498e301a43a217595ce75ed7729256f (patch)
tree57eb4f14c770b39a6f22854c8a7e571b05aebc32 /synapse/storage/events.py
parentRework event purge to use a temporary table (diff)
downloadsynapse-278d21b5e498e301a43a217595ce75ed7729256f.tar.xz
purge_history: fix index use
event_push_actions doesn't have an index on event_id, so we need to specify
room_id.
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py

index 5a2e6a03d5..c81bc75eae 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py
@@ -2314,6 +2314,20 @@ class EventsStore(SQLBaseStore): ")" % (table,), ) + # event_push_actions lacks an index on event_id, and has one on + # (room_id, event_id) instead. + for table in ( + "event_push_actions", + ): + logger.info("[purge] removing events from %s", table) + + txn.execute( + "DELETE FROM %s WHERE room_id = ? AND event_id IN (" + " SELECT event_id FROM events_to_purge WHERE should_delete" + ")" % (table,), + (room_id, ) + ) + # Mark all state and own events as outliers logger.info("[purge] marking remaining events as outliers") txn.execute(