nick-boss-tech opened a new pull request, #5080:
URL: https://github.com/apache/solr/pull/5080

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-7022
   
   ## What happens today
   
   **An interrupt while a commit waits for the new searcher is logged as an 
error.**
   
   A commit with `waitSearcher` waits for the new searcher to register. If the 
waiting thread is interrupted, the base code logs `Exception waiting for 
searcher` at ERROR, with a stack trace. The interrupt status is cleared, and 
the commit then returns normally. The same block also handles a failed searcher 
registration, so both cases were logged the same way.
   
   ## What this change does
   
   **An interrupted wait is logged at INFO and the interrupt status is 
restored. The commit still returns normally.**
   
   - The wait moves into a package-private helper, `awaitSearcher` 
([DirectUpdateHandler2.java#L951-L960](https://github.com/nick-boss-tech/solr/blob/db357868610b92709335129ebada4646ecf11e26/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L951-L960)).
 It is called from the commit path at 
[#L943](https://github.com/nick-boss-tech/solr/blob/db357868610b92709335129ebada4646ecf11e26/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java#L943).
   - On an interrupt, the helper restores the interrupt status and logs at 
INFO. A failed registration (`ExecutionException`) is still logged at ERROR.
   - When the wait is interrupted, `commit` returns normally, as it did on 
base. The new searcher may not be registered yet when it returns.
   - There is no public API change.
   
   ## Proof
   
   **The gate ran at `6a233ab2fdb`. The live tip has two later wording commits 
and was never gated.**
   
   - Gate run 2026-10-06 at `6a233ab2fdb`. Focused tests: 
`DirectUpdateHandler2AwaitSearcherTest` 2 of 2, 
`DirectUpdateHandler2CommitWaitTest` 1 of 1, `DirectUpdateHandlerTest` 7 of 7. 
The module check returned 0.
   - The live tip is `db357868610b`, two commits past the gated head: 
`5b822b7e8e9` (changelog title) and `db357868610b` (comment-only Javadoc in 
`DirectUpdateHandler2.java`). Both change wording only. Neither was re-gated.
   - GitHub Actions run `37558668356` finished `success` on `7940e98b0ee0`. 
That is CI on that commit, not a gate of the live tip. The commit sits on 
`origin/ci/7022-commitwait`, one commit above the gated head. It adds one CI 
workflow file and no source change. It is not on the live branch.
   - Test class `DirectUpdateHandler2CommitWaitTest`, test 
[`testCommitWaitsForSearcherAndRestoresInterruptStatus`](https://github.com/nick-boss-tech/solr/blob/db357868610b92709335129ebada4646ecf11e26/solr/core/src/test/org/apache/solr/update/DirectUpdateHandler2CommitWaitTest.java#L93-L161).
 It blocks the searcher, interrupts the waiting commit, and checks that the 
commit returns without error with the interrupt status restored. On the 
untouched base, the test fails exactly once, at the interrupt-restored 
assertion.
   
   ## A choice to check
   
   **Return normally after an interrupted wait, or report the interrupt to the 
caller as an error.**
   
   The implemented route returns normally and restores the interrupt status. 
The alternative reports the interrupt as an error, so the commit would not 
return success in that case. Was returning normally the right call?
   
   ## Limits
   
   - The commit-level test is timing-sensitive. It relies on a single-threaded 
searcher executor and short joins, and it has not been checked for seed 
sensitivity.
   - Two test classes cover a small change. A maintainer may prefer one of them.
   
   Changelog: `changelog/unreleased/SOLR-7022-interrupted-searcher-wait.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]

Reply via email to