fix: Backport WAL replay hang fix to release-3.6.x (#21176) - #23630
Merged
Conversation
(cherry picked from commit fb58ab8)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 987b6f1. Configure here.
Contributor
|
I'll cherry-pick #23631 into this PR |
…ight replay flush Return the number of bytes subtracted from within the singleflight-protected flush, so every caller coalesced into that flush observes its progress, and only treat a zero-progress flush as fatal while still over the ceiling. WithBackPressure sampled totalSubtracted outside the singleflight window. A worker that loaded the counter after an in-flight flush had already called Sub, then joined that same flush, saw no change to the counter and aborted WAL recovery with "flush made no progress" even though the flush had freed memory. Cherry-picked from #23631 so that release-3.6.x does not pick up the race along with the WAL replay hang fix.
jnewbigin
enabled auto-merge (squash)
July 31, 2026 05:25
jnewbigin
approved these changes
Jul 31, 2026
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 this PR does / why we need it:
Backports the WAL replay no-progress fix to
release-3.6.xso it can be picked up by GEL 3.6 (which vendors this branch).On 3.6.x,
replayController.WithBackPressurehas no exit condition: if a replay-triggered flush does not reduce in-memory bytes below 90% ofreplay_memory_ceiling(slow/unavailable storage backend,chunk_retain_periodholding freshly flushed chunks, failed immediate flush ops being re-enqueued forever), the ingester spins in the backpressure loop indefinitely. It never finishes replay, never becomes ready, gets killed by the startup probe, and replays the same WAL again on the next start — an unrecoverable crash loop that only clearing the WAL breaks. We hit exactly this with a customer running GEL 3.6.10 (grafana/support-escalations#23469).Two cherry-picks, in order:
The refactor is included because #21176 was written on top of it; taking both keeps
replay_controller.goidentical tomain(both cherry-picks applied cleanly, no conflicts) instead of hand-porting the progress-detection logic onto the oldsync.Condimplementation.With this fix, a no-progress flush fails recovery with an explicit error (
WAL replay flush made no progress: ... cannot recover) instead of hanging silently, and a zeroreplay_memory_ceilingno longer triggers backpressure on every record.Special notes for your reviewer:
go test ./pkg/ingester/ -run TestReplayControllerpasses on this branch, including the four tests added by #21176.Checklist
CONTRIBUTING.mdguide (required)docs/sources/setup/upgrade/_index.mddeprecated-config.yamlanddeleted-config.yamlfiles respectively in thetools/deprecated-config-checkerdirectory.🤖 Generated with Claude Code