Tuesday, July 9, 2013

Mismatched Solr 4.x versions with SolrCloud

I wanted to run a Solr 4.0 client against a more modern Solr server (like Solr 4.3.1 - shard splitting!).  While we should match client and server versions, it's not unheard of to float a little bit.  4.0 to 4.3.1 is more than a little bit but I wanted to get Lily to work against 4.3.1 - notsomuch.

You'll likely get an error like this in the Solr ClusterState code:

org.apache.solr.common.cloud.ZkStateReader: Updating cluster state from ZooKeeper... 
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map 

So something changed with the way the cluster is recorded in ZK/Solr.  I encountered this again by accident when I forgot to update the Solrj version in my app's POM (again, trying to run a 4.0 client against a 4.3+ server).

This is probably only an issue with SolrCloud so remaining Solr classic users likely aren't affected.  But if you're not using SolrCloud yet, you should take a look.