electric-sql / electric

Sync little subsets of your Postgres data into local apps and services.
https://electric-sql.com
Apache License 2.0
6.15k stars 143 forks source link

Electric fails to detect when its persistent storage goes away and prevents Postgres from cleaning up WAL files #1719

Open alco opened 2 days ago

alco commented 2 days ago

Imagine a simple scenario where Electric is running inside a Kubernetes pod with no persistent storage. Some shapes get created, so Electric creates a publication in Postgres and starts processing transactions.

When the pod is restarted, a new file system is created for it with no traces of the previous shape storage. Electric will no longer be able to process incoming transactions from Postgres, causing the latter to build up its WAL backlog indefinitely.

Electric should be able to detect this failure mode and drop transactions when there is no active shape collector process instead of keeping those transactions around by refusing to advance the replication slot.

thruflo commented 2 days ago

N.b.: https://discord.com/channels/933657521581858818/1285476835412541516