[ https://issues.apache.org/jira/browse/CASSANDRA-6372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacob Rhoden updated CASSANDRA-6372: ------------------------------------ Description: 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<Message> execute() throws IOException { List<Message> 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} was: Testing this out switching over to the new driver. Its mostly working except for one particular query (or code?) is causing the following: 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 Anyone encounter this one before? Any suggestions? In case its relevant, line 72 is the for loop statement: 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())); } Reworking the code as follows avoids the problem: public List<Message> execute() throws IOException { List<Message> 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; } > 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<Message> execute() throws IOException { > List<Message> 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)