在Astyanax的Cassandra CQL3支持 [英] Cassandra CQL3 support in Astyanax

查看:181
本文介绍了在Astyanax的Cassandra CQL3支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Astyanax是否通过使用CQL3的准备语句支持插入?
我使用最新的Astyanax库1.56.24和Cassandra 1.2.1。当我尝试用CQL3执行一个准备语句:

Does Astyanax support "insert into" via prepared statement with CQL3? I use the latest Astyanax library 1.56.24 and Cassandra 1.2.1. When I try to execute a prepared statement with CQL3:

keyspace.prepareQuery(conn.CF_CONTACTS)
  .withCql("INSERT INTO contacts (a, b) VALUES (?, ?);")
  .asPreparedStatement()
  .withStringValue("123")
  .withStringValue("456")
  .execute();;

我得到以下异常:

Caused by: InvalidRequestException(why:Cannot execute/prepare CQL2 statement since the CQL has been set to CQL3(This might mean your client hasn't been upgraded correctly to use the new CQL3 methods introduced in Cassandra 1.2+).)
at org.apache.cassandra.thrift.Cassandra$prepare_cql_query_result.read(Cassandra.java:38738)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_prepare_cql_query(Cassandra.java:1598)
at org.apache.cassandra.thrift.Cassandra$Client.prepare_cql_query(Cassandra.java:1584)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$6$3$1.internalExecute(ThriftColumnFamilyQueryImpl.java:747)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$6$3$1.internalExecute(ThriftColumnFamilyQueryImpl.java:742)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:56)


推荐答案

这是因为cassandra客户端的更改通知高级客户端应用程序正在使用CQL3实现不正确。请参见 https://issues.apache.org/jira/browse/CASSANDRA-5172

This is because a change in cassandra client to notifies high-level client apps that are using CQL3 implementation improperly. See https://issues.apache.org/jira/browse/CASSANDRA-5172

似乎Astyanax没有升级到这个版本的cassandra客户端,或者他们没有记录
我目前正在寻找一个解决方案此时。

It seems that Astyanax either did not upgrade to this version of the cassandra client or they did not document the I'm currently looking myself for a solution at this moment.

这篇关于在Astyanax的Cassandra CQL3支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