Thanks for the report. This sounds like a bug. At least on startup, we should refresh the configuration from ZK without looking at local config versions. Can you please open a Jira issue?
On Wed, May 23, 2018 at 5:35 PM, Gael Jourdan-Weil < gael.jourdan-w...@kelkoogroup.com> wrote: > Hello everyone, > > We are running a SolrCloud cluster with ZooKeeper. > This SolrCloud cluster is down most of the time (backup environment) but > the ZooKeeper instances are always up so that we can easily update > configuration. > > This has been working fine for a long time with Solr 6.4.0 then 6.6.0, but > since upgrading to 7.2.1, we ran into an issue where Solr ignores > aliases.json stored in ZooKeeper. > > Steps to reproduce the problem: > 1/ SolrCloud cluster is down > 2/ Direct update of aliases.json file in ZooKeeper with Solr ZkCLI > *without using Collections API* : > java ... org.apache.solr.cloud.ZkCLI -zkhost ... -cmd clear /aliases.json > java ... org.apache.solr.cloud.ZkCLI -zkhost ... -cmd put /aliases.json > "new content" > 3/ SolrCloud cluster is started => aliases.json not taken into account > > Digging a bit in the code, what is actually causing the issue is that, > when starting, Solr now checks for the metadata of the aliases.json file > and if the version metadata from ZooKeeper is lower or equal to local > version, it keeps the local version. > When it starts, Solr has a local version of 0 for the aliases but > ZooKeeper also has a version of 0 of the file because we just recreated it. > So Solr ignores ZooKeeper configuration and never has a chance to load > aliases. > > Relevant parts of Solr code are: > - https://github.com/apache/lucene-solr/blob/branch_7_2/ > solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java : > line 4562 : method setIfNewer > - https://github.com/apache/lucene-solr/blob/branch_7_2/ > solr/solrj/src/java/org/apache/solr/common/cloud/Aliases.java : line 45 : > the "empty" Aliases object with default version 0 > > Obviously, a workaround is to force ZooKeeper to have a version greater > than 0 for aliases.json file (for instance by not clearing the file and > just overwriting it again and again). > > > But we were wondering, is this the intended behavior for Solr ? > > Thanks for reading, > > Gaƫl -- Regards, Shalin Shekhar Mangar.