Skip to content
Snippets Groups Projects
Commit 20fa83f3 authored by Erik Johnston's avatar Erik Johnston Committed by Patrick Cloke
Browse files

Remove racey assertion in MultiWriterIDGenerator (#8530)

We asserted that the IDs returned by postgres sequence was greater than
any we had seen, however this is technically racey as we may update the
current positions out of order.

We now assert that the sequences are correct on startup, so the
assertion is no longer really required, so we remove them.
parent 58e583ea
No related branches found
No related tags found
No related merge requests found
Fix rare bug where sending an event would fail due to a racey assertion.
...@@ -612,14 +612,7 @@ class _MultiWriterCtxManager: ...@@ -612,14 +612,7 @@ class _MultiWriterCtxManager:
db_autocommit=True, 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: 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) self.id_gen._unfinished_ids.update(self.stream_ids)
if self.multiple_ids is None: if self.multiple_ids is None:
......
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