fix: Prevent a single unhealthy historical from stalling all segment loading and balancing. #19950
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.366
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #19950"
general
weight: 0.35
abhishekrb19
Description
HttpLoadQueuePeonfetches a historical's segment-loading capabilitiessynchronously in its constructor, via
GET /druid-internal/v1/segments/loadCapabilities.On any response other than 200 or 404 (e.g. a 503 from an overloaded or
briefly-unavailable historical), the constructor threw an
RE.Peon construction happens inside
LoadQueueTaskMaster.resetPeonsForNewServers(),which is the first line of
PrepareBalancerAndLoadQueues— the first duty in theHistoricalManagementDutiesgroup. The top-levelDruidCoordinator.DutiesRunnable.run()catch logged"Caught exception, ignoring so that schedule keeps going."and the coordinatorkept ticking — but performed no segment management on any server.
The blast radius is cluster-wide from a single sick server: segment loading and
balancing stop, handoffs stall, and ingestion tasks back up waiting for handoff.
Because
computeIfAbsentdoes not cache on exception, the coordinator re-attemptsthe bad server every run and fails again the same way.
Observed in production as slow handoffs and ingestion tasks taking 2x+ longer,
correlated with the alert above whose stack trace pointed at
HttpLoadQueuePeon→resetPeonsForNewServers→PrepareBalancerAndLoadQueues.run.Once the problematic historical was restarted, segment management duties
resumed normally and ingestion wasn't stalled anymore.
### Fix
Make the capabilities fetch degrade gracefully instead of throwing. On a non-OK
response or any error, alert and fall back to default
SegmentLoadingCapabilities(derived from the configured batch size) — mirroring the behavior the 404 branch
already had. The peon is still created, the server is still managed with
conservative defaults, and the rest of the duty group proceeds. Operators still
get one alert per affected server.
### Changes
-
HttpLoadQueuePeon.fetchSegmentLoadingCapabilities(): the non-OK-status branchand the catch-all now alert and return default capabilities instead of throwing.
Extracted a
getDefaultLoadingCapabilities()helper shared by all three fallbackpaths (404, non-OK, error).
### Tests
-
HttpLoadQueuePeonTest: constructing a peon against a server that returns 503 onloadCapabilitiesnow succeeds and falls back to default capabilities.-
DruidCoordinatorTest#testUnhealthyHistoricalDoesNotAbortDutyGroup: end-to-endtest with a real
DruidCoordinator+LoadQueueTaskMasterwhere one of threehistoricals 503s; asserts the
HistoricalManagementDutiesgroup still completesa run and the two healthy historicals are still managed.
<!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
<!-- If you are a committer, follow the PR action item checklist for committers:
https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
This PR has: