Skip to content

SOLR-16458: Migrate node properties API to JAX-RS - #4775

Open
iprithv wants to merge 8 commits into
apache:mainfrom
iprithv:node-properties-jaxrs
Open

SOLR-16458: Migrate node properties API to JAX-RS#4775
iprithv wants to merge 8 commits into
apache:mainfrom
iprithv:node-properties-jaxrs

Conversation

@iprithv

@iprithv iprithv commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Converts GET /api/node/properties from the homegrown @EndPoint wrapper to JAX-RS, matching the existing node health / logging / system APIs.

  • JAX-RS interface and typed NodePropertiesResponse in solr/api
  • GetNodeProperties owns redaction / collection logic
  • v1 /admin/info/properties delegates to that class; response key system.properties is unchanged
  • SolrJ generates NodeApi.GetNodeProperties
  • HTTP coverage via SolrJettyTestRule for named lookup, full list, and hidden-property redaction

https://issues.apache.org/jira/browse/SOLR-16458

@epugh epugh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one qeustion about how we get a single property format.. I think we are getting away in the v2 api from a name=myproperty parameter and using a path to be more restful? Also, do we need a Ref Guide update? That often get's missed.

Comment thread solr/api/src/java/org/apache/solr/client/api/endpoint/NodePropertiesApi.java Outdated

@Schema(description = "JRE system properties for the Solr node. Secret values are redacted.")
@JsonProperty(SYSTEM_PROPERTIES)
public Map<String, String> systemProperties;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really as simple as a string/string? Great.

@epugh epugh self-assigned this Aug 20, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 21, 2026
@iprithv
iprithv requested a review from epugh August 21, 2026 16:55
@epugh
epugh requested a balanced review from Copilot August 25, 2026 21:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the node-properties API to JAX-RS with typed responses and SolrJ support.

Changes:

  • Adds JAX-RS endpoints and response model.
  • Delegates v1 property collection and redaction to the new implementation.
  • Adds HTTP tests and user documentation.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
jvm-settings.adoc Documents node-properties endpoints.
implicit-requesthandlers.adoc Updates handler and API references.
PropertiesRequestHandlerTest.java Tests v1 named-property lookup.
InfoHandlerTest.java Updates overridden exception signature.
V2NodeAPIMappingTest.java Removes legacy endpoint mapping tests.
GetNodePropertiesTest.java Adds v2 HTTP coverage.
PropertiesRequestHandler.java Delegates v1 requests to JAX-RS logic.
NodePropertiesAPI.java Removes the legacy v2 adapter.
GetNodeProperties.java Implements property retrieval and redaction.
NodePropertiesResponse.java Defines the typed response model.
NodePropertiesApi.java Defines the JAX-RS API contract.
SOLR-16458-migrate-node-properties-api.yml Adds the changelog entry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +61 to +64
private NodePropertiesResponse buildResponse(String name) {
final NodePropertiesResponse response = instantiateJerseyResponse(NodePropertiesResponse.class);
response.systemProperties = collectProperties(name);
return response;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this "disable http caching" is actually a red herring, and we don't need it. @gerlowskija I would be curious if you have any sense that we "need" this caching? Claude, when I dug into it loclaly, didn't think so, and I can't figure out why it would be needed. In fact, curious if GetNodeSystemInfo does...?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that ended up in some of our JAX-RS APIs because someone decided on it at some point on the v1 codepath. For example, see us disabling caching in the CollectionsHandler here.

So in general I think the AI is probably right here that giving hints about cacheability is valid and appropriate. Whether that should be done in individual APIs or as some sort of "ContainerResponseFilter" (see PostRequestLoggingFilter), I'm not really sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so I think I read things backwards... I thought it was enforcing caching (when I talked to you @gerlowskija) but the recommendation is to prevent caching. I will open a seperate JIRA for saying "lets look at cahcing for admin v2 apis".. I don't really want to try to one off solve it in this one PR since hoenstly we haven' teven seen this as an issue! So let's solve it indepdent of this one.. also, so I can merge thisn ;-).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to influence the caching in this class, the way to do it is to have the constructor inject a "SolrQueryResponse" object and then call the appropriate caching method on that instance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will open a seperate JIRA for saying "lets look at cahcing for admin v2 apis".

IMO we're not really consistent on the v1 side either, so I'd use a broader scope of: "Re-evaluate use of caching headers in all Solr APIs". We may decide to rip them out across the board, who knows 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, I poked at this a bit more, GetNodeSystemInfo does call setHttpCaching(false), but it doesn’t actually do anything.. that flag only turns into Cache-Control headers on the core request path, not admin/node APIs. same for CollectionsHandler. so we aren’t dropping any headers that used to be there.

If we do want real no-cache on admin GETs, I think a filter or handleAdminRequest would be a better place for it than this API.. happy to leave that for a follow-up unless you’d rather we do it here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epugh

