[ 
https://issues.apache.org/jira/browse/SOLR-8323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Woodward updated SOLR-8323:
--------------------------------
    Attachment: SOLR-8323.patch

Patch outlining the basic idea.

This adds two new interfaces, CollectionStateWatcher and 
CollectionStatePredicate.  The first can be registered for a particular 
collection with ZkStateReader and is called when the state of that collection 
changes (as determined by the internal watcher of that collection's state.json 
node).  The second is used in a new ZkStateReader.waitForState() method, and is 
called on a state change to see if the state of a collection matches a 
predicate.  There are also forwarding methods on CloudSolrClient for use by 
SolrJ clients, and a couple of helper methods on DocCollection and Replica to 
easily check for collection liveness.

The new interfaces lend themselves nicely to use as Java 8 functional 
interfaces, and the TestCollectionStateWatchers test demonstrate both lambdas 
and method references here.

This should make it easy to replace some of the helper methods (eg 
waitForThingsToLevelOut, waitForRecoveriesToFinish) in our tests with methods 
available to SolrJ.

A caveat: this is only implemented for collections with their own state.json.  
I think it should be relatively easy to extend it to stateformat=1 collections 
as well if people think that's worth it.

> Add CollectionWatcher API to ZkStateReader
> ------------------------------------------
>
>                 Key: SOLR-8323
>                 URL: https://issues.apache.org/jira/browse/SOLR-8323
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Alan Woodward
>         Attachments: SOLR-8323.patch
>
>
> An API to watch for changes to collection state would be a generally useful 
> thing, both internally and for client use.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to