Add a background task to purge unused chain IDs. (#9542)

This is a companion change to apply the fix in #9498 /
922788c604 to previously
purged rooms.
This commit is contained in:
Patrick Cloke 2021-03-09 11:22:25 -05:00 committed by GitHub
parent e9df3f496b
commit dc51d8ffaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 6 deletions

View file

@ -331,13 +331,9 @@ class PurgeEventsStore(StateGroupWorkerStore, SQLBaseStore):
txn.executemany(
"""
DELETE FROM event_auth_chain_links WHERE
(origin_chain_id = ? AND origin_sequence_number = ?) OR
(target_chain_id = ? AND target_sequence_number = ?)
origin_chain_id = ? AND origin_sequence_number = ?
""",
(
(chain_id, seq_num, chain_id, seq_num)
for (chain_id, seq_num) in referenced_chain_id_tuples
),
referenced_chain_id_tuples,
)
# Now we delete tables which lack an index on room_id but have one on event_id