SOLR-16458: Convert /api/node/system to JAX-RS#4078
SOLR-16458: Convert /api/node/system to JAX-RS#4078gerlowskija merged 36 commits intoapache:mainfrom
Conversation
Add NodeSystemIfoApi (notice the lower-case last chars), to (eventually) replace Endpoint NodeSystemIfoAPI. Lo warning about deprecation. Add GetNodeSystemInfo, move the info-gathering logic to a separate class NodeSystemInfoProvider, adjust SystemInfoHandler. Known Issue: NodeSystemInfoResponse does not support responses from multiple nodes. More testing and clean-up to do.
Fix NodeSystemResponse to contain a map of node name to node info. Fix responses for Json and XML. TODO : nodes=all is ignored
Clean-up unused imports
forgot those in the previous commit
Fix log calls. Add unit tests for HTTP call.
Remove the Map from NodeSystemInfoResponse: the AdminHandlersProxy wraps all nodes responses into a map, it should not belong to the response class.
Replace the Map wrapper by just a single object wrapper: NodeSystemInfo. It provides some separation between the response header and the actual node info.
|
First off, thanks again for sharing this PR and tackling another v2 API!
I agree with some of your concerns about the "cosmetics" of the request and API-response as they are today. We're free to change v2 APIs and their responses as much as we'd like. But v1 APIs are required to be backwards-compatible: breaking changes can only occur on major-version upgrades. That's not to say that v1 can't be changed, just that if v1 has a "breaking change" then it can only go to 'main', not branch_10x. So we've got some options depending on how much we care about updating v1 vs. v2-only. What we've done in a few places elsewhere is make whatever improvements we want to the v2 response format, and then if the v1 codepath calls v2 code have the v1 code do some manual massaging to reshape the response into something that meets backwards compatibility. It's not pretty, but it meets the requirements and is code that will eventually go away when we are able to deprecate and remove some of these v1 endpoints. So that's probably what I'd recommend for these sort of smaller response-changes. I'm somewhat tempted, as I read your comments, to suggest overhauling this endpoint entirely and making it look radically different in our v2 API. Something like splitting it up into a few smaller paths, like |
Thanks for the feedback, @gerlowskija As for splitting the new V2 response into smaller paths, it could be a path parameter, at least for "blocks" of info, like "jvm", "gpu", what else? I'm not sure what |
Ensure back-compatible response from V1 path (and from old V2 path)
Add method getSpecificNodeSystemInfo, with path parameter, to get only selected info. Add query param "nodes": not used, because AdminHandlersProxy does not support V2 yet.
Merge remote-tracking branch 'origin-solr/main' into NodeSystemInfoApi-JerseyResource
Merge remote-tracking branch 'origin-solr/main' into NodeSystemInfoApi-JerseyResource
Commented-out for now. Revert to class name NodeSystemResponse
Split core info response into a different model class. Place the getCoreInfo method in the utility class, to re-use in back-compatible /admin/info/system response. Rename a few classes Adjust documentation
|
Also, I think this may have some overlap? #4171 |
I did update system-info-handler.adoc. But I there's probably still a few more references to /admin/info/system here and there in the documentation, to be reviewed once the implementation is settled. |
gerlowskija
left a comment
There was a problem hiding this comment.
Found a few things that very likely need changed - left comments about those inline. That should help slim things down a bit.
In general - I'm sympathetic to the cosmetic changes you've considered in this PR but I'm having trouble reviewing the PR in detail. I just don't know our "system info" stuff to tell at a glance what's "new" and what's a refactor of the existing code.
@igiguere would you object to our making this "just" a verbatim JAX-RS migration, and we could handle any cosmetic changes in a subsequent PR? (You could do this, if willing. Or if not, I'm happy to make the changes myself if you don't mind. I've waffled a bit on this already and don't want that to cause you additional work. Just give me a thumbs up or thumbs down and I can get started)
In practice this would mean:
- deleting the existing class NodeSystemInfoAPI
- Modifying NodeSystemInfoApi to use the "/node/system" path (at least, for now)
- Deleting
NodeSystemInfoApi.getSpecificNodeSystemInfo(at least, for now) - removing the
NodeSystemInfowrapper-object inNodeSystemResponse(again - just for now. Of all your cosmetic improvements this is the one that I like the most! but it adds a ton to the diff and it'd be easier to review in a separate PR)
changelog/unreleased/PR#4078-node-system-response-v2-jersey-resource.yml
Outdated
Show resolved
Hide resolved
solr/api/src/java/org/apache/solr/client/api/endpoint/NodeSystemInfoApi.java
Outdated
Show resolved
Hide resolved
solr/api/src/java/org/apache/solr/client/api/util/Constants.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/handler/admin/api/NodeSystemInfoAPI.java
Outdated
Show resolved
Hide resolved
solr/solrj/src/java/org/apache/solr/client/solrj/request/SystemInfoV2Request.java
Outdated
Show resolved
Hide resolved
solr/solrj/src/java/org/apache/solr/client/solrj/response/SystemInfoV2Response.java
Outdated
Show resolved
Hide resolved
solr/solrj/src/test/org/apache/solr/client/solrj/response/SystemInfoV2ResponseTest.java
Outdated
Show resolved
Hide resolved
|
Thanks @gerlowskija for taking the time to go through, I think your suggestions make a lot of sense! You know this code base better than I! I think verbatim conversion in one PR combined with a second improvement PR makes a lot of sense. In my poking around, there are a lot of places we can improve the V2 apis, and that's why they are labeled Experimental! SO we can change them. |
Hemmm... right. I can scale back. I'll keep the current changes in a stash locally. |
Revert changes to the response structure: simpler PR for simpler review. Remove the old '@endpoint' API implementation and related unit tests.
@gerlowskija: I hope it helps review. I'm going through your other comments, to see if anything else still applies. |
adjust changelog and run tidy
run gradlew check, fix logging "issue".
- removes some dead code - makes 'proxy' callout more uniform with other APIs A few more updates to come.
- shrink GetNodeSystemInfoTest to use the generated v2 SolrRequest - corrections to ref-guide docs - shrinks to SolrJ request, response, parser objects.
solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc
Outdated
Show resolved
Hide resolved
solr/solrj/src/java/org/apache/solr/client/solrj/request/SystemInfoRequest.java
Outdated
Show resolved
Hide resolved
solr/api/src/java/org/apache/solr/client/api/model/CoreInfoResponse.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeSystemInfo.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
Outdated
Show resolved
Hide resolved
solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc
Outdated
Show resolved
Hide resolved
solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc
Outdated
Show resolved
Hide resolved
solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc
Outdated
Show resolved
Hide resolved
solr/solr-ref-guide/modules/configuration-guide/pages/system-info-handler.adoc
Outdated
Show resolved
Hide resolved
solr/solrj/src/java/org/apache/solr/client/solrj/request/SystemInfoRequest.java
Outdated
Show resolved
Hide resolved
|
Hey @igiguere - I left one last round of review. Most of the changes were minor/tedious, so I've taken the liberty of making them myself and pushing to your branch. As such the comments should all be "addressed" and not hugely worth reading, but I still figured I'd leave them as a way to flag what I changed and give a bit of background on the rationale. Gonna aim to commit this in the next day or two. Thanks for all your patience and effort on this; exciting to get it merged at long last! |
Thanks for the fixes, @gerlowskija ! |
|
Excellent - appreciate the double check on those comments.
Can you elaborate about the backcompat break you're seeing there? It's very possible I'm missing something, but my understanding is that even though the code was there to do so, The conditional needed to exist at one point because SystemInfoHandler used to serve What am I missing? |
|
Oops - forgot to tag @igiguere . Also...
Good call out - I'll fix that in a quick PR once this gets merged! I think we could add that v2 API in this PR, but I'd like to get this one merged since it's been outstanding for so long. |
@gerlowskija : Quick test on a Solr 9.10. |
This migration to JAX-RS implicitly adds these APIs to the OAS, and ensures autogeneration of SolrRequest/SolrResponse types. Co-authored-by: Isabelle Giguere <igiguere71@yahoo.ca> Co-authored-by: Jason Gerlowski <gerlowskija@apache.org>
|
Awesome work team! |
|
Yeah! Merged ! |
https://issues.apache.org/jira/browse/SOLR-16458
Jira Ticket
The Excel spreadsheet links to SOLR-16458 for the V1 /solr/admin/info/system and V2 /api/node/system, although the ticket does not mention those URLs.
From the checklist below : "I have created a Jira issue and added the issue ID to my pull request title." - m'well, no. But keeping track of these V2 tickets is probably difficult enough without adding one more.
Sorry about the mix-up in the commit messages. I originally landed on the wrong ticket.
Description
Implementation of a Jersey resource to support getting the system info. This new resource should replace the home-brew "Endpoint" V2 resource.
QUESTIONS:
Suggestion: wrap the V2 system info in "nodeInfo":
<response><lst name="responseHeader"><!-- ... --></lst><lst name="nodeInfo"><str name="node">localhost:8983_solr</str><!-- ... --></lst></response>Ideally, IMHO, the "node" field should be named "name" (i.e.: the node name), and then the wrapper "nodeInfo" could be just "node"
I experimented with creating a V2 endpoint equivalent to the new CoreInfoHandler, but the request's SolrCore is always null. I tried creating a V2 resource like /node/{coreName}/info, and also tried /cores/{coreName}/info. No luck. Or I'm missing something. That code is not included, though.
Solution
Add NodeSystemInfoApi (in solr-api), implemented in GetNodeSystemInfo.
Class SystemInfoProvider contains code to provide the system info, copied from SystemInfoHandler.
Clean-up SystemInfoHandler to use SystemInfoProvider, making sure the response is back-compatible
Tests
Add unit tests for SystemInfoProvider (note that the test class for SystemInfoHandler was actually only testing a method now found in SystemInfoProvider).
Add unit tests for GetNodeSystemInfo.
Functional tests on a local instance (dev-slim, started with the "cloud" example)
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.