[英]Cassandra CQL incompatibility between cql2 and cql3
在Cassandra CQL3中,似乎無法即時添加新列; 說我有這張桌子:
cqlsh:Keyspace2>從用戶選擇*;
用戶名| 出生年份| 性別| 密碼 session_token | 州
----------- + ------------ + -------- + ------------ + --- ------------ + -------
史密斯| 1968年| 空| ch @ ngem3a | 空| 空值
jsmith2 | 1963年| 空| ch @ ngem3a2 | 空| 空值
cqlsh:Keyspace2>插入用戶(user_name,x)值('jsmith',100);
>錯誤請求:未知標識符x
也許您打算使用CQL 2? 啟動cqlsh時,嘗試使用-2選項。
但是警告是正確的,當我進入CQL2時,同樣的事情有效:
> Blockquote
cqlsh:Keyspace2> exit
[root@bdvm1 ~]# cqlsh
Connected to Test Cluster at localhost:9160.
[cqlsh 2.2.0 | Cassandra 1.1.9-dse-2.2.2-SNAPSHOT | CQL spec 2.0.0 | Thrift protocol 19.33.0]
Use HELP for help.
cqlsh> use Keyspace1;
cqlsh:Keyspace1> select * from users;
KEY | birth_year | gender
-------+------------+--------
TEST | 1968 | m
TEST1 | 1968 | f
cqlsh:Keyspace1> insert into users (KEY, x) values ('jsmith',100);
cqlsh:Keyspace1> select * from users;
KEY,TEST | birth_year,1968 | gender,m
KEY,TEST1 | birth_year,1968 | gender,f
KEY,jsmith | x,100
有人知道為什么嗎? 我以為CQL3是向后兼容的..
謝謝,馬特
您需要閱讀http://www.datastax.com/dev/blog/cql3-for-cassandra-experts和http://www.datastax.com/dev/blog/thrift-to-cql3 。 特別是第一個解釋了為什么CQL2無法建模許多常見的Cassandra設計模式,以及我們如何解決CQL3中的那些問題。
簡短的答案:CQL2中稱為“一行中的動態列”的CQL2在CQL3中表示為“分區中的多個行”。 為了減少混淆,我們現在將name:value的原始存儲引擎原子稱為一個單元,而不是一個列,並將一組具有公共鍵的單元稱為分區。
直接答案將為否,CQL3向后不兼容(請參閱cql3專家 )。 但這並不意味着他們違反了向后兼容的承諾。 CQL3背后的基本API仍然是Thrift API,它自0.7起具有相同的功能,只是實現樣式已更改。 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.