: > I know that right now is not possible, but I think that it's a feature that
: > can be implemented in a easy way creating a new status for shards.
: 
: shardIsLastResort=true? On paper it seems like a simple addition, but I
: am not at familiar enough with the SolrCloud-code to guess if it is easy
: to implement.

FWIW: A concept that already exists in the ClusterState information is the 
idea of being able to specify a "role" for each replica.

this information isn't currently used anywhere in Solr, but i've heard 
that some people utilize i from smart client code (ie: ask ZK for a list 
of all nodes that have a certain role, and then only send queries to those 
nodes)

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;


...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 -- because i 
remember people were asking about wanting to chang the request logic to 
redundently query multiple replicas for hte same shard and use the results 
from whichever returned first ... but i don't remember what that plugin is 
called.

-Hoss

Reply via email to