On Sat, 2013-10-26 at 02:14 +0200, Chris Hostetter wrote:
> I suspect that the most straight forward way to achieve what you are 
> folks seem to be describing would be to add a hook into the request 
> distribution processing so that you could have a custom plugin used when 
> solr does "Replica r = pickReplica(shardName)" and your implimentation of 
> pickReplica() would look something like (all psuedo code)...
> 
>   List<Replica> allInShard = clusterState.getAllLiveReplicas(shardName)
>   List<Replica> candidates = new List();
>   for (Replica r : allInShard) {
>     if (! r.hasRole("shardIsLastResort") ) {
>       candaites.add(r);
>     }
>   return candaidates.isEmpty() ? allInShard : candidates;

I am not vary familiar with the distribution code in Solr. I located
CloudSolrServer.request(SolrRequest request) which seems to be the place
you are talking about? It extracts replica URLs and generates a
LBHttpSolrServer.Req with that list, which it immediately used with the
LBHttpSolrServer.

As I understand it, feeding LBHttpSolrServer.Req with only shards that
are primary, would mean an exception if those shards does not answer. In
order to handle the first search against a failed primary shard
gracefully, wouldn't we need to extend the LBHttpSolrServer.Req to have
two lists, primary and lastResort, instead of one? This would also
require a rewrite of the try-retry logic in LBHttpSolrServer.

> ...if i remember correctly, there is already a hook (or there is an issue 
> about adding a hook>) to let you do plugin logic like this -- [...]

I did not see one in the code and could not locate a JIRA issue. Not
that it means that it isn't there.

Thank you for your time,
Toke Eskildsen

Reply via email to