Skip to content
Snippets Groups Projects
Unverified Commit 3391da34 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Fix bug where persisting some events fails after unclean shutdown. (#18137)

Introduced in #18107

`UniqueViolation: duplicate key value violates unique constraint
"state_groups_persisting_pkey"`
parent 37e89349
No related branches found
No related tags found
No related merge requests found
Fix regression where persisting events in some rooms could fail after a previous unclean shutdown. Introduced in v1.124.0rc1.
......@@ -95,8 +95,18 @@ class StateDeletionDataStore:
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="_clear_existing_persising") 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
match our instance name, in case of a previous unclean shutdown"""
self.db_pool.simple_delete_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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment