Skip to content

[Subscription] Fix stalled WAL replay retries across file refresh and rotation - #18919

Merged
jt2594838 merged 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-wal-retry-progress
Oct 20, 2026
Merged

jt2594838 merged 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-wal-retry-progress

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

Subscription WAL replay can remain in WAITING_FOR_READABLE_WAL indefinitely after a reader-open failure: refreshing the file list filters out a sealed header-only WAL, but the retry path keeps waiting for that version to reappear. Rotation can also pair an old file with metadata from its successor because the writer and current-version fields are published separately.

This change:

  • Resolves retries against the unfiltered directory listing so a verified empty sealed WAL can finish without reporting a gap. A missing historical file requires a visible successor, two successful directory scans, and a confirmed absent path before replay reports the missing file and continues. Active files and ambiguous I/O failures remain retryable.
  • Applies the existing stable truncation check when reopening at a saved entry offset. Confirmed missing or truncated files use the existing unreadable-WAL reporting path and discard incomplete request fragments. A file that previously contained entries cannot be mistaken for a normal empty WAL after truncation.
  • Binds live metadata snapshots to the captured writer's file version, and exposes reader-open attempts, the retry file, and the retry reason in replay diagnostics.

Adds regression coverage for filtered empty files, temporarily missing active files, confirmed missing historical files, truncated reopen offsets, header-only truncation, and rotation during metadata capture. The WALBuffer test also covers the interval between publishing a successor writer and publishing its version.

Validation

  • Full-reactor test-compile passed in English and with -Pwith-zh-locale (53 modules each).
  • Recompiled the final changed production sources and selected test classes against the master reactor outputs, then ran eight classes with JUnitCore: 134 tests, 133 passed, 1 existing failure. All seven newly added regression tests passed.
  • The remaining failure, ConsensusPrefetchingQueueWalBackpressureTest.testWalGapRecoveryPreservesFollowerBeforePendingBoundary, was reproduced with the unmodified production sources and test class from base commit 4c34a253927: the same memory assertion expects 1318 bytes and observes 0. Its assertion is unchanged in this PR.
  • Spotless, git diff --check, locale key parity, and the new messages' placeholder/hash checks passed.

The original long-running workload has not been rerun with this patch. This PR addresses reproducible retry-state defects; it does not establish that every replay stall under memory pressure has the same cause.

Review checklist

  • Self-reviewed, including concurrent WAL rotation and metadata reads.
  • Added regression tests and adapted existing metadata mocks.
  • Added comments explaining recovery and incomplete-request handling.

Key classes: ProgressWALIterator, WALBuffer, WALNode, ConsensusPrefetchingQueue.

@jt2594838
jt2594838 merged commit 6844c47 into apache:master Oct 20, 2026
38 of 39 checks passed
@jt2594838
jt2594838 deleted the fix/subscription-wal-retry-progress branch October 20, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants