You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alan Woodward (JIRA)" <ji...@apache.org> on 2015/11/09 11:10:11 UTC

[jira] [Commented] (SOLR-8254) HttpSolrCall.getCoreByCollection can throw NPE if there are no leaders up

    [ https://issues.apache.org/jira/browse/SOLR-8254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14996313#comment-14996313 ] 

Alan Woodward commented on SOLR-8254:
-------------------------------------

Lines 781-794:
{code}
    //Hitting the leaders is useful when it's an update request.
    //For queries it doesn't matter and hence we don't distinguish here.
    for (Map.Entry<String, Slice> entry : entries) {
      // first see if we have the leader
      Replica leaderProps = clusterState.getLeader(collection, entry.getKey());    // <----- CAN RETURN NULL IF THERE'S NO LEADER
      if (liveNodes.contains(leaderProps.getNodeName()) && leaderProps.getState() == Replica.State.ACTIVE) {
        if (leaderProps != null) {
          core = checkProps(leaderProps);
        }
        if (core != null) {
          return core;
        }
      }
{code}

The leaderProps null check should be part of the outer if statement, I think, but I don't grok this bit of code well enough to know what to do if the leader is in fact null.

It also strikes me that this method probably belongs on CoreContainer, rather than as a private method in HttpSolrCall?

> HttpSolrCall.getCoreByCollection can throw NPE if there are no leaders up
> -------------------------------------------------------------------------
>
>                 Key: SOLR-8254
>                 URL: https://issues.apache.org/jira/browse/SOLR-8254
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Alan Woodward
>
> See http://jenkins.thetaphi.de/job/Lucene-Solr-5.x-Windows/5254/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org