This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When loading current ids, sort by
stream_id
to avoid incorrect overwrite and avoid errors caused by sorting alphabetical instance name which can benull
#13585When loading current ids, sort by
stream_id
to avoid incorrect overwrite and avoid errors caused by sorting alphabetical instance name which can benull
#13585Changes from 1 commit
d58a6fe
15d725a
1a8d48b
6c714ed
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the correct order that we want? "Sort by [what] so that ... because [why]"
The previous code sorted it by
instance_name
because that was the first column selected in the SQL. Why do we want to do that? That code has been there since it was introducedinstance_name
can benull
instead ofmaster
which blows up the sort code. Another question is why do we see it asnull
sometimes instead ofmaster
in monolith mode?As @richvdh pointed out, it does work to sort worker instances. But it's unclear to me why we want that or if that is intended. It feels like we might not need to sort at all.
Further discussion: https://matrix.to/#/!vcyiEtMVHIhWXcJAfl:sw1v.org/$XjldnX6z-QfMK-eAS77tEIbwN5kNA3tq8s9temUwONs?via=matrix.org&via=element.io&via=beeper.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(requesting review for this comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My best guest is the line:
Where if we didn't ensure that we handled the rows in ascending stream ID order (per-instance) then we could end up setting the current position to a lower stream ID than we ought to.
I think its enough to do
rows.sort(key=lambda _, stream_id: stream_id)
or similar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context @erikjohnston!
I don't know of the symptoms this would manifest as or underlying problems this causes but I guess this fixes some other bugs with incorrect
stream_ids
(all the places we useMultiWriterIdGenerator
).Probably solving some duplicate primary key database errors at the very least. And maybe larger bugs like
to_device
messages not sending.