Skip to content

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Feb 7, 2026

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

Description

Deprecated method

Solution

Simple inline of code call.

Tests

All pass

Checklist

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to eliminate usage of the deprecated SolrQueryRequest#getCloudDescriptor() method by inlining the underlying call chain.

Changes:

  • Removes the deprecated getCloudDescriptor() default method from SolrQueryRequest.
  • Updates DelegatingSolrQueryRequest#getCloudDescriptor() to inline the call chain instead of delegating.
  • Replaces req.getCloudDescriptor() usage in HttpShardHandler with the inlined call chain.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java Deletes the deprecated getCloudDescriptor() method from the public request interface.
solr/core/src/java/org/apache/solr/request/DelegatingSolrQueryRequest.java Stops overriding/delegating the removed interface method and inlines the call chain.
solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java Replaces deprecated req.getCloudDescriptor() call with an inlined req.getCore().getCoreDescriptor().getCloudDescriptor() chain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 184 to 190
default CoreContainer getCoreContainer() {
SolrCore core = getCore();
return core == null ? null : core.getCoreContainer();
}

/**
* @deprecated use getCore().getCoreDescriptor().getCloudDescriptor()
*/
@Deprecated
default CloudDescriptor getCloudDescriptor() {
return getCore().getCoreDescriptor().getCloudDescriptor();
}

