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
This commit is contained in:
Jason Little 2024-10-30 20:16:49 -05:00 committed by GitHub
parent 0c429fae1d
commit 034d472688
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

1
changelog.d/17815.bugfix Normal file
View File

@ -0,0 +1 @@
Avoid lost data on some database query retries.

View File

@ -804,11 +804,11 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore):
logger.info("[purge] removing redundant state groups") logger.info("[purge] removing redundant state groups")
txn.execute_batch( txn.execute_batch(
"DELETE FROM state_groups_state WHERE state_group = ?", "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( txn.execute_batch(
"DELETE FROM state_groups WHERE id = ?", "DELETE FROM state_groups WHERE id = ?",
((sg,) for sg in state_groups_to_delete), [(sg,) for sg in state_groups_to_delete],
) )
@trace @trace