nick-boss-tech opened a new pull request, #5141: URL: https://github.com/apache/solr/pull/5141
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-8009 ## What happens today **A real-time get with no `_route_` finds nothing on an implicit-router collection, even when the document is stored.** On a collection that uses the implicit router, `/get?id=<id>` with no `_route_` and no `shards` parameter returns no document. The distributed path in `RealTimeGetComponent.createSubRequests` asks the router for a slice for each id. The implicit router returns no slice when there is no route, and the code skips the id ([base code](https://github.com/nick-boss-tech/solr/blob/14c7aac0d151402b00259e2fb9bf5eed7049ec5d/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java#L1065-L1067)). The Jira report describes a NullPointerException on an older release. On this base the request returns an empty result with no error. ## What this change does **An unrouted id on an implicit-router collection is now sent to every shard.** - Ids with no slice are collected only when the collection uses the implicit router ([RealTimeGetComponent.java](https://github.com/nick-boss-tech/solr/blob/8795661ddc98c8bffdb8db49a7dd5f293216e929/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java#L1067-L1076)). - They go out in one more request to all shards ([RealTimeGetComponent.java](https://github.com/nick-boss-tech/solr/blob/8795661ddc98c8bffdb8db49a7dd5f293216e929/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java#L1097-L1103)). That is the same request the code already builds when `shards` is given ([RealTimeGetComponent.java at the base commit](https://github.com/nick-boss-tech/solr/blob/14c7aac0d151402b00259e2fb9bf5eed7049ec5d/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java#L1088-L1093)). - Other routers do not change. ## Proof **`FullSolrCloudDistribCmdsTest.testRealTimeGetImplicitRouterWithoutRoute` fails on the base code and passes with this change.** - The new test builds a two-shard implicit collection, adds one document to each shard, and checks a get by one id and a get by two ids with no route ([FullSolrCloudDistribCmdsTest.java](https://github.com/nick-boss-tech/solr/blob/8795661ddc98c8bffdb8db49a7dd5f293216e929/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java#L157-L184)). On the base commit `14c7aac0d15`, the first `assertNotNull` fails because the get returns nothing. - Verified 2026-10-05 at head `8795661ddc98`: FullSolrCloudDistribCmdsTest 10 of 10; TestRealTimeGet 4 of 4; TestRandomFlRTGCloud 2 of 2; TestAddFieldRealTimeGet 1 of 1. All pass. ## A choice to check **An unrouted get on an implicit collection fans out to every shard. The other option was to fail it.** - Implemented: fan out, so the document is found wherever it is. The cost is one request to each shard for every unrouted get, which is slower than a routed get. - Alternative: return a 400 that asks the caller to send `_route_` or `shards`. Callers that now get an empty result would get an error instead. Was fanning out the right call here, or should an unrouted get fail? ## Limits **Duplicate results and compositeId collections with no route are not fixed here, and two cases have no test.** - An id that sits on more than one shard can come back more than once in a get by several ids. The existing `shards` form does the same, as [SOLR-8954](https://issues.apache.org/jira/browse/SOLR-8954) reports. This change does not fix it. - A get by one id whose document sits on two shards is not tested. - A compositeId collection with a router field and no `_route_` still returns nothing, as before. I can open a follow-up ticket and PR for those on request. - No test covers a shard that has no live replica during the fan-out. Changelog: [changelog/unreleased/SOLR-8009-rtg-implicit-router.yml](https://github.com/nick-boss-tech/solr/blob/8795661ddc98c8bffdb8db49a7dd5f293216e929/changelog/unreleased/SOLR-8009-rtg-implicit-router.yml) ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
