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

Gregory Chanan commented on SOLR-7746:
--------------------------------------

1. You should not modify TestMiniSolrCloudCluster.  That's for testing whether 
the MiniSolrCloudCluster itself works.  Write a test that uses the 
MiniSolrCloudCluster, there should be a number of examples.  Or maybe you don't 
even need it -- can SolrPingTest satisfy what you need?

2. {code}
+      // Send distributed and non-distributed ping query
+      cloudSolrClient.setDefaultCollection(collectionName);
+      SolrPing req = new SolrPing();
+      req.setDistrib(true);
+      SolrPingResponse rsp = req.process(cloudSolrClient, collectionName);
+      assertEquals(0, rsp.getStatus()); 
+      
+      cloudSolrClient.setDefaultCollection(collectionName);
+      req = new SolrPing();
+      req.setDistrib(false);
+      rsp = req.process(cloudSolrClient, collectionName);
+      assertEquals(0, rsp.getStatus());   
{code}
Most of this code is unnecessary, you set the default collection multiple 
times, you pass the collectionName even though it's set, you create a new 
request when it would just suffice to set distrib.

3. {code}
+  public SolrPing setDistrib(boolean distrib) {   
+    params.add("distrib", distrib ? "true" : "false");
+    return this;    
+  }
{code}

You shouldn't modify SolrPing just to test it.  Just extend getParams on 
SolrPing for your distrib example.

4. Can you just have a single one of these instead of putting it in each clause?
{code}
  // Send an error or return
+      if( ex != null ) {
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, 
+            "Ping query caused exception: "+ex.getMessage(), ex );
+      }
+    } else {
{code}

> Ping requests stopped working with distrib=true in Solr 5.2.1
> -------------------------------------------------------------
>
>                 Key: SOLR-7746
>                 URL: https://issues.apache.org/jira/browse/SOLR-7746
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrCloud
>    Affects Versions: 5.2.1
>            Reporter: Alexey Serba
>         Attachments: SOLR-7746.patch, SOLR-7746.patch, SOLR-7746.patch, 
> SOLR-7746.patch
>
>
> {noformat:title="steps to reproduce"}
> # start 1 node SolrCloud cluster
> sh> ./bin/solr -c -p 8888
> # create a test collection (we won’t use it, but I just want to it to load 
> solr configs to Zk)
> ./bin/solr create_collection -c test -d sample_techproducts_configs -p 8888
> # create another test collection with 2 shards
> curl 
> 'http://localhost:8888/solr/admin/collections?action=CREATE&name=test2&numShards=2&replicationFactor=1&maxShardsPerNode=2&collection.configName=test'
> # try distrib ping request
> curl 
> 'http://localhost:8888/solr/test2/admin/ping?wt=json&distrib=true&indent=true'
> ...
>   "error":{
>     "msg":"Ping query caused exception: Error from server at 
> http://192.168.59.3:8888/solr/test2_shard2_replica1: Cannot execute the 
> PingRequestHandler recursively"
> ...
> {noformat}
> {noformat:title="Exception"}
> 2116962 [qtp599601600-13] ERROR org.apache.solr.core.SolrCore  [test2 shard2 
> core_node1 test2_shard2_replica1] – org.apache.solr.common.SolrException: 
> Cannot execute the PingRequestHandler recursively
>       at 
> org.apache.solr.handler.PingRequestHandler.handlePing(PingRequestHandler.java:246)
>       at 
> org.apache.solr.handler.PingRequestHandler.handleRequestBody(PingRequestHandler.java:211)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2064)
>       at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654)
>       at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:450)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196)
> {noformat}



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

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

Reply via email to