I think the current tests probably build the cloudsolrserver before creating 
the aliases - sounds like we need to do some creating the cloudsolrserver after.

- Mark

On Apr 2, 2013, at 1:31 PM, Mark Miller <markrmil...@gmail.com> wrote:

> Answers inline:
> 
> On Apr 2, 2013, at 11:45 AM, Elodie Sannier <elodie.sann...@kelkoo.fr> wrote:
> 
>> Hello,
>> 
>> I am using the new collection alias feature, and it seems
>> CloudSolrServer class (solrj 4.2.0) does not allow to use it, either for
>> update or select.
>> 
>> When I'm requesting the CloudSolrServer with a collection alias name, I
>> have the error:
>> org.apache.solr.common.SolrException: Collection not found:
>> aliasedCollection
>> 
>> The collection alias cannot be found because, in
>> CloudSolrServer#getCollectionList (line 319) method, the alias variable
>> is always empty.
>> 
>> When I'm requesting the CloudSolrServer, the connect method is called
>> and it calls the ZkStateReader#createClusterStateWatchersAndUpdate method.
>> In the ZkStateReader#createClusterStateWatchersAndUpdate method, the
>> aliases are not loaded.
>> 
>> line 295, the data from /clusterstate.json are loaded :
>> ClusterState clusterState = ClusterState.load(zkClient, liveNodeSet);
>> this.clusterState = clusterState;
>> 
>> Should we have the same data loading from /aliases.json, in order to
>> fill the aliases field ?
>> line 299, a Watcher for aliases is created but does not seem used.
> 
> The Watcher is used. It updates the Aliases if they changed - there is some 
> lag time though. There is some work that tries to avoid the lag in the update 
> being a problem, but I'm guessing somehow it's not covering your case. 
> 
> It wouldn't hurt to add the updateAliases call automatically on ZkStateReader 
> init. If the watcher was indeed not being used, that would not solve things 
> though - the client still needs to be able to detect alias additions and 
> changes.
> 
> Your best bet is to file a JIRA issue so we can work on a test that mimics 
> what you are seeing.
> 
> - Mark
> 
>> 
>> 
>> As a workaround to avoid the error, I have to force the aliases loading
>> at my application start and when the aliases are updated:
>> CloudSolrServer solrServer = new CloudSolrServer("localhost:2181");
>> solrServer.setDefaultCollection("aliasedCollection");
>> solrServer.connect();
>> solrServer.getZkStateReader().updateAliases();
>> 
>> Is there a better way to use collection aliases with solrj ?
>> 
>> Elodie Sannier
>> 
>> Kelkoo SAS
>> Société par Actions Simplifiée
>> Au capital de € 4.168.964,30
>> Siège social : 8, rue du Sentier 75002 Paris
>> 425 093 069 RCS Paris
>> 
>> Ce message et les pièces jointes sont confidentiels et établis à l'attention 
>> exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce 
>> message, merci de le détruire et d'en avertir l'expéditeur.
> 

Reply via email to