← Back to Pull requests

SOLR-18591: Don't double-count shard cpuTime on tolerant partial failure #5239

Closed
unknown closed this pull request without merging on Oct 28, 2026 11:36 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 20:36 UTC
Author

JIRA: SOLR-18591

Description

With solr.log.cputime=true and shards.tolerant=true, SearchHandler.processComponentsDistrib adds a shard request's CPU in the partial-failure branch and again at the bottom of the response loop. So when one shard fails, the final cpuTime over-reports, and the header ends up with several cpuTime entries. NamedList.get returns the first one, so clients see a partial total. The extra add came in with SOLR-17151. This is the only double add in SearchHandler.

Solution

Remove the publishCpuTime block from the partial-failure branch. The bottom-of-loop add and the final header write already cover that response.

Out of scope on purpose: shortCircuitedResults never writes the accumulated shard cpuTime, so a query-limit short-circuit in a distributed search reports only coordinator CPU. I found it while checking whether the removed block, which SOLR-17151 added alongside the checkLimitsBefore calls, was there to keep shard CPU on a short-circuit. It isn't: no short-circuit return in processComponentsDistrib writes shard cpuTime on main. The only case this PR changes is a short-circuit right after a tolerant shard failure, where the removed block happened to leave a shard total in the header. Happy to fold the gap into this PR if reviewers prefer.

Tests

TolerantShardCpuTimeTest has each shard report a fixed cpuTime and fails one shard. On main the single-pass case gets [1000, 2000] (expected [1000]) and the two-phase case gets [1000, 3000] (expected [2000]). Both pass with the fix. TestCpuTimeSearch, TestCpuAllowedLimit, ComponentStageLimitsTest, TestQueryLimits, TestMemAllowedLimit and TestEarlyTerminatingQueries still pass.

Diff: 237 lines (+177 / -60) across 2 files Reviewer: sigram Review duration: 2339m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 237 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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.327
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5239"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 37.2% (MEDIUM) · Higher = larger blast radius
37.2%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 14.7% · Safe to merge
14.7%
Repository