feat(compat): add Solr 10 support with /admin/metrics migration#59
Closed
adityamparikh wants to merge 16 commits intoapache:mainfrom
Closed
feat(compat): add Solr 10 support with /admin/metrics migration#59adityamparikh wants to merge 16 commits intoapache:mainfrom
adityamparikh wants to merge 16 commits intoapache:mainfrom
Conversation
Replace the default BinaryResponseParser (wt=javabin) with a custom JsonResponseParser (wt=json) for future-proofing and improved debuggability. The JsonResponseParser converts Solr's JSON response envelope into the NamedList<Object> tree that SolrJ typed response classes expect: - JSON objects → SimpleOrderedMap (extends NamedList, implements Map, satisfying both QueryResponse's NamedList casts and SchemaResponse's Map cast) - JSON objects with numFound+docs → SolrDocumentList - Flat alternating arrays [String, non-String, ...] → SimpleOrderedMap (Solr's json.nl=flat encoding for facet counts) - All other arrays → List - Decimal numbers → Float (matching JavaBin's float type, required by SchemaResponse's (Float) version cast) - Small integers → Integer, large integers → Long Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Extract JsonResponseParser instantiation into a dedicated @bean method so it can be injected as a dependency into solrClient(), making the wiring explicit and enabling overriding in tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Replace the static new ObjectMapper() with Spring's auto-configured ObjectMapper bean injected via constructor. Use MediaType.APPLICATION_JSON_VALUE for the content type constant instead of a raw string literal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
…'s ObjectMapper Extract URL normalization tests from SolrConfigTest into a dedicated SolrConfigUrlNormalizationTest annotated with @jsontest, so Spring's auto-configured ObjectMapper is injected rather than using new ObjectMapper(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
… Solr 10 SolrInfoMBeanHandler (and thus the /admin/mbeans endpoint) was removed in Solr 10. When getCacheMetrics() or getHandlerMetrics() call this endpoint on a Solr 10 server, SolrJ throws RemoteSolrException (a RuntimeException) because the server returns an HTML 404 page instead of JSON. Widen the catch in both methods to include RuntimeException so the server degrades gracefully (returning null for cache/handler stats) rather than propagating the exception. The integration tests already handle null stats, so all tests now pass with solr:10-slim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Add Solr 9.10 and 10 to the CI compatibility matrix, running integration tests against all supported versions (8.11, 9.4, 9.9, 9.10, 10) on every PR and push to main. Also update AGENTS.md to document Solr 10 compatibility status: the /admin/mbeans endpoint removal is handled gracefully, and all other functionality is verified working with solr:10-slim. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
4 tasks
adityamparikh
added a commit
to adityamparikh/solr-mcp
that referenced
this pull request
Mar 8, 2026
…o sb4 Incorporates: - feat(config): switch Solr wire format from JavaBin to JSON (apache#55) - fix(collection): catch RuntimeException from removed /admin/mbeans in Solr 10 (apache#59) - feat(ci): add Solr 9.10 and 10 compatibility testing (apache#59) - feat(deps): upgrade solr-solrj from 9.9.0 to 10.0.0 (apache#58) Adapted JsonResponseParser for Jackson 3 (tools.jackson.databind). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Move CollectionService, CollectionUtils, and Dtos from the metadata package into a new dedicated collection package. This separates collection management from schema introspection (SchemaService stays in metadata). Add create-collection MCP tool to CollectionService: - Accepts name (required), configSet, numShards, replicationFactor - Defaults: configSet=_default, numShards=1, replicationFactor=1 - Uses CollectionAdminRequest.createCollection() for both SolrCloud and standalone Solr via Http2SolrClient - Returns CollectionCreationResult DTO with name, success, message, and createdAt timestamp Add CollectionCreationResult record to Dtos.java. Update unit tests with correct 2-arg Mockito stubs to match CollectionAdminRequest.process() call signature. Add integration test asserting the new collection appears in listCollections() after creation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
116 session documents covering all tracks and days (March 4-6 2026) for use with the create-collection and index-documents MCP tools. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
- Add isBlank() guard in createCollection() to throw IllegalArgumentException before calling SolrJ, ensuring consistent behavior regardless of SolrJ version - Update README: add create-collection to feature list, fix all tool names to kebab-case, split into Search/Indexing/Collections/Schema sections, list all three indexing tools separately Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Add @PreAuthorize("isAuthenticated()") to the createCollection method to prevent unauthorized collection creation via the MCP tool, consistent with the pattern used in SearchService and IndexingService. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
- Remove unnecessary local variable in validateCollectionExists (S1488) - Add private constructor to CollectionUtils utility class (S1118) Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <adityamparikh@gmail.com>
epugh
reviewed
Mar 24, 2026
Contributor
There was a problem hiding this comment.
do we need all three exceptions?
Merge upstream/main into solr-10 branch. Adopt consolidated parameterized test with try-with-resources for URL normalization, removing duplicate individual test methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Trivial conflict: unused exception variable naming (e vs _) in catch blocks for getCacheMetrics and getHandlerMetrics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
…trics API Replace the deprecated /admin/mbeans endpoint with the Solr Metrics API (/admin/metrics) for cache and handler statistics. The Metrics API is node-level, so fetchMetrics now searches for the matching core registry by prefix. Cache metrics remain nested NamedList objects while handler metrics use flat dotted keys (e.g. QUERY./select.requests), requiring separate extraction logic. Key changes: - fetchMetrics uses /admin/metrics with group=core and prefix filtering - Handler extraction refactored to read flat keys via extractFlatHandlerInfo - Core registry matching uses trailing dot to prevent false prefix matches - Remove unused AVG_TIME_PER_REQUEST_FIELD and AVG_REQUESTS_PER_SECOND_FIELD - Add integration tests for cache and handler metrics against real Solr - Remove dead test helper createCompleteMockCacheData Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
4 tasks
Contributor
Author
|
Consolidating into #61 which now includes all changes from this PR plus code review fixes (ClassCastException fix in getFloat, shard name support in checkHealth, redundant validation elimination, test improvements). |
Contributor
Author
|
Closed in favor of #61 which consolidates this work with code review fixes. |
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.
Summary
Verifies that the JSON wire format (introduced in #55) works correctly with Solr 10, migrates metrics collection from the deprecated
/admin/mbeansendpoint to the/admin/metricsAPI, and extends the CI matrix to cover all supported versions.solr:10-slimusing the JSON wire format (no JavaBin)getCacheMetrics()andgetHandlerMetrics()inCollectionServicenow use/admin/metrics(available since Solr 7.1+) instead of/admin/mbeans(removed in Solr 10). All MBeans code has been removed.build-and-publish.ymlnow tests against Solr 8.11, 9.4, 9.9, 9.10, and 10 on every PR and push to mainAGENTS.mdupdated to reflect Solr 10 as a tested, supported versionPR chain
feat/json-wire-format→main(JSON wire format)solr-10→main(this PR: Solr 10 compat, built on feat(config): switch Solr wire format from JavaBin to JSON #55)solrj-10→main(SolrJ 10 upgrade, built on feat(compat): add Solr 10 support with /admin/metrics migration #59)Merge in order. After #55 merges, this PR will show only the Solr 10-specific commits.
Changes
CollectionService.java/admin/mbeanscode (constants, request building, response parsing)/admin/metricsAPI integration withGenericSolrRequestfor cache and handler metricsNamedListandLinkedHashMapresponse types from SolrJ deserializationCollectionServiceIntegrationTest.javaassertNotNullassertions for cache stats (queryResultCache, documentCache, filterCache) and handler stats (selectHandler, updateHandler)CollectionServiceTest.javaIndexingService.java,SchemaService.java,JsonUtils.java.github/workflows/build-and-publish.ymlNew
solr-compatibilityjob with matrix strategy testing Solr 8.11, 9.4, 9.9, 9.10, and 10.AGENTS.mdUpdated Solr 10 section:
/admin/mbeansno longer used,/admin/metricsworks on Solr 9 and 10.Test plan
./gradlew buildpasses (default Solr 9.9)./gradlew test -Dsolr.test.image=solr:10-slimpasses./gradlew test -Dsolr.test.image=solr:9.10-slimpasses🤖 Generated with Claude Code