[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14747061#comment-14747061 ] ASF subversion and git services commented on SOLR-6547: --- Commit 1703343 from sha...@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1703343 ] SOLR-6547: ClassCastException in SolrResponseBase.getQTime > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin >Assignee: Shalin Shekhar Mangar > Attachments: SOLR-6547.patch, SOLR-6547.patch, SOLR-6547.patch > > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14747027#comment-14747027 ] ASF subversion and git services commented on SOLR-6547: --- Commit 1703335 from sha...@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1703335 ] SOLR-6547: ClassCastException in SolrResponseBase.getQTime > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin >Assignee: Shalin Shekhar Mangar > Attachments: SOLR-6547.patch, SOLR-6547.patch, SOLR-6547.patch > > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14184481#comment-14184481 ] Anurag Sharma commented on SOLR-6547: - QTime is saved as long after truncating nano second part of time. This is equivalent to capturing the time in milliseconds. Here is the code snippet of what's happening in the CloudSolrServer. {code} long start = System.nanoTime(); . . long end = System.nanoTime(); RouteResponse rr = condenseResponse(shardResponses, (long)((end - start)/100)); {code} condenseResponse function {code} public RouteResponse condenseResponse(NamedList response, long timeMillis) { . . cheader.add("QTime", timeMillis); . . } {code} Since the time in seconds can be captured with Integer, there are two ways to fix the issue: # In CloudSolrServer, truncate the milliseconds part as well and save QTime in Integer. This way getQTime won't throw Long to Integer ClassCastException as the object coming to it already Integer. # In SolrResponseBase.getQTime function, check the instanceOf Object and get integer from it as shown in the code snippet below {code} int qtime = 0; if(obj instanceof Long) { qtime = (int)(((Long) obj).longValue()/1000); } else if (obj instanceof Integer) { qtime = (Integer)obj; } else if (obj instanceof String) { qtime = Integer.parseInt((String) obj); } return qtime; {code} Please vote for proceeding the best approach. Also like to get opinion on writing unit test in CloudSolrServerTest class. > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176048#comment-14176048 ] Anurag Sharma commented on SOLR-6547: - Based on the above comment we are good to go with Hoss Mann comment to extract the intValue from long: {code} return ((Number) header.get("QTime")).intValue() {code} A couple of failing unit tests can help in fixing and creating the patch. > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176006#comment-14176006 ] Shawn Heisey commented on SOLR-6547: QTime is always in milliseconds, no matter what size the primitive datatype is. > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14175969#comment-14175969 ] Anurag Sharma commented on SOLR-6547: - I am not sure of the usage. If there is a use case to calculate the response time then long would be precise to respond the query time in millisecond. With int the millisecond detail is missed. > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14175888#comment-14175888 ] Shawn Heisey commented on SOLR-6547: There's merit either way. Integer.MAX_VALUE in milliseconds is a little more than 24 days. I doubt you would ever run into a query that would actually take that long and still have enough resources to actually finish, so an int has plenty of capacity to handle QTime. The difference is tiny for a single value, but a long does take up twice as much memory. If most of the existing code uses an int, I am inclined to stick with that and change the deviating code. On the other hand ... everything else related to time in Java *is* represented as a long, as [~anuragsharma] mentioned. If the value is ever used for calculation with any of those other numbers, it might save a tiny bit of CPU time if Java doesn't have to convert. Switching everything to a long is likely to involve quite a bit of effort to locate and change every place that it's used, which is a big part of why I suggest sticking with int. I don't think we would ever *need* a long for relative times. > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14175867#comment-14175867 ] Anurag Sharma commented on SOLR-6547: - Hi Hoss, Thanks for your update. Time is usually returned as long value. Since getQTime returns, int looks like the interest is to return value in seconds and not milliseconds. I agree with your suggestion to change the return type to either long or use intValue while returning in the current method. Is there a way I can reproduce the java.lang.ClassCastException mentioned in the description? Kevin - Any suggestion? Anurag > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14174776#comment-14174776 ] Hoss Man commented on SOLR-6547: i suspect this has something to do with the code in CloudSolrServer.condenseResponse ? I honestly have no idea what that method is for or what it's doing, but a quick grep suggests that's the only place in the code base where a "long" value is getting assocaited with "QTime" * CloudSolrServer.condenseResponse should be fixed to use an int for QTime * SolrResponseBase.getQTime can (and probably should) be hardended to do something like this instead of just a direct Integer cast...{code} return ((Number) header.get("QTime")).intValue() {code}...that kind of pattern can help protect us in the future if we decide that QTime *should* be a long > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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
[jira] [Commented] (SOLR-6547) CloudSolrServer query getqtime Exception
[ https://issues.apache.org/jira/browse/SOLR-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14174699#comment-14174699 ] Anurag Sharma commented on SOLR-6547: - Can you mention the exact query it will become easy to investigate/reproduce > CloudSolrServer query getqtime Exception > > > Key: SOLR-6547 > URL: https://issues.apache.org/jira/browse/SOLR-6547 > Project: Solr > Issue Type: Bug > Components: SolrJ >Affects Versions: 4.10 >Reporter: kevin > > We are using CloudSolrServer to query ,but solrj throw Exception ; > java.lang.ClassCastException: java.lang.Long cannot be cast to > java.lang.Integer at > org.apache.solr.client.solrj.response.SolrResponseBase.getQTime(SolrResponseBase.java:76) -- 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