3 ms·
> If a LiteFS node is way behind on replication, can it let the app know when it's caught up? LiteFS exposes the replication position via a file[1] suffixed wi
by benbjohnson 4y ago
> If a LiteFS node is way behind on replication, can it let the app know when it's caught up?
LiteFS exposes the replication position via a file[1] suffixed with "-pos" for each database. That has a monotonically increasing TXID that you could compare to the primary.
We track latency via a Prometheus metric but we don't currently expose that easily to the application. I added an issue for that[2].
> have one Fly instance running and another in cold standby. On deploy, the cold instance boots, fails the health check until replication catches up, then takes over while the first instance goes cold.
When LiteFS starts up, it waits for the node to either connect to the primary and catch up or become the primary itself before it starts the user's application (if running in a supervisor mode). That would probably get you most of the way there to what you're trying to do.
[1]: https://fly.io/docs/litefs/position/ https://fly.io/docs/litefs/position/
[2]: https://github.com/superfly/litefs/issues/253 https://github.com/superfly/litefs/issues/253