← Back to Pull requests

SOLR-18663: Don't leave the update log BUFFERING after an incomplete … #5359

Open
unknown opened this pull request with 327 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 17, 2026 17:27 UTC
Author

https://issues.apache.org/jira/browse/SOLR-18663

Description

RecoveryStrategy.doSyncOrReplicateRecovery() puts the update log into BUFFERING on every attempt, but only the success path replays the buffer. When an attempt ends any other way, the update log stays in BUFFERING: cancelled by leader election, max retries, or the "we are now the leader" return.

From then on UpdateLog.preCommit() skips every hard commit, so the tlog never rolls and grows at the full indexing rate while the core looks healthy. The common trigger is a replica promoted to leader mid-recovery: election calls cancelRecovery(), the loop exits via isClosed(), and the new leader is left BUFFERING. I hit this on 9.10.1: TLOG.state=1 on an indexing leader, tlog generation frozen, +33 GB in 12 days. This is the NRT side of SOLR-14679; that fix only covered TLOG replicas.

Solution

The retry loop moves into a private method that returns whether recovery succeeded, and doSyncOrReplicateRecovery() calls UpdateLog.dropBufferedUpdates() in a finally block when it didn't. Two guards:

  • only if this recovery started buffering, so a buffer owned by MIGRATE or a split is left alone (see SOLR-18601)

  • not during shutdown, where UpdateLog.close() keeps the buffer tlog as the "previous recovery did not complete" marker for the next startup
  • This doesn't change which updates get applied: nothing in the buffer was ever applied, and the next attempt's bufferUpdates() would discard it anyway.

    I investigated this bug myself, and used an AI coding assistant during the fix implementation and for parts of the tests; I reviewed and verified every change myself.

    Tests

    New RecoveryUlogStateTest, one test per exit path plus the two guards:

  • cancelled recovery → ACTIVE

  • replica promoted to leader mid-recovery → ACTIVE, and hard commits roll the tlog again

  • max retries exceeded → ACTIVE

  • recovery on a leader buffering for someone else → buffer untouched

  • shutdown during buffering → buffer tlog kept on disk
  • On unpatched main the first three fail every time (the promoted leader's tlog id stays at 1 across three hard commits), and each guard test fails if its guard is removed. I also ran the recovery, leader election, tlog, PeerSync, split and MIGRATE suites (the core ones with -Ptests.nightly=true) and the same tests on branch_9x.

    Checklist

    Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • Diff: 327 lines (+245 / -82) across 4 files Reviewer: nick-boss-tech Review duration: 18890m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 327 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #5359"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42% (MEDIUM) · Higher = larger blast radius
    42%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.4% · Safe to merge
    22.4%
    Repository