/** The writer to use for this request, considering {@link CommonParams#WT}. Never null. */
default QueryResponseWriter getResponseWriter() {
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Removing SolrQueryRequest#getCloudDescriptor() is a source/binary incompatible API change on a public interface and also breaks current in-repo implementations that still override it (e.g., CoordinatorHttpSolrCall has an @OverRide getCloudDescriptor method). If the goal is only to eliminate deprecated call sites, keep the deprecated default method and update callers; if the goal is full removal, all remaining overrides/callers (including CoordinatorHttpSolrCall) must be updated in this PR.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, I followed up on this.

Comment on lines 161 to 164

@Override
public CloudDescriptor getCloudDescriptor() {
return delegate.getCloudDescriptor();
return delegate.getCore().getCoreDescriptor().getCloudDescriptor();
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

DelegatingSolrQueryRequest still declares getCloudDescriptor(), but SolrQueryRequest no longer defines this method. This leaves a surprising extra public API on a class described as delegating the SolrQueryRequest interface. Either remove this method (and its CloudDescriptor import) or formally keep it as part of SolrQueryRequest (deprecated) so the delegation contract remains consistent.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I sorted this!


CoreDescriptor coreDescriptor = req.getCore().getCoreDescriptor();
CloudDescriptor cloudDescriptor = req.getCloudDescriptor();
CloudDescriptor cloudDescriptor = req.getCore().getCoreDescriptor().getCloudDescriptor();
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

This line duplicates the already-computed coreDescriptor and repeats req.getCore().getCoreDescriptor(). Prefer using the existing local variable (coreDescriptor.getCloudDescriptor()) to avoid redundant calls and keep the code consistent with the surrounding style.

Suggested change
CloudDescriptor cloudDescriptor = req.getCore().getCoreDescriptor().getCloudDescriptor();
CloudDescriptor cloudDescriptor = coreDescriptor.getCloudDescriptor();

Copilot uses AI. Check for mistakes.
Comment on lines 184 to 190
default CoreContainer getCoreContainer() {
SolrCore core = getCore();
return core == null ? null : core.getCoreContainer();
}

/**
* @deprecated use getCore().getCoreDescriptor().getCloudDescriptor()
*/
@Deprecated
default CloudDescriptor getCloudDescriptor() {
return getCore().getCoreDescriptor().getCloudDescriptor();
}

/** The writer to use for this request, considering {@link CommonParams#WT}. Never null. */
default QueryResponseWriter getResponseWriter() {
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

PR description says this is a "simple inline" of a deprecated call, but this diff also removes the deprecated method from SolrQueryRequest entirely. If method removal is intended, the PR description (and any deprecation/removal policy docs/release notes) should reflect that broader API change.

Copilot uses AI. Check for mistakes.
@dsmiley
Copy link
Contributor

dsmiley commented Feb 7, 2026

See JIRA issue

@dsmiley dsmiley closed this Feb 7, 2026
@epugh
Copy link
Contributor Author

epugh commented Feb 7, 2026

I'm going to reopen this so you can see the furthur commits, and then if we decide not to move forward then I'll remove the deprecation tag and close it...

@dsmiley dsmiley changed the title SOLR-18106: inline deprecated call SOLR-18106: remove SolrQueryRequest.getCloudDescriptor() Feb 9, 2026
@epugh
Copy link
Contributor Author

epugh commented Feb 10, 2026

@dsmiley thanks for the better title! Is there some sort of investigation that needs to be done before this can be merged? We can leave it open obviously for a few days, but is there anyone who we specifically need to chase to review this?

@dsmiley
Copy link
Contributor

dsmiley commented Feb 10, 2026

@patsonluk for your review please

@patsonluk
Copy link
Contributor

Thanks @dsmiley ! I will take a look tomorrow. I see the concern you all discussed in https://issues.apache.org/jira/browse/SOLR-18106?focusedCommentId=18057106&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-18057106

Need to revisit to code and see whether the absence of modified CloudDescriptor would still work properly for coordinator node setup( I believe the core in the req for coordinator node would not have the correct info, but i don't quite remember all the details 😓 )

@patsonluk
Copy link
Contributor

patsonluk commented Feb 11, 2026

TL;DR:
Yes. We probably need some additional change in order to have CoordinatorHttpSolrCall to work with this change

Details:
By debugging, it's shown this change right now would cause some issues in HttpShardHandler#prepDistributed as suspected.

This is because CoordinatorHttpSolrCall only wraps the request by providing an overriding getCloudDescriptor with info of the actual core (with collection name, replica type and core shard ID replaced with the actual core info, instead of the synthetic core). Which means with this current change, getting CloudDescriptor from the CoreDescroptor would have returned the synthetic core with incorrect collection name (of the Synthetic core/collection)

Perhaps in CoordinatorHttpSolrCall, we will need to instead override getCore to return a wrapped SolrCore and CoreDescriptor that its getCloudDescriptor would return the modified cloud description from the coordinator code?

Not sure if I missed out any obvious details here 😓

@epugh
Copy link
Contributor Author

epugh commented Feb 11, 2026

TL;DR: Yes. We probably need some additional change in order to have CoordinatorHttpSolrCall to work with this change

Details: By debugging, it's shown this change right now would cause some issues in HttpShardHandler#prepDistributed as suspected.

This is because CoordinatorHttpSolrCall only wraps the request by providing an overriding getCloudDescriptor with info of the actual core (with collection name, replica type and core shard ID replaced with the actual core info, instead of the synthetic core). Which means with this current change, getting CloudDescriptor from the CoreDescroptor would have returned the synthetic core with incorrect collection name (of the Synthetic core/collection)

Perhaps in CoordinatorHttpSolrCall, we will need to instead override getCore to return a wrapped SolrCore and CoreDescriptor that its getCloudDescriptor would return the modified cloud description from the coordinator code?

Not sure if I missed out any obvious details here 😓

Can we make sure to add a test that fails with this change? I worry as I do refactoring, that without David's sharp eyes, something like this would be merged based on the tests passing ;-).

@patsonluk I hope you have some time to get the changes made, feel free to push to this branch. I'm really pushing hard to remove deprecated code from Solr, and this is one of them!

@dsmiley
Copy link
Contributor

dsmiley commented Feb 11, 2026

+100 to the test.

And I confess (again) that this deprecation of mine may be premature... there's no clear substitute right now. Your idea of returning a getCore with a custom core descriptor is a plausible solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants