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

Remove racey assertion in MultiWriterIDGenerator #8530

Merged
merged 2 commits into from
Oct 14, 2020
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/8530.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix rare bug where sending an event would fail due to a racey assertion.
7 changes: 0 additions & 7 deletions synapse/storage/util/id_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,7 @@ async def __aenter__(self) -> Union[int, List[int]]:
db_autocommit=True,
)

# Assert the fetched ID is actually greater than any ID we've already
# seen. If not, then the sequence and table have got out of sync
# somehow.
with self.id_gen._lock:
assert max(self.id_gen._current_positions.values(), default=0) < min(
self.stream_ids
)

self.id_gen._unfinished_ids.update(self.stream_ids)

if self.multiple_ids is None:
Expand Down