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

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   Draft status is due to Nick Shanin's open-PR cap; the change is complete and 
ready for review.
   
   https://issues.apache.org/jira/browse/SOLR-18606
   
   ## What happens today
   
   **A newly created collection can be rejected by a client with a stale 
ZooKeeper view.**
   
   The ZooKeeper cluster-state provider returns no collection state when its 
local view has not yet learned of the collection. CloudSolrClient can then 
report ["Collection not found" before sending the 
request](https://github.com/apache/solr/blob/b771587e9707c49847d728fd1f3ff259a182692c/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java#L647-L653).
   
   ## What this change does
   
   **Refresh missing collection state while keeping known aliases off the 
refresh path.**
   
   [The ZooKeeper 
provider](https://github.com/nick-boss-tech/solr/blob/29caa4258ff8b9def71db25d48bfe07c5ddcbb48/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java#L82-L103)
 checks its local collection and alias views first, then forces a collection 
refresh on a miss. It propagates ZooKeeper failures and restores the interrupt 
flag when interrupted. Known alias names avoid the repeated forced lookup that 
caused SOLR-17275.
   
   ## Proof
   
   **The new tests cover a stale ZooKeeper collection view and the known-alias 
refresh guard.**
   
   <details>
   <summary>Linux verification at 
29caa4258ff8b9def71db25d48bfe07c5ddcbb48</summary>
   
   On 2026-11-09 with JDK 21 and seed `18606CAFE`, all 36 tests passed with no 
skips:
   
   - `ZkStateReaderTest`: 19 tests, including the three new provider tests.
   - `AliasIntegrationTest`: 9 tests.
   - `CloudSolrClientCacheTest` and `CloudSolrClientRoutingTest`: 8 tests.
   
   The new collection test failed on the base at the missing-reference 
assertion. Removing the alias guard caused the alias test to fail because a 
forced refresh was called. `./gradlew tidy` and `./gradlew check -x test` 
passed; the root check used a clean normal clone after Antora rejected the 
linked worktree's `.git` pointer.
   
   </details>
   
   ## A choice to check
   
   **I recommend refreshing client state on a miss.**
   
   Forwarding an unknown collection request to a live node is the other 
approach discussed on the issue. Refreshing the client view retains normal 
client routing when ZooKeeper has the collection, at the cost of a ZooKeeper 
lookup on a miss. Does this choice look right?
   
   ## Limits
   
   **Unknown names can still trigger repeated lookups, and the alias view is 
not forcibly refreshed.**
   
   The real ZooKeeper test checks provider discovery, not an end-to-end client 
request. The known-alias test counts refresh calls and is not a latency 
benchmark. A stale alias view and repeated requests for nonexistent names 
remain outside this change; I can open follow-up issues if useful.
   
   Changelog: 
[SOLR-18606.yml](https://github.com/nick-boss-tech/solr/blob/29caa4258ff8b9def71db25d48bfe07c5ddcbb48/changelog/unreleased/SOLR-18606.yml)
   
   *AI-generated description. 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