solr
solr copied to clipboard
SOLR-16392: Refactor and update v2 ADDREPLICAPROP API
Description
The Solr community is engaged in an ongoing effort to make Solr's v2 API more REST-ful and intuitive for users so that it can eventually serve as a viable v1 replacement. This PR in particular focuses on Solr's "add-replica-prop" API, aligning it with the API design described here and agreed to here and here.
In particular this changes the v2 API from:
POST /collections/collName {"add-replica-property" : {...}}
to...
PUT /collections/<coll>/shards/<shard>/replicas/<replica>/properties/<prop> {"value": <val>}
This is a breaking change for users of the v2 API, but one that is allowed due to v2's "experimental" designation.
Solution
This PR modifies add-replica-prop in the way described, but it also refactors the API class to use the newly added JAX-RS framework in the process. This framework-switchover, while conceptually separate from the API realignment in this case, makes sense as both tasks were coming in the short term and touch identical chunks of code.
As a result, this PR not only changes the cosmetics of the add-replica-prop endpoint, it also adds it to Solr's growing OpenAPI spec.
As suggested in the past on similar refactors, I've also moved the logic underlying the add-replica-prop functionality (previously hosted in CollectionsHandler
) over to the v2 AddReplicaPropertyAPI
class. The v1 codepath in CollectionsHandler
now instantiates an AddReplicaPropertyAPI to do its job.
Tests
New unit tests for AddReplicaPropertyAPI
, as well as all the existing v1 and v2 tests for the add-replica-prop functionality continuing to pass.
Checklist
Please review the following and check all that apply:
- [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
- [x] I have created a Jira issue and added the issue ID to my pull request title.
- [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
- [x] I have developed this patch against the
main
branch. - [x] I have run
./gradlew check
. - [x] I have added tests for my changes.
- [x] I have added documentation for the Reference Guide
:warning: 314 God Classes were detected by Lift in this project. Visit the Lift web console for more details.