Repository navigation
fix: a sink that is down stalls the stream and never parks a change - #22
Merged
Merged
Conversation
A sink being restarted (Meilisearch, say) could lose changes to the
dead-letter queue: an unreachable Meilisearch was a transient error, the DLQ
counted each failed cycle against the batch's first event and parked it at
CDC_DLQ_THRESHOLD (3), before the circuit breaker opened at 5, and nothing
retried it. The record then stayed missing or stale in search.
One rule now holds for every sink: a sink that is down stalls the pipeline
and loses nothing; only a change the sink rejects is parked.
- domain: sink errors are Permanent (the data), Unavailable (the sink) or
transient. IsUnavailable also recognizes an open circuit, an attempt
timeout and transport errors (refused, reset, dropped, DNS).
- sinks classify their sink-wide failures as Unavailable: Meilisearch no
response, 5xx, 408, 429, 401, 403 and system/auth task errors; webhook
5xx, 408, 429, 401, 403, 404; Redis loading, read-only, OOM, cluster or
master down, auth, closed pool; NATS disconnected, no servers, timeouts,
JetStream 5xx. Unencodable Meilisearch payloads and oversized NATS
messages are Permanent.
- resilience: a failure the sink did not classify is Unavailable when the
sink's health check fails too, once retries are spent.
- dlq: an unavailable failure is never counted toward the threshold,
split or parked, and isolation stops as soon as the sink turns out to be
down.
- service: an unavailable sink holds the batch in process and is retried
with backoff (1s to 30s) until it takes it, without tearing the stream
down, so the sinks that took the batch are not sent it again and a
webhook resumes at the event that failed. The position is shared, so the
other sinks wait: the slot can only be confirmed past a change every sink
has.
- the stall is visible: /readiness is not ready and lists stalled_sinks
and unhealthy_sinks, /api/stats marks the sink, cdc_sink_stalled{sink},
and a warning when the stall starts, once a minute, and when it ends.
Dead letters are not retried automatically: replaying a parked event can
write an older version of a row over a newer one, and the queue now only
holds changes a sink rejected. POST /dlq/retry is unchanged.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7VRX3LAZReXjVdthBP8WJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
A sink being restarted (Meilisearch, say) could lose changes to the dead-letter queue. An
unreachable sink was treated as a passing error; the dead-letter layer counted each failed
cycle against the batch's first event and parked it at
CDC_DLQ_THRESHOLD(3), before thecircuit breaker opened at 5; nothing retried it. The record then stayed missing or stale in
search until it changed again.
One rule now holds for every sink: a sink that is down stalls the pipeline and loses nothing;
only a change the sink rejects is parked.
domain: a sink error is Permanent (the data), Unavailable (the sink) or transient.IsUnavailablealso recognizes an open circuit, an attempt timeout and transport errors.408, 429, 401, 403 and system or auth task errors; webhook 5xx, 408, 429, 401, 403, 404;
Redis loading, read-only, OOM, cluster or master down, auth, closed pool; NATS disconnected,
no servers, timeouts, JetStream 5xx).
resilience: a failure the sink did not classify is Unavailable when the sink's health checkfails too, once retries are spent.
dlq: an unavailable failure is never counted, split or parked, and isolation stops as soonas the sink turns out to be down.
services: an unavailable sink holds the batch in process and is retried with backoff (1 sto 30 s) until it takes it, without tearing the stream down, so the sinks that took the batch
are not sent it again.
/readinessis not ready and listsstalled_sinksandunhealthy_sinks,/api/statsmarks the sink,cdc_sink_stalled{sink}, and a warning whenthe stall starts, once a minute, and when it ends.
Dead letters are not retried automatically. Replaying a parked event can write an older
version of a row over a newer one, and GTC has no safe way today to re-read a row's current
state by key (parked events are stored after transforms, which can drop or mask the key).
POST /dlq/retryis unchanged.Behaviour to know about
/readinessnow answers 503 while a sink is down. A liveness probe must stay on/health,or a sink outage would get GTC restarted in a loop. The Trenova chart's readiness probe moves
to
/readinessin emoss08/Trenova'sworktree-managed-followupsbranch.can only be confirmed past changes every sink has.
POST /backfill.Checks run
go vet ./cmd/... ./internal/...andgofmt: clean.go test -raceon every package undercmdandinternal: pass.TestEndToEndagainst a throwawaypostgres:18-alpine(
wal_level=logical) andredis:7-alpine: pass (41 s). Its NATS part was skipped: no NATSURL.
To reach an instance
Tag a release so the image publishes (latest is v0.10.0), then bump
gtc.image.tagindeploy/helm/trenova/values.yaml(0.9.1) anddev/compose.ymlin emoss08/Trenova.🤖 Generated with Claude Code
https://claude.ai/code/session_01G7VRX3LAZReXjVdthBP8WJ