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(electric): Fix a data race that may occur when a client is sufficiently behind the latest Postgres state #1199

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alco
Copy link
Member

@alco alco commented Apr 25, 2024

This PR addresses the following edge case:

  1. a client connects to the server
  2. the server confirms that the client is in the cached WAL window
  3. a garbage collection cycle occurs and the cache drops old transactions as a result
  4. the client starts replicating from the server but never receives the transactions it was supposed to get

This leads to the client having an inconsistent state with the server.

The way this is addressed is by implementing a reservation system inside the cache to prevent it from dropping reserved transactions even if they are already outside of the cached WAL window size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant