nick-boss-tech opened a new pull request, #5078: URL: https://github.com/apache/solr/pull/5078
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-6065 ## What happens today **A full index is reported as a possible analysis error, with a 400.** Lucene throws an `IllegalArgumentException` when an index holds its maximum number of documents. The message starts with "number of documents in the index cannot exceed". The update handler maps every `IllegalArgumentException` to BAD_REQUEST with the text "possible analysis error" ([generic mapping](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L442-L448)). The client is told the document is at fault, when the index is full. ## What this change does **The max-docs case in `addDoc` returns SERVER_ERROR, with a message that names the limit.** - `addDoc` checks whether the message starts with the Lucene prefix. A match throws a 500 that names the document, the limit, and the Lucene message ([check](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L422-L437)). - The message advises deleting documents and optimizing, or splitting the shard. It notes that deleted documents still count until they are merged away. - Behavior change: the status for this condition moves from 400 to 500. Other `IllegalArgumentException`s keep the old mapping. ## Proof **A new cloud test fails on the base code and passes with this change.** - `MaxDocsLimitCloudTest` 1 of 1 passes with this change ([test](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/solr/core/src/test/org/apache/solr/cloud/MaxDocsLimitCloudTest.java#L81-L120)). On the base production code, the same test fails with the old 400 response. - `DirectUpdateHandlerTest` 8 of 8 pass, including the single-core `testMaxDocsExceededGivesClearError` ([test](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java#L108-L140)). - The module check is clean. - Verified 2026-10-09 at this head. ## A choice to check **The max-docs case returns 500 (SERVER_ERROR), not 400 (BAD_REQUEST).** The branch returns 500, as decided on 2026-10-06. A Lucene capacity limit is a server condition. The alternative is 400, which keeps the status for this case and changes only the message. That alternative was not taken. The cost of 500 is a status change for this case. A client that retries on 5xx may retry an add that cannot succeed until the index changes. ## Limits - Only `addDoc` maps the message. Other write paths, such as the merge path that calls `addIndexes` ([line](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L784)), are not mapped. Whether they can reach the same limit was not traced. - Recognition uses the message text, for the Lucene version pinned in `gradle/libs.versions.toml` ([pin](https://github.com/nick-boss-tech/solr/blob/3d2cec9e1ab3a19f6b948682b116c2780da4b65b/gradle/libs.versions.toml#L39)). A Lucene rewording makes the test fail. - The message keeps the wording "Delete documents and optimize". Whether to keep it is open for review. - The tests set Lucene's document limit through a reflective call to a package-private setter, and restore it in a finally block. Changelog: `changelog/unreleased/SOLR-6065-max-docs-message.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]
