Skip to content

Commit

Permalink
Fix bug where persisting some events fails after unclean shutdown.
Browse files Browse the repository at this point in the history
Introduced in #18107
  • Loading branch information
erikjohnston committed Feb 5, 2025
1 parent 37e8934 commit cae5f8f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions synapse/storage/databases/state/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,18 @@ def __init__(
self.db_pool = database
self._instance_name = hs.get_instance_name()

# TODO: Clear from `state_groups_persisting` any holdovers from previous
# running instance.
with db_conn.cursor(txn_name="resolve_sliding_sync") as txn:
self._clear_existing_persising(txn)

def _clear_existing_persising(self, txn: LoggingTransaction) -> None:
"""On startup we clear any entries in `state_groups_persisting` that
much our instance name, in case of a previous unclean shutdown"""

self.db_pool.simple_delete_many_txn(
txn,
table="state_groups_persisting",
keyvalues={"instance_name": self._instance_name},
)

async def check_state_groups_and_bump_deletion(
self, state_groups: AbstractSet[int]
Expand Down

0 comments on commit cae5f8f

Please sign in to comment.