← Back to Pull requests

SOLR-16398: Migrate rebalance leaders and migrate docs v2 APIs to JAX-RS #5284

Open
unknown opened this pull request with 560 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 03, 2026 17:06 UTC
Author

🤖 AI text below 🤖 (reviewed by Nick Shanin)

Draft status is due to Nick Shanin's open-PR cap; the change is complete and ready for review, and it will be marked Open upon request.

This is the next sibling PR under SOLR-16398, following the split-shard migration in PR #5265, which Eric Pugh asked for as the representative command before the approach scaled up to the remaining commands.

What happens today

Rebalance leaders and migrate docs are still served by annotated v1-style API classes while the shard APIs around them are JAX-RS resources.

RebalanceLeadersAPI and MigrateDocsAPI carry their v2 routes as annotations on v1-shaped classes registered through CollectionsHandler.getApis(). The neighboring collection commands (create shard, delete shard, split shard) are Jersey resources with endpoint interfaces in solr/api, typed request bodies, and generated SolrJ clients. The v2 tracking spreadsheet lists both commands as not yet migrated to JAX-RS.

What this change does

Both commands become JAX-RS resources in the same shape as split shard, and the annotated classes are removed.

New endpoint interfaces RebalanceLeadersApi and MigrateDocsApi, with typed request bodies; the migrate-docs body carries the async field, and the resource passes it to the same submission the v1 route uses. The resources RebalanceLeaders and MigrateDocs are registered in CollectionsHandler alongside SplitShard, and RebalanceLeadersAPI and MigrateDocsAPI are deleted. The v1 routes do not change behavior: MIGRATE still returns its overseer message from the handler, and REBALANCELEADERS still executes the admin operation directly.

A choice to check

The two commands share one PR, and both endpoints carry the request-body fix from PR #5265.

The family plan on the ticket, set by Jason Gerlowski, is one to two APIs per PR; these two share their handler registration and test scaffolding, so they travel together. Shout if you would rather see them split. Separately, PR #5265 recorded that the sibling endpoints carried the same bare @RequestBody defect fixed there; both endpoint interfaces here declare @RequestBody(description = "Contains user provided parameters"), so the generated client and OpenAPI spec include the request body.

Proof

The focused tests pass at the PR head; on the base code the v2 resources and the integration test do not exist.

Verified 2026-11-03 at head 793e1ffa0f1d67271fbf090773651cd8a26171e4, on a branch rebased onto main after PR #5265 merged: tidy clean for the api and core modules; :solr:core:compileJava passes with Error Prone enabled (-Pvalidation.errorprone=true); CollectionCommandsV2IntegrationTest (2 tests), V2CollectionAPIMappingTest (2 tests), TestCollectionAPIs (2 tests), and TestApiFramework (3 tests) all pass with no failures, errors, or skips; :solr:core:check -x test passes.

Limits

Only rebalance leaders and migrate docs are in this PR.

Move replica follows on its own branch, and the core commands and the reindex migration are likewise ready on branches for later PRs, per the plan on the ticket. Replication is not covered here: Jalaz Kumar is carrying those APIs forward, per the ticket discussion. Neither command needed the v1-to-v2 async adapter that split shard needed, because neither v1 operation delegates to a resource: MIGRATE returns its message to the handler, which submits it, and REBALANCELEADERS executes in place.

Changelog: changelog/unreleased/SOLR-16398-rebalance-migrate.yml

Nick Shanin directed the work and takes responsibility for this contribution.

Diff: 560 lines (+420 / -140) across 7 files Reviewer: nick-boss-tech Review duration: 39071m
All Vouch review confidence checks passed
Residual risk 0.39 = Change Risk (0.73) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.73 · 560 lines diff across 7 files
0.73
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.379
Shallow Review Depth shallow_review_depth
0.344
Sensitive Paths sensitive_paths
0.073
Real PR Conversation Timeline
1 comments
"Review active on #5284"
general weight: 0.35
Assignees
Unassigned
Labels
risk: medium confidence: 46.7% reviewed sensitive_module
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: 72.8% (HIGH) · Higher = larger blast radius
72.8%
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: 38.8% · Moderate risk
38.8%
Repository