2 files changed, 3 insertions, 2 deletions
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
|