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

Shawn Heisey commented on SOLR-8070:
------------------------------------

The code on QueryComponent.java line 849 (in the 5.2.1 source) is the sort of 
construction that makes it very difficult to figure out the source of NPE 
problems.  I was guessing when I asked the user if they had a uniqueKey.

A null check on the uniqueKey is a good idea to add to this code, even if early 
failure during collection creation and initialization almost guarantees that it 
won't be null.  The other elements in this method chain should also probably be 
validated to make sure there are null checks for the entire construct.


> Implement "fail early/loud" for SolrCloud when schema does not contain a 
> uniqueKey
> ----------------------------------------------------------------------------------
>
>                 Key: SOLR-8070
>                 URL: https://issues.apache.org/jira/browse/SOLR-8070
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrCloud
>    Affects Versions: 5.2.1
>            Reporter: Shawn Heisey
>            Priority: Minor
>
> SolrCloud requires a uniqueKey, but if you don't have one, the behavior can 
> be a little strange.
> A user could make and use single-shard collections just fine, but as soon as 
> they tried a multi-shard collection, they got a very unhelpful exception.  
> This is specific to Solr 5.2.1:
> {code}
> java.lang.NullPointerException
>       at 
> org.apache.solr.handler.component.QueryComponent.createMainQuery(QueryComponent.java:849)
>       at 
> org.apache.solr.handler.component.QueryComponent.regularDistributedProcess(QueryComponent.java:713)
>       at 
> org.apache.solr.handler.component.QueryComponent.distributedProcess(QueryComponent.java:666)
>       at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:305)
>       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)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
>       at 
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>       at org.eclipse.jetty.server.Server.handle(Server.java:497)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
>       at 
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>       at java.lang.Thread.run(Thread.java:745)
> {code}
> At the very least, this point in the code should give a helpful error message 
> when uniqueKey is missing ... but ideally, creating collections with no 
> uniqueKey would fail.



--
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