Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(db): Avoid dirty read for local message updates #9424

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

ChristophWurst
Copy link
Member

When updating local messages we diff the recipients and INSERT/DELETE all changes. Afterwards, the current recipients for the updates message are fetched from the database. This is a textbook example of a causal read. It's likely that database clusters with weak consistency read dirty data.
I'm applying the quick and dirty fix here because the operation already happens in a transaction. The better performing fix would be to build the data in memory. We have everything we need and can refactor the SELECT away.

@ChristophWurst ChristophWurst merged commit 6827296 into main Mar 5, 2024
36 of 37 checks passed
@ChristophWurst ChristophWurst deleted the fix/db/dirty-read-local-message-update branch March 5, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants