From 27598fe0026ad96d79d5ebab93f112223960a4f9 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Tue, 17 May 2022 17:57:52 +0200 Subject: [PATCH 1/3] Delete events from federation_inbound_events_staging table on purge --- changelog.d/12770.bugfix | 1 + synapse/storage/databases/main/purge_events.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog.d/12770.bugfix diff --git a/changelog.d/12770.bugfix b/changelog.d/12770.bugfix new file mode 100644 index 000000000000..8ff8613a10fb --- /dev/null +++ b/changelog.d/12770.bugfix @@ -0,0 +1 @@ +Delete events from federation_inbound_events_staging table when a room is purged through the admin API. diff --git a/synapse/storage/databases/main/purge_events.py b/synapse/storage/databases/main/purge_events.py index 38ba91af4c47..c94d5f9f812b 100644 --- a/synapse/storage/databases/main/purge_events.py +++ b/synapse/storage/databases/main/purge_events.py @@ -417,6 +417,7 @@ def _purge_room_txn(self, txn: LoggingTransaction, room_id: str) -> List[int]: "room_account_data", "room_tags", "local_current_membership", + "federation_inbound_events_staging", ): logger.info("[purge] removing %s from %s", room_id, table) txn.execute("DELETE FROM %s WHERE room_id=?" % (table,), (room_id,)) From 3f8f9f3cab9b3b1f071d2a48aaa17ca11da1b1a1 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Tue, 17 May 2022 18:19:24 +0200 Subject: [PATCH 2/3] Mising purged table in the test too --- tests/rest/admin/test_room.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py index 95282f078e77..608d3f2dc36a 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py @@ -2489,4 +2489,5 @@ def _block_room(self, room_id: str) -> None: "room_tags", # "state_groups", # Current impl leaves orphaned state groups around. "state_groups_state", + "federation_inbound_events_staging", ] From 6833ad206c62d207944ec7068a57fe7e35f6a782 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 17 May 2022 17:34:48 +0100 Subject: [PATCH 3/3] Update changelog.d/12770.bugfix --- changelog.d/12770.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/12770.bugfix b/changelog.d/12770.bugfix index 8ff8613a10fb..a958f9a16ba3 100644 --- a/changelog.d/12770.bugfix +++ b/changelog.d/12770.bugfix @@ -1 +1 @@ -Delete events from federation_inbound_events_staging table when a room is purged through the admin API. +Delete events from the `federation_inbound_events_staging` table when a room is purged through the admin API.