datastax java中的setfetchsize:当fetchSize == rowcount时,它失败并出现异常DriverInternalError

时间:2014-06-19 11:18:35

标签: java cassandra cql datastax

我使用的版本是:datastax java driver 2.0.1 & 2.0.2

cassandra version : [cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol 19.39.0]

代码部分:

    Statement stmt = new SimpleStatement("SELECT id FROM accounts;"); 
    stmt.setFetchSize(5); 
    session.execute(stmt); 
    for (Row r:result.all()){
        System.out.println(r.toString());
    }

   for (Row r:result){
        System.out.println(r.toString());
    }

异常发生在

for (Row r:result)

Exception in thread "main" com.datastax.driver.core.exceptions.DriverInternalError: An unexpected error occurred server side on /122.248.212.139:9042: java.lang.IllegalArgumentException: Illegal Capacity: -1
at com.datastax.driver.core.exceptions.DriverInternalError.copy(DriverInternalError.java:42)
at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:256)
at com.datastax.driver.core.ArrayBackedResultSet$MultiPage.prepareNextRow(ArrayBackedResultSet.java:259)
at com.datastax.driver.core.ArrayBackedResultSet$MultiPage.isExhausted(ArrayBackedResultSet.java:222)
at com.datastax.driver.core.ArrayBackedResultSet$1.hasNext(ArrayBackedResultSet.java:115)
at com.datastax.driver.core.ArrayBackedResultSet.all(ArrayBackedResultSet.java:104)
at com.minjar.simplifyit.cost.data.cassandra.DataStaxCassandraHandler.main(DataStaxCassandraHandler.java:407)
Caused by: com.datastax.driver.core.exceptions.DriverInternalError: An unexpected error occurred server side on /122.248.212.139:9042: java.lang.IllegalArgumentException: Illegal Capacity: -1
at com.datastax.driver.core.Responses$Error.asException(Responses.java:86)
at com.datastax.driver.core.ArrayBackedResultSet$MultiPage$1.onSet(ArrayBackedResultSet.java:329)
at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:235)
at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:367)
at com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:571)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

1 个答案:

答案 0 :(得分:4)

我可以使用Cassandra 2.0.4重现您的问题,但不能使用2.0.5重现您的问题。我的猜测是你遇到了CASSANDRA-6555

我建议将群集升级到最新的稳定版本2.0.8。