[ 
https://issues.apache.org/jira/browse/SOLR-13239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18122093#comment-18122093
 ] 

Nick Shanin commented on SOLR-13239:
------------------------------------

🤖 AI text below 🤖 (posted on behalf of Nick Shanin)

I have been looking at this ticket and have a draft patch on a branch 
(solr-13239-submit) that stops ZkStateReader.getCurrentCollections() from 
reporting collections whose state has not been published yet, but I am holding 
it rather than opening a PR.

On review, the approach resolves lazy collection references synchronously while 
the collection-set notification lock is held, so a slow or failing ZooKeeper 
read could delay or break notifications for unrelated collections. That 
trade-off needs a redesign, most likely resolving the state outside the lock or 
recording only validated state as it arrives, and I do not want to propose the 
current shape.

The branch is kept for reference. Happy to pick this back up or hand it over if 
someone has a preferred direction.

> CollectionStateWatcher reports new collections before they really exist
> -----------------------------------------------------------------------
>
>                 Key: SOLR-13239
>                 URL: https://issues.apache.org/jira/browse/SOLR-13239
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>    Affects Versions: 7.6
>            Reporter: Hendrik Haddorp
>            Priority: Major
>
> A CollectionStateWatcher registered via 
> org.apache.solr.common.cloud.ZkStateReader.registerCloudCollectionsListener 
> gets invoked as soon as the CloudSolrClient detects a new collection. This is 
> based on having a watch on the /collections znode. When the 
> CollectionStateWatcher tries to read out information about the new collection 
> via zkStateReader.getClusterState() there is a good chance that no 
> DocCollection can be found. The reason for that is that a DocCollection is 
> based on the state.json below the collection. As this znode is below the 
> collection znode it does need to be created a bit later. So there is a race 
> condition.
> One can run into the same problem if one tries to register a 
> CollectionStateWatcher via ZkStateReader.registerCollectionStateWatcher 
> straight after a new collection is found. The watcher is then being invoked 
> with the DocCollection set to null as it also can not find the DocCollection 
> object. Null does however indicate that the collection was being deleted.
> see also the mail thread about this:
> https://www.mail-archive.com/[email protected]&q=subject:%22Re%5C%3A+CloudSolrClient+getDocCollection%22&o=newest&f=1



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to