我的代码上有以下计数器查询:
private CounterSlice<String> queryLastCounts(Long key, String columnFamily,
int maxLength) {
SliceCounterQuery<Long, String> query =
HFactory.createCounterSliceQuery(cassandra.getKeyspace(),
LONG_S, STRING_S);
query
.setColumnFamily(columnFamily)
.setKey(key)
.setRange("", "", true, maxLength);
return query.execute().get();
}
在我的单元测试中,代码运行良好。但是当运行正确的应用程序(我为此使用storm)时,我收到以下错误:
Caused by: InvalidRequestException(why:String didn't validate.)
at org.apache.cassandra.thrift.Cassandra$get_slice_result.read(Cassandra.java:7756)
at org.apache.cassandra.thrift.Cassandra$Client.recv_get_slice(Cassandra.java:570)
at org.apache.cassandra.thrift.Cassandra$Client.get_slice(Cassandra.java:542)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl$8.execute(KeyspaceServiceImpl.java:308)
... 25 more
我也在使用 Hector 访问 Cassandra。