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

Upsert redactions in case they already exists #10343

Merged
merged 2 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10343.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix errors during backfill caused by previously purged redaction events. Contributed by Andreas Rammhold (@andir).
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,11 +1580,11 @@ def _store_redaction(self, txn, event):
# invalidate the cache for the redacted event
txn.call_after(self.store._invalidate_get_event_cache, event.redacts)

self.db_pool.simple_insert_txn(
self.db_pool.simple_upsert_txn(
txn,
table="redactions",
keyvalues={"event_id": event.event_id},
values={
"event_id": event.event_id,
"redacts": event.redacts,
"received_ts": self._clock.time_msec(),
},
Expand Down
1 change: 1 addition & 0 deletions synapse/storage/databases/main/purge_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def _purge_history_txn(
"event_relations",
"event_search",
"rejections",
"redactions",
):
logger.info("[purge] removing events from %s", table)

Expand Down