From 034d472688a83c5a41bda8a27c485111ecf95138 Mon Sep 17 00:00:00 2001 From: Jason Little Date: Wed, 30 Oct 2024 20:16:49 -0500 Subject: [PATCH] Remove `Generator` in `_purge_unreferenced_state_groups` twice (#17815) Context: https://github.com/matrix-org/synapse/issues/15439 (https://github.com/element-hq/synapse/issues/15439) Also see discussion in https://github.com/element-hq/synapse/pull/17813 --- changelog.d/17815.bugfix | 1 + synapse/storage/databases/state/store.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/17815.bugfix diff --git a/changelog.d/17815.bugfix b/changelog.d/17815.bugfix new file mode 100644 index 0000000000..5dd276709b --- /dev/null +++ b/changelog.d/17815.bugfix @@ -0,0 +1 @@ +Avoid lost data on some database query retries. diff --git a/synapse/storage/databases/state/store.py b/synapse/storage/databases/state/store.py index aea71b8fcc..875dba3349 100644 --- a/synapse/storage/databases/state/store.py +++ b/synapse/storage/databases/state/store.py @@ -804,11 +804,11 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore): logger.info("[purge] removing redundant state groups") txn.execute_batch( "DELETE FROM state_groups_state WHERE state_group = ?", - ((sg,) for sg in state_groups_to_delete), + [(sg,) for sg in state_groups_to_delete], ) txn.execute_batch( "DELETE FROM state_groups WHERE id = ?", - ((sg,) for sg in state_groups_to_delete), + [(sg,) for sg in state_groups_to_delete], ) @trace