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

feat(electric): Resume client's replication stream from the on-disk WAL window #1124

Conversation

alco
Copy link
Member

@alco alco commented Apr 4, 2024

This PR makes it possible to resume the replication stream for clients whose position in the replication stream is outside of the in-memory cached WAL window. This is done by streaming transactions directly from the replication slot. Assuming the slot's start position goes back further than the in-memory cache can fit, this effectively extends the resumable WAL window that the sync service can use before having to ask clients to reset their local state.

This implementation builds on the primitives introduced in #1119.

Copy link

linear bot commented Apr 4, 2024

@alco alco changed the title Alco/vax 1773 resume clients from wal feat(electric): Resume client's replication stream from the on-disk WAL window Apr 4, 2024
@alco alco force-pushed the alco/vax-1686-reserve-cached-transactions branch from 513ece2 to 29a7a18 Compare April 5, 2024 13:30
@alco alco force-pushed the alco/vax-1773-resume-clients-from-wal branch 2 times, most recently from 1e15da1 to c1de297 Compare April 9, 2024 14:13
@alco alco force-pushed the alco/vax-1686-reserve-cached-transactions branch 2 times, most recently from affe5c3 to f14c8da Compare April 10, 2024 20:53
@alco alco force-pushed the alco/vax-1773-resume-clients-from-wal branch from c1de297 to b901be3 Compare April 10, 2024 20:54
@alco alco force-pushed the alco/vax-1686-reserve-cached-transactions branch from f14c8da to f00b664 Compare April 18, 2024 20:35
@alco alco force-pushed the alco/vax-1773-resume-clients-from-wal branch from b901be3 to 8c6e5ef Compare April 18, 2024 20:39
@alco alco force-pushed the alco/vax-1686-reserve-cached-transactions branch 3 times, most recently from 5b9352a to 4aaf792 Compare April 24, 2024 11:21
@alco
Copy link
Member Author

alco commented May 3, 2024

Closing this since it has become evident that the total size of electric transactions contained in the on-disk WAL backlog is unlikely to exceed the size of ELECTRIC_TXN_CACHE_SIZE. So by replaying the full WAL backlog at startup and storing all transactions in the in-memory cache, Electric is already doing the most it can do for catching up clients tha are lagging behind.

@alco alco closed this May 3, 2024
@alco alco deleted the alco/vax-1773-resume-clients-from-wal branch May 3, 2024 09:17
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