tamaramata / solrnet

Automatically exported from code.google.com/p/solrnet
0 stars 0 forks source link

Parser for shardinfo in response #197

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
We are using Solr 4.0 in a distributed system (multiple shards) and would like 
2 features to be surfaced, or at least be pointed in the general direction of 
doing this myself...

When using shards, you can add an option to the query string (or using 
ExtraParams) named shardinfo=true. This returns information about the shards 
and how they responded. an example is as follows:

<lst name="shards.info">
<lst name="192.168.0.151:8983/solr">
<long name="numFound">6490001</long>
<float name="maxScore">1.0</float>
<long name="time">25</long>
</lst>
<lst name="192.168.0.147:8983/solr">
<long name="numFound">7990001</long>
<float name="maxScore">1.0</float>
<long name="time">26</long>
</lst>
<lst name="192.168.0.152:8983/solr">
<long name="numFound">14990001</long>
<float name="maxScore">1.0</float>
<long name="time">3679</long>
</lst>
</lst>

The number of results is not as important to us as the time querying each shard.

The second option is shards.tolerant=true. If a shard is down, the query will 
still continue and as part of the shardinfo section, you get something like so:

<lst name="192.168.0.152:8983/solr">
<str name="error">
org.apache.http.conn.HttpHostConnectException: Connection to 
http://192.168.0.152:8983 refused
</str>
<str name="trace">
org.apache.http.conn.HttpHostConnectException: Connection to 
http://192.168.0.152:8983 refused at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(Default
ClientConnectionOperator.java:158) at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:150) at 
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapt
er.java:121) at 
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDire
ctor.java:575) at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirecto
r.java:425) at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:8
20) at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:7
54) at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:7
32) at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:352
) at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181
) at 
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:
166) at 
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:
133) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at 
java.util.concurrent.FutureTask.run(FutureTask.java:166) at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at 
java.util.concurrent.FutureTask.run(FutureTask.java:166) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
at java.lang.Thread.run(Thread.java:679) Caused by: java.net.ConnectException: 
Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327) at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:1
93) at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180) at 
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) at 
java.net.Socket.connect(Socket.java:546) at 
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.
java:123) at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(Default
ClientConnectionOperator.java:148) ... 19 more
</str>
<long name="time">1</long>
</lst>

again, the stack trace is not as important as the shard that is down... 

I will chance my arm at fixing this, or at least trying, but any suggestions 
would be appreciated. 

Original issue reported on code.google.com by lsmart...@gmail.com on 5 Nov 2012 at 3:34

GoogleCodeExporter commented 8 years ago

Original comment by mauricio...@gmail.com on 13 Nov 2012 at 1:03

GoogleCodeExporter commented 8 years ago

Original comment by mauricio...@gmail.com on 13 Nov 2012 at 1:04

GoogleCodeExporter commented 8 years ago
Moved to https://github.com/mausch/SolrNet/issues/107

Original comment by mauricio...@gmail.com on 9 Sep 2013 at 8:30