Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11130

V2Request in SolrJ should return the correct collection name so that the request is forwarded to the correct node



    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 6.6, 8.0
    • 7.0, 8.0
    • SolrJ, v2 API
    • None


      I am trying to use V2Request to invoke the config API with SolrJ. Sometimes, I see a weird NullPointerException:

      5396 ERROR (qtp1277924867-37) [n:    ] o.a.s.s.HttpSolrCall null:java.lang.NullPointerException
      	at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:518)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:378)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:322)

      and the corresponding exception on the solrj client was:

      org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteExecutionException: Error from server at Unknown Error
      	at __randomizedtesting.SeedInfo.seed([33AAA14CC3DE7EE3:BBFE9E966D22131B]:0)
      	at org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteExecutionException.create(HttpSolrClient.java:812)
      	at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:602)
      	at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:252)
      	at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:241)
      	at org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:483)
      	at org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:413)
      	at org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1121)
      	at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:862)
      	at org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:793)
      	at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219)
      	at org.apache.solr.cloud.TestCloudSearcherWarming.test(TestCloudSearcherWarming.java:68)

      The code used to invoke the api was:

      V2Request request = new V2Request.Builder("/c/" + collectionName + "/config").withMethod(SolrRequest.METHOD.POST).withPayload(addListenerCommand).build();

      This exception happens when the config API call is sent to a Solr node which does not have any replica for the collection. Now in v1 API, solrj would refuse to send the request and complain that no default collection is set but the V2Request does not do that.

      So there are two bugs here:

      1. V2Request tries to send request for collection X to a random node without caring for correct routing
      2. The node receiving such request is not able to forward it to the right node and fails with a NPE.

      To solve 1, our options are:

      1. Either we start requiring the same for V2 i.e. user must set default collection
      2. We detect that users are trying to invoke a collection specific v2 api and we add a new method in V2RequestBuilder to specify a collection name and ensure that the user calls it.


        1. SOLR-11130.patch
          5 kB
          Noble Paul

        Issue Links



              noble.paul Noble Paul
              shalin Shalin Shekhar Mangar
              0 Vote for this issue
              5 Start watching this issue