You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by RadhaJayalakshmi <rl...@inautix.co.in> on 2013/11/21 09:57:04 UTC

SolrServerException while adding an invalid UNIQUE_KEY in solr 4.4

Hi,I am using solr4.4 with zookeeper 3.3.5. While i was checking for error
conditions of my application, i came across a strange issue.Here is what i
tried:I have three fields  defined in my schemaa) UNIQUE_KEY  - of type
solr.TrieLongb) empId - of type Solr.TrieLongc) companyId - of type
Solr.TrieLongHow Am i Indexing:----------------------------I am indexing
using SolrJ API. and the data for the indexing will be in a text file,
delimited by | symbol. My Indexer java program will read the textfile lineby
line, splits the data by | symbol and creates SolrInputdocument object (for
every line of the file) and adds the fields with values (that it read from
the file)Now, intentionally, in the data file, for unique_key, i had String
values(instead of long value) . something like123AB|111|222Now, when i index
this data, i am getting the below
exception:*org.apache.solr.client.solrj.SolrServerException*: No live
SolrServers available to handle this request*:[URL of my application]*										   
at
org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:333)		       
at
org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318)	       
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)								       
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)			       
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)			Caused
by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Server at *[URL of my application] *returned non ok status:500,
message:Internal Server Error			        at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)	       
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)	       
at
org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264)
But, when i correct the unique_key field data, but when i gave string data
for other two long fields, i am getting a different
exceptionorg.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
ERROR: [Error stating the field name for which it is
mismathing]orrg.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:424)	       
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)	       
at
org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264)	       
at
org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318)	       
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)								       
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)			       
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)			       
at 		What is my question here:--------------------------During indexing, if
solr finds, that for any field, if the fieldtype declared in schema is
mismatching with the data that is being givem, then it should riase the same
type of exception.But in the above case, if it finds a mismatch for
Unique_key, it is raising SolrServerException. For all other fields, it is
raising, RemoteSolrException(which is an unchecked exception). Is this a bug
in solr or is there any reason for thowing different exception for the above
two cases.Expecting a positive replyThanksRadha						



--
View this message in context: http://lucene.472066.n3.nabble.com/SolrServerException-while-adding-an-invalid-UNIQUE-KEY-in-solr-4-4-tp4102346.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SolrServerException while adding an invalid UNIQUE_KEY in solr 4.4

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/21/2013 9:51 PM, RadhaJayalakshmi wrote:
> Thanks Shawn for your response.
> So, from your email, it seems that unique_key validation is handled
> differently from other field validation.
> But what i am not very clear, is what the unique_key has to do with finding
> the live server?
> Becase if there is any mismatch in the unique_key, it is throwing
> SolrServerException saying "No live servers found".. Because live servers
> are being sourced by clusterstate of zookeeper. so i feel the unique key is
> particular to a core/index.
> So looking to understand the nature of this exception. Please explain me how
> unique_key and live servers are related

It's the HTTP error code, 500, which means internal server error.  SolrJ
interprets this to mean that there's something wrong with that server,
which is what the HTTP protocol specification says it must do.  That
makes it try the next server.  Because the problem is not actually a
server issue, the next server returns the same error.  This continues
until it's tried them all and gives up.

The validation for other fields returns a different error, one that
SolrJ interprets as a problem with the request, so it doesn't try other
servers.

Strictly speaking, Solr probably should not return error 500 for unique
key validation issues, which makes this a minor bug.  The actual results
are correct, because the update fails and the application is notified.
If all possible exceptions are caught, then it all works correctly.

Thanks,
Shawn


Re: SolrServerException while adding an invalid UNIQUE_KEY in solr 4.4

Posted by RadhaJayalakshmi <rl...@inautix.co.in>.
Thanks Shawn for your response.
So, from your email, it seems that unique_key validation is handled
differently from other field validation.
But what i am not very clear, is what the unique_key has to do with finding
the live server?
Becase if there is any mismatch in the unique_key, it is throwing
SolrServerException saying "No live servers found".. Because live servers
are being sourced by clusterstate of zookeeper. so i feel the unique key is
particular to a core/index.
So looking to understand the nature of this exception. Please explain me how
unique_key and live servers are related




--
View this message in context: http://lucene.472066.n3.nabble.com/SolrServerException-while-adding-an-invalid-UNIQUE-KEY-in-solr-4-4-tp4102346p4102533.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SolrServerException while adding an invalid UNIQUE_KEY in solr 4.4

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/21/2013 1:57 AM, RadhaJayalakshmi wrote:
> Hi,I am using solr4.4 with zookeeper 3.3.5. While i was checking for error
> conditions of my application, i came across a strange issue.Here is what i
> tried:I have three fields  defined in my schemaa) UNIQUE_KEY  - of type
> solr.TrieLongb) empId - of type Solr.TrieLongc) companyId - of type
> Solr.TrieLongHow Am i Indexing:----------------------------I am indexing
> using SolrJ API. and the data for the indexing will be in a text file,
> delimited by | symbol. My Indexer java program will read the textfile lineby
> line, splits the data by | symbol and creates SolrInputdocument object (for
> every line of the file) and adds the fields with values (that it read from
> the file)Now, intentionally, in the data file, for unique_key, i had String
> values(instead of long value) . something like123AB|111|222Now, when i index
> this data, i am getting the below
> exception:*org.apache.solr.client.solrj.SolrServerException*: No live
> SolrServers available to handle this request*:[URL of my application]*										
> at
> org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:333)		
> at
> org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318)	
> at
> org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)								
> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)			
> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)			Caused
> by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
> Server at *[URL of my application] *returned non ok status:500,
> message:Internal Server Error			        at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)	
> at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)	
> at
> org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264)
> But, when i correct the unique_key field data, but when i gave string data
> for other two long fields, i am getting a different
> exceptionorg.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
> ERROR: [Error stating the field name for which it is
> mismathing]orrg.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:424)	
> at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)	
> at
> org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264)	
> at
> org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318)	
> at
> org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)								
> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)			
> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)			
> at 		What is my question here:--------------------------During indexing, if
> solr finds, that for any field, if the fieldtype declared in schema is
> mismatching with the data that is being givem, then it should riase the same
> type of exception.But in the above case, if it finds a mismatch for
> Unique_key, it is raising SolrServerException. For all other fields, it is
> raising, RemoteSolrException(which is an unchecked exception). Is this a bug
> in solr or is there any reason for thowing different exception for the above
> two cases.Expecting a positive replyThanksRadha						

The first exception is an error thrown directly from SolrJ.  It was 
unable to find any server to deal with the request, so it threw its own 
SolrServerException wrapping the last RemoteSolrException (HTTP error 
500) it received.

The second exception happened in a different place.  In this case, the 
request made it past the server-side uniqueKey handling code and into 
the code that handles other fields, which froim what I can see here 
returns a different error message and possibly a different HTTP code.  
Because it was different, SolrJ sent the RemoteSolrException up the 
chain to your application rather than catching and wrapping it in 
SolrServerException.

I am not surprised to hear that you get a different error for invalid 
data in the uniqueKey field than you do in other fields. Because of its 
nature, it must be handled in a different code path.

Thanks,
Shawn