Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
|
I have put the pr in draft mode until postgrex has a release btw. Created it as a full pr by accident :) |
|
@palermo-git anyone home? :D |
|
Hey Oliver, someone's home! Sorry for the slow reply. This got buried in my GitHub notifications and I only just saw it. Thanks for putting this together. An importer flushing a few thousand rows shouldn't take the replicator down, and a month in production is useful evidence. I haven't been through the code yet, so I don't have feedback on the approach. Your plan works for me: keep it as a draft until Postgrex ships a Hex release with #799 (the latest is still 0.22.4, from before that merged), then update the dependency and mark it ready. I'll approve CI and review it then. Heads up that CI on our If you'd like a read on the approach before the release, let me know and I'll look sooner. |
|
I took an early look, since this is a big change to how Replicant handles backpressure. The overall approach looks right to me. Pausing on queued payload instead of halting on WAL distance fixes a real problem, and keeping credits separate from durable acks is the right call. This comes from reading the code with an AI assistant. We haven't run it, and CI hasn't run on it yet, so some of these may be wrong. Please push back on anything that doesn't hold up. Line numbers are from 81ac1a7. The main one I'd like your view on A permanently stuck sink now pauses forever ( I'd want these fixed before merging
Narrower cases
Which of batching, spill and incremental snapshots does your prod setup use? That tells us how much of this the month in production has already exercised. No rush on any of this, since it's still waiting on the Postgrex release. Thanks again for the PR! |
81ac1a7 to
e71ae1e
Compare
|
Thanks for the detailed review. I’ve pushed a follow-up addressing these points and rebased onto current main. For prolonged pauses, I chose repeated telemetry rather than an automatic disconnect: The other changes are:
Local validation passed against stock PostgreSQL 15–18, alongside format, strict Credo, warnings-as-errors compilation, and Dialyzer. I also tested the fork with Evo Store’s full backend suite and its PostgreSQL-to-ClickHouse integration spike. Older/plugin-specific integration lanes weren’t run locally. The checked-in Evo Store configuration uses incremental snapshots and library-owned checkpoints, without batching or spill configured, so I wouldn’t claim the production runtime covered those optional paths. We also have a separate transport-liveness issue involving a silently dead connection after a VIP handover. This change doesn’t solve receive silence on an unpaused stream; I’m going to be opening a PR stacked onto this one with my suggested fixes for that scenario. Leaving this as a draft with the Postgrex pause/resume commit still pinned. |
|
Thanks Oliver, this is a really solid follow-up. I went back through it against my list, and nearly everything looks resolved. As before, this comes from reading the code with an AI assistant, and we haven't run it yet. I'm approving the CI run now so we get a first result. You've convinced me on the pause deadline: the old halt didn't release WAL either, so server-side retention limits are the right protection. I'd still like to close a gap in how a stuck sink gets noticed: Stall signal.
Could this become a stall event that fires when frames are queued and none has completed for N seconds, paused or not, plus a Subtransaction messages. The abort path drops messages where Small cleanups, if you're in there anyway: the 3-tuple Unless CI or a live run turns up something new, that's everything I'd ask for on this PR. Please keep the follow-up as its own commit when you force-push, so it stays easy to review. I'll handle the version when we release. These are contract changes, so I'm leaning toward 2.0.0. Your transport-liveness PR is very welcome. One thing to watch there: keepalives stop while paused, so a receive-silence check mustn't fire during a pause. |
|
Opened #15 with the suggested receive-silence watchdog fixes, stacked on this PR. GitHub cannot target our fork branch as the base here, so it currently targets main; I’ll rebase it once this PR merges. |
WAL-position distance can grow because of unrelated writes or segment switches, even when Replicant has little queued data. A slow sink currently trips a permanent halt instead of allowing the stream to catch up.
This uses the pause/resume API merged in elixir-ecto/postgrex#799 to pace intake by queued payload bytes and message count while retaining the connection and slot. Feedback continues while paused, and processing credits remain separate from durable acknowledgements.
Retained transactions and batches have their own budget: spill or flush where possible, otherwise halt on actual exhaustion. Incremental snapshot pacing uses retained data rather than WAL distance. The port preserves current decoder support and includes coverage for multi-message wal2json payloads.
Submitting this as a draft until Postgrex has a release containing the pause/resume API. Once that lands, I will update the dependency, force-push the branch, and mark this PR ready for review.
This code has been running in prod for a month or so now with no issues.
Originally bumped into the problem after an importer flushed a couple of thousand rows in one write and the replicator fell over.