> On 8 Jul 2021, at 7:00 PM, Reej M <reej...@gmail.com> wrote:
> 
> Hi All,
> 
> We are upgrading from solr 4 to solr 8. Updated the solr server to solr8.8.2, 
> solrj8.8.2.
> We are trying to resume the code and in one place where we are trying to get 
> a collection from clusterstate. Code used is as below
> 
> Clusterstate clusterState = null;
> For(SearchSolrZookeeper zk:livezks){
> SolrZkClient zkClient = null;
> ZKStateReader stateReader = null;
> Try{
>    Zkclient = new SolrZkClient(zk.getUrl(), 3000);
>    stateReader = new ZKStateReader(Zkclient);
>    stateReader.createClusterStateWatchersAndUpdate();
>    clusterState = stateReader.getClusterState();
>    Connected = true;
>    Exception = null;
>    break;
> }
> Catch(){
> }
> Finally{
> State reader.close();
> Zkclient.close();
> }
> 
> If(clusterstate!=null){
> Doccollection dc = clusterstate.getCollection(“INVOICE”);
> //here dc is null
> }
> }
> 
> 
> Tried using getcollectionornull - returns null
> Getcollectionornull(collection name, true) — returns null
> 
> When I debug I can see clusterstate has below values in it
> 
Using SOLR8

> Znodeversion:0
> Live node:[192.123.33.44:3883_Solr, 
> 192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE= 
> LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}

When Debugging with Solr4 clusterstate is as below
> Znodeversion:134
> Live node:[192.123.33.44:3883_Solr, 
> 192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> Collections:{ORDER(ORDER/clusterstate.json/134)={
“Replication factor”:”1”,
“Shards”:{“shard1”:{
Range:
“State”:”active”,
“Replicas”:{
“Core_node1”:{
“Core”:ORDER_shard1_replica1
“Base_url:
“Node_name”:”http://xxxx_solr <http://xxxx_solr/>”
“State”:”active”
“Leader”:”true”},
“Core_node2”:{
“Core”:ORDER_shard1_replica1
“Base_url:
“Node_name”:”http://xxxx_solr <http://xxxx_solr/>”
“State”:”active”
“Leader”:”true”}
}
}
> 
> From the document collection we get the slices and iterate each replica to 
> show the cores in a admin page. But this page worked fine with the code in 
> solr4, now with solr8 it throws error.




> Kindly help. 
> 
> Regards
> Reej

Reply via email to