SOLR-18663: Don't leave the update log BUFFERING after an incomplete … #5359
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
nick-boss-tech
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 callscancelRecovery(), the loop exits viaisClosed(), 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()callsUpdateLog.dropBufferedUpdates()in afinallyblock when it didn't. Two guards:UpdateLog.close()keeps the buffer tlog as the "previous recovery did not complete" marker for the next startupThis 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: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: