Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBA5010E64 for ; Mon, 18 Nov 2013 20:43:24 +0000 (UTC) Received: (qmail 2060 invoked by uid 500); 18 Nov 2013 20:43:24 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 2034 invoked by uid 500); 18 Nov 2013 20:43:24 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 1982 invoked by uid 99); 18 Nov 2013 20:43:24 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Nov 2013 20:43:24 +0000 Date: Mon, 18 Nov 2013 20:43:24 +0000 (UTC) From: "Mikhail Stepura (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-6372) cassandra-driver-core-2.0.0-rc1.jar fails in this case MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-6372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825764#comment-13825764 ] Mikhail Stepura commented on CASSANDRA-6372: -------------------------------------------- Most likely the problem is https://datastax-oss.atlassian.net/browse/JAVA-213 > cassandra-driver-core-2.0.0-rc1.jar fails in this case > ------------------------------------------------------ > > Key: CASSANDRA-6372 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6372 > Project: Cassandra > Issue Type: Bug > Components: Drivers (now out of tree) > Reporter: Jacob Rhoden > > Testing this out switching over to the new driver. Its mostly working except for one particular query (or code?) is causing the following: > {quote} > com.datastax.driver.core.exceptions.DriverInternalError: Tried to execute unknown prepared query 0x67dfcaa71c14d42a0a7f62406b41ea3e > com.datastax.driver.core.exceptions.DriverInternalError.copy():42 > com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException():271 > com.datastax.driver.core.ResultSetFuture.getUninterruptibly():187 > com.datastax.driver.core.Session.execute():126 > tap.command.GetNewsFeed.execute():72 > tap.servlet.HomeServlet.doGet():38 > javax.servlet.http.HttpServlet.service():668 > {quote} > Anyone encounter this one before? Any suggestions? In case its relevant, line 72 is the for loop statement: > {quote} > PreparedStatement p = s.prepare( > "select uuid,to_uuid,to_first_name, to_last_name,from_uuid,from_first_name,from_last_name,action,message "+ > "from news_feed " + > "where person_uuid = ? " + > "order by uuid desc " + > "limit 50"); > PreparedStatement q = s.prepare("select count(*) from post_likes where post_uuid=?"); > PreparedStatement c = s.prepare("select comments from post_counters where uuid=?"); > PreparedStatement lq = s.prepare("select person_uuid from post_likes where post_uuid=? and person_uuid=?"); > for(Row r : s.execute(p.bind(user.getPersonUuid()))) { > Message m = new Message(); > Person to = new Person(); > to.setUuid(r.getUUID(1)); > to.setFirstName(r.getString(2)); > to.setLastName(r.getString(3)); > Person from = new Person(); > from.setUuid(r.getUUID(4)); > from.setFirstName(r.getString(5)); > from.setLastName(r.getString(6)); > m.setUuid(r.getUUID(0)); > m.setTo(to); > m.setFrom(from); > m.setAction(r.getString(7)); > m.setMessage(r.getString(8)); > results.add(m); > m.setLikeCount((int)s.execute(q.bind(m.getUuid())).one().getLong(0)); > for(Row r2 : s.execute(c.bind(m.getUuid()))) { > m.setCommentCount((int)r2.getLong(0)); > } > m.setLiked(s.execute(lq.bind(m.getUuid(), user.getPersonUuid())).iterator().hasNext()); > m.setFromMe(from.getUuid().equals(user.getPersonUuid())); > m.setToMe(to.getUuid().equals(user.getPersonUuid())); > } > {quote} > Reworking the code as follows avoids the problem: > {quote} > public List execute() throws IOException { > List results = new LinkedList<>(); > Session s = api.getCassandraSession(); > PreparedStatement p = s.prepare( > "select uuid,to_uuid,to_first_name, to_last_name,from_uuid,from_first_name,from_last_name,action,message "+ > "from news_feed " + > "where person_uuid = ? " + > "order by uuid desc " + > "limit 50"); > for(Row r : s.execute(p.bind(user.getPersonUuid()))) { > Message m = new Message(); > Person to = new Person(); > to.setUuid(r.getUUID(1)); > to.setFirstName(r.getString(2)); > to.setLastName(r.getString(3)); > Person from = new Person(); > from.setUuid(r.getUUID(4)); > from.setFirstName(r.getString(5)); > from.setLastName(r.getString(6)); > m.setUuid(r.getUUID(0)); > m.setTo(to); > m.setFrom(from); > m.setAction(r.getString(7)); > m.setMessage(r.getString(8)); > results.add(m); > m.setFromMe(from.getUuid().equals(user.getPersonUuid())); > m.setToMe(to.getUuid().equals(user.getPersonUuid())); > } > PreparedStatement q = s.prepare("select count(*) from post_likes where post_uuid=?"); > PreparedStatement c = s.prepare("select comments from post_counters where uuid=?"); > PreparedStatement lq = s.prepare("select person_uuid from post_likes where post_uuid=? and person_uuid=?"); > for(Message m : results) { > m.setLikeCount((int)s.execute(q.bind(m.getUuid())).one().getLong(0)); > for(Row r2 : s.execute(c.bind(m.getUuid()))) { > m.setCommentCount((int)r2.getLong(0)); > } > m.setLiked(s.execute(lq.bind(m.getUuid(), user.getPersonUuid())).iterator().hasNext()); > } > return results; > } > {quote} -- This message was sent by Atlassian JIRA (v6.1#6144)