Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17381 SolrJ fix to fetch entire ClusterState if asked #2853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aparnasuresh85
Copy link
Contributor

Description

Address a test failure in ClusterStateProviderTest.testGetClusterStatus when ClusterStateProvider (CSP) chosen is Http2ClusterStateProvider. More importantly, while ClusterStateProvider.getClusterStatus() is highly discouraged, it should still be functional since there are codepaths using it.

Solution

If a call to get CLUSTERSTATUS intending to get collections data specifies a null value for collection parameter, proceed to fetch entire cluster status since fetching the remaining (live_nodes, cluster properties, roles etc) should not be time consuming anyway.

Tests

Ensure ClusterStateProviderTest.testGetClusterState() passes when chosen CSP is Http2ClusterStateProvider. (Currently the test fails with a NPE)

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

minor: These params.set calls are passing "true" | "false" but there's a nice boolean (i.e. a "sugar" method) for the primitive. Could you change that please? It's a minor matter I know but you wrote this code not long ago.

I understand how this change fixes the bug but it feels like the solution optimizes for the smallest possible adequate fix. I look at the method's caller, fetchClusterState. By its name, it should be fetching the cluster's state, but it's kind of working in two modes -- everything or one collection. Can we have fetchClusterState do only the whole cluster (and pass null to submitClusterStateRequest for the request type to signify everything) and have a different/new fetchCollectionState method that only gets the state of one collection, returning a DocCollection? That will be the common code path, and this recommendation I propose would clarify what little work is pertinent to that code path. If this seems like too much, feel free to push back.

Also, I observe that the clusterProperties param is unused (always given null, I mean). Unsure if this is a recent bug/oversight.

@dsmiley dsmiley changed the title Allow the possibility to fetch entire cluster state SOLR-17381 fix to fetch entire cluster state if asked Nov 7, 2024
@dsmiley dsmiley changed the title SOLR-17381 fix to fetch entire cluster state if asked SOLR-17381 SolrJ fix to fetch entire ClusterState if asked Nov 7, 2024
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.

2 participants