Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

fix delete_existing for _persist_events #6300

Merged
merged 1 commit into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6300.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move `persist_events` out from main data store.
2 changes: 1 addition & 1 deletion synapse/storage/data_stores/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _retry_on_integrity_error(func):
@defer.inlineCallbacks
def f(self, *args, **kwargs):
try:
res = yield func(self, *args, **kwargs)
res = yield func(self, *args, delete_existing=False, **kwargs)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just to make it more obvious next time we mess it up (the bug only manifests on IntegrityErrors currently)

except self.database_engine.module.IntegrityError:
logger.exception("IntegrityError, retrying.")
res = yield func(self, *args, delete_existing=True, **kwargs)
Expand Down
5 changes: 1 addition & 4 deletions synapse/storage/persist_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,7 @@ def persisting_queue(item):
self._event_persist_queue.handle_queue(room_id, persisting_queue)

@defer.inlineCallbacks
def _persist_events(
self, events_and_contexts, backfilled=False, delete_existing=False
):
def _persist_events(self, events_and_contexts, backfilled=False):
"""Calculates the change to current state and forward extremities, and
persists the given events and with those updates.

Expand Down Expand Up @@ -412,7 +410,6 @@ def _persist_events(
state_delta_for_room=state_delta_for_room,
new_forward_extremeties=new_forward_extremeties,
backfilled=backfilled,
delete_existing=delete_existing,
)

@defer.inlineCallbacks
Expand Down