epugh commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

I am going to merge this tomorrow pending the build completing. I think it's ready...

@epugh
epugh requested review from gerlowskija and removed request for epugh August 25, 2026 23:47

@gerlowskija gerlowskija left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments in line, only 1 really needs addressed though (the PropertiesRequestHandler one).

This is awesome work!

@@ -0,0 +1,8 @@
title: "v2 GET /api/node/properties is now a JAX-RS API; a single property is fetched at /api/node/properties/{propertyName} (SolrJ: NodeApi.GetNodeProperties / GetNodeProperty)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[-0] users probably don't care what framework the API is implemented in. What they likely care about is that (1) the form of the API has changed and (2) by virtue of being in our OpenAPI spec Solr now generates a handy SolrRequest/SolrResponse class for these APIs.

I'd recommend rewording the changelog entry to highlight those aspects, which a user is more likely to care about.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood, changed it to mention the new path and the SolrJ classes, not JAX-RS :)

*/
public class NodePropertiesResponse extends SolrJerseyResponse {

public static final String SYSTEM_PROPERTIES = "system.properties";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Does this field name pre-exist this PR? In general we prefer camelCase, so if this is "new" then we should standardize on that. But if it's pre-existing,let's not worry about it...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, v1 already used system.properties (Admin UI, NodeValueFetcher, etc.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, now is a good time to make these changes... how hard would it be to keep system.properties in v1, but have systemProperties in v2? And, are there a whole bunch of other weridly named fields like this? Or is this the only one?

public NodePropertiesResponse getNodeProperty(String propertyName) {
final NodeConfig nodeConfig = coreContainer.getNodeConfig();
if (!System.getProperties().containsKey(propertyName)
&& !nodeConfig.isSysPropHidden(propertyName)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Why does the redacted-ness factor into whether we throw a 404 here or not? Might be missing it, but I don't see this logic in the original API...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 + hidden, original API never 404’d. On the v2 path we 404 unknown names, but hidden names always return --REDACTED-- so you can’t tell whether a secret is set. I added a comment and a test for that.

}

private NodePropertiesResponse buildResponse(String name) {
final NodePropertiesResponse response = instantiateJerseyResponse(NodePropertiesResponse.class);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0] It's nbd but I don't think we strictly need instantiateJerseyResponse here. That's primarily useful on APIs with many sub-steps where we may want the response to contain information about both the steps that succeeded and those that failed (think collection creation)

Having it here won't do any harm though afaik, so purely a preference thing 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left it for now, mostly to match the other node APIs. happy to drop it if you’d rather :)

Comment on lines +61 to +64
private NodePropertiesResponse buildResponse(String name) {
final NodePropertiesResponse response = instantiateJerseyResponse(NodePropertiesResponse.class);
response.systemProperties = collectProperties(name);
return response;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to influence the caching in this class, the way to do it is to have the constructor inject a "SolrQueryResponse" object and then call the appropriate caching method on that instance.

Comment on lines +61 to +64
private NodePropertiesResponse buildResponse(String name) {
final NodePropertiesResponse response = instantiateJerseyResponse(NodePropertiesResponse.class);
response.systemProperties = collectProperties(name);
return response;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will open a seperate JIRA for saying "lets look at cahcing for admin v2 apis".

IMO we're not really consistent on the v1 side either, so I'd use a broader scope of: "Re-evaluate use of caching headers in all Solr APIs". We may decide to rip them out across the board, who knows 🤷

rsp.setHttpCaching(false);
String name = req.getParams().get(NAME);
Map<String, String> props =
new GetNodeProperties(getCoreContainer(req)).collectProperties(name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[-1] Unless I'm missing something, you shouldn't need this. See V2ApiUtils's "squash" methods instead - they're already built specifically to convert between our typed POJOs and the "NamedList" that v1 APIs unfortunately require.


NodePropertiesResponse rsp = fetchProperties(null);

assertTrue("expected more than one system property", rsp.systemProperties.size() > 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0] Feel free to ignore, but IMO assertEquals should be used where possible. Even when you give assertTrue a custom message, like you've done here, it loses some information that assertEqual would print out (e.g. the actual value of systemProperties.size()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched it to assertEquals on the property count :)


The Java Properties screen, however, provides easy access to all the properties of the JVM running Solr, including the classpaths, file encodings, JVM memory settings, operating system, and more.

The same information is available from the Node Properties API: `GET /solr/admin/info/properties` (v1) or `GET /api/node/properties` (v2).

@gerlowskija gerlowskija Aug 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L72 above mentions /admin/info/system as a way to get related JVM information. Maybe this content would fit in a bit better up there, instead of in this section focused mainly on the Admin UI screen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the API note up next to /admin/info/system. thanks!

Signed-off-by: prithvi <prithvisivasankar@gmail.com>
@iprithv
iprithv requested a review from gerlowskija August 26, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:api documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants