Repository navigation
feat(cluster): return get-cluster-status and list-configsets as records - #295
Closed
adityamparikh wants to merge 9 commits into
Closed
adityamparikh wants to merge 9 commits into
adityamparikh wants to merge 9 commits into
Conversation
…ster/status Every collection tool reports on one collection, so nothing answered "which replicas are down or recovering, and on which node?" after a rolling restart or scale event, and nothing listed configsets for create-collection. ClusterService adds get-cluster-status (live nodes, every shard and replica, and an issues list), list-configsets, and a solr://cluster/status resource. healthy is computed from replica state and live nodes rather than Solr's own health field, which is computed before Solr cross-checks replicas against live nodes. ClusterStatusParser and its records are public so list-fields (apache#241) can reuse the replica data. The check-health and get-collection-stats descriptions now name jobs distinct from get-cluster-status. A new two-node SolrCloud fixture (external ZooKeeper, pinned as test-image-zookeeper) stops one node and checks that every replica on it is reported with its node. Closes apache#223 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
get-cluster-status and solr://cluster/status now return the cluster section of the response through NamedList.asMap instead of a server-side model. The response shape is the same on Solr 9.4, 9.9, 9.10 and 10.0, and Solr already marks a replica whose node left live_nodes as down, so there was nothing for the MCP server to normalize or recompute. The only thing Solr gets wrong is health: before 10.1 it is computed ahead of that live-node correction (SOLR-17820), so a shard can read GREEN while its only replica is down. The tool description now tells the model to judge by replica state, and that leader can stay true on a replica that is down. This removes ClusterStatusParser, its five records and their native hints, the node-not-live/no-leader rules, the two-node ZooKeeper fixture and the test-image-zookeeper pin. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
…ster tools check-health pings the collection and counts its documents, so it stays healthy while a replica is down: with one shard of two replicas and one node dead, queries still succeed. Its description now says it does not report replica state and names get-cluster-status for that. The create-collection description names list-configsets for picking a configSet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
…down "Stays healthy while a replica is down" was wrong when the down replica is a shard's only one: the query then fails and check-health reports unhealthy. It only stays healthy when another replica can serve the shard. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Resolves the McpClientIntegrationTestBase import conflict with apache#275, and adapts the solr://cluster/status resource to apache#275's removal of JsonUtils: it now logs the failure and throws a fixed-message IllegalStateException with no cause instead of returning {"error": <message>}, so SolrJ failure text (which carries the internal Solr URL) never reaches the client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
When Solr fails, solr://cluster/status must throw the fixed CLUSTER_STATUS_RESOURCE_ERROR with no cause, since MCP reports the root cause's message and SolrJ failure text carries the internal Solr URL. Covers SolrServerException and IOException, the two failures the resource's getClusterStatus call declares. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
get-cluster-status returned CLUSTERSTATUS's cluster section as nested maps and list-configsets a sorted list of names. They now return ClusterStatus (collections, live_nodes) with nested Collection, Shard and Replica records, and ConfigSetList. The records type what the tool description tells the model to read (replica state, leader, node_name; shard state and health; collection health and configName) and compute nothing, so Solr's own values reach the client: the earlier parser's derived healthy/issues fields are not reintroduced. Every other property is kept in a @JsonAnySetter / @JsonAnyGetter catch-all and written back at the same level. leader, which CLUSTERSTATUS sends as the string "true", is a Boolean. Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
|
Contributor
Author
|
Folded into #270, whose branch now includes this commit, so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Stacked on #270 (
get-cluster-status,list-configsets), with currentmainmerged in: review the last commit only.Summary
get-cluster-status,solr://cluster/statusandlist-configsetsreturn records instead of nested maps and a bare list.The records type what the tool description tells the model to read and compute nothing: replica
state,leaderand shard/collectionhealthare Solr's own values, so the derivedhealthy/issuesfields #270 removed are not reintroduced. Every other property is kept in a@JsonAnySetter @JsonAnyGettercatch-all and written back at the same level, so the JSON keeps Solr's keys and a property a later Solr version adds is passed on.One value changes type:
Evidence
ClusterServiceTest.getClusterStatus_coercesLeaderAndKeepsUntypedProperties:"leader":"true"becomes"leader":true;base_url,routerand an unknown top-level section reach the JSON unchanged; nootherkey.ClusterServiceIntegrationTest.recordsTypeWhatTheToolDescriptionTellsTheModelToReadon real SolrCloud: the replica isactive,leaderistrue,node_nameequals the live node,typeisNRT, andbase_url/routerare kept. The existing JSON-path tests pass unchanged apart fromleadernow being a boolean.McpClientIntegrationTestBase.getClusterStatusWritesTheRecordsAsSolrsShape(HTTP and STDIO), through Spring AI's serialization: nootherkey,leaderistrue,node_nameandbase_urlpresent.ClusterServiceTest.listConfigSets_sortsTheNames../gradlew build: 473 tests, 0 failures, 0 skipped../gradlew nativeTest -Pnative: 313 successful, 0 failed; the cluster integration tests and both MCPget-cluster-statuschecks (HTTP and STDIO) pass in the native image. The skipped tests are the@DisabledInNativeImageMockito tests.Merge Danger
Door: two-way
Blast Radius: cluster-consumers
leaderbecomes a boolean, andlist-configsetsreturns{"configSets": [...]}instead of a bare array. Both tools are new in #270, so no released client reads them.🤖 Generated with Claude Code