diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 0580d2fa105..03ca9f9cd05 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -150,6 +150,9 @@ Bug Fixes * SOLR-4652: Fix broken behavior with shared libraries in resource loader for solr.xml plugins. (Ryan Ernst, Robert Muir, Uwe Schindler) +* SOLR-4664: ZkStateReader should update aliases on construction. + (Mark Miller, Elodie Sannier) + Optimizations ---------------------- diff --git a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java index c9889e935ad..2b191931116 100644 --- a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java @@ -25,6 +25,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; +import org.apache.solr.client.solrj.impl.CloudSolrServer; import org.apache.solr.client.solrj.impl.HttpSolrServer; import org.apache.solr.client.solrj.request.QueryRequest; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -150,6 +151,14 @@ public class AliasIntegrationTest extends AbstractFullDistribZkTestBase { // create alias, collection2 first because it's not on every node createAlias("testalias", "collection2,collection1"); + // search with new cloud client + CloudSolrServer cloudSolrServer = new CloudSolrServer(zkServer.getZkAddress()); + query = new SolrQuery("*:*"); + query.set("collection", "testalias"); + res = cloudSolrServer.query(query); + cloudSolrServer.shutdown(); + assertEquals(5, res.getResults().getNumFound()); + // search for alias with random non cloud client query = new SolrQuery("*:*"); query.set("collection", "testalias"); diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java index b5682c5dc47..258c48e9a9e 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java @@ -340,6 +340,7 @@ public class ZkStateReader { }, true); } + updateAliases(); }