Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Cassandra中,为什么不允许从使用压缩存储定义的表中删除列?_Cassandra_Cql3_Cassandra Cli - Fatal编程技术网

在Cassandra中,为什么不允许从使用压缩存储定义的表中删除列?

在Cassandra中,为什么不允许从使用压缩存储定义的表中删除列?,cassandra,cql3,cassandra-cli,Cassandra,Cql3,Cassandra Cli,根据datastx文档,我们无法从使用压缩存储选项定义的表中删除列。原因是什么?这可以追溯到CQL3的原始实现,以及为使其能够在原始的基于节约的存储引擎上抽象出“类似SQL”的宽行结构所做的更改。最终,管理模式取决于底层结构是表还是列族 例如,我将使用Apache Cassandra(2.1.19)的旧安装创建两个表: 我将在每个表中插入一行: INSERT INTO student (studentid, fname, lname) VALUES ('janderson','Jordy','A

根据datastx文档,我们无法从使用压缩存储选项定义的表中删除列。原因是什么?

这可以追溯到CQL3的原始实现,以及为使其能够在原始的基于节约的存储引擎上抽象出“类似SQL”的宽行结构所做的更改。最终,管理模式取决于底层结构是表还是列族

例如,我将使用Apache Cassandra(2.1.19)的旧安装创建两个表:

我将在每个表中插入一行:

INSERT INTO student (studentid, fname, lname) VALUES ('janderson','Jordy','Anderson');
INSERT INTO studentcomp (studentid, fname, lname) VALUES ('janderson','Jordy','Anderson');
然后,我将使用旧的cassandra cli工具查看这些表:

[default@stackoverflow] list student;
Using default limit of 100
Using default cell limit of 100
-------------------
RowKey: janderson
=> (name=, value=, timestamp=1599248215128672)
=> (name=fname, value=4a6f726479, timestamp=1599248215128672)
=> (name=lname, value=416e646572736f6e, timestamp=1599248215128672)

[default@stackoverflow] list studentcomp;
Using default limit of 100
Using default cell limit of 100
-------------------
RowKey: janderson
=> (name=fname, value=Jordy, timestamp=1599248302715066)
=> (name=lname, value=Anderson, timestamp=1599248302715066)
您是否在第一个结果中看到空/“ghost”列值?该空列值是CQL3在列值和表元数据之间的链接。如果不存在,则CQL不能用于管理表的列

用于类型转换的比较器是通过节俭真正公开的。这种元数据控制/暴露的缺乏使得Cassandra在CQL之前被认为是“无模式的”。如果我在cassandra cli中运行
Descripte studentcomp
,我可以看到使用的比较器(验证类):

但如果我尝试描述学生,我会看到:

WARNING: CQL3 tables are intentionally omitted from 'describe' output.
See https://issues.apache.org/jira/browse/CASSANDRA-4377 for details.

Sorry, no Keyspace nor (non-CQL3) ColumnFamily was found with name: student (if this is a CQL3 table, you should use cqlsh instead)
基本上,表和列族是被迫放在同一个存储桶中的不同实体。使用紧凑型存储添加
实际上使表成为一个列族。 随之而来的是,除了访问比较器之外,缺乏任何模式管理(添加或删除列)

编辑20200905

我们能不能以某种方式把这些列从表中删除


你也许能做到这一点。Sylvain Lebresne写了这封信,里面会有一些必要的细节给你。我还建议大家通读上面提到的Jira记录单(),因为它涵盖了许多使这项工作变得困难的深层次技术挑战。

我们是否可以通过某种方式(hack)从表中删除这些列。在添加列之前,我有我的系统表的旧备份。我正在考虑关闭我的所有节点,并从schema_columns目录中的备份中恢复旧的sstables。“但它不起作用吗?”ManishKhandelwal说。祝你好运我尝试过(回滚系统表)并成功了,但我担心在生产中应用。我正在考虑删除该表并使用相同的名称重新创建,然后插入数据。
Column Metadata:
  Column Name: lname
    Validation Class: org.apache.cassandra.db.marshal.UTF8Type
  Column Name: fname
    Validation Class: org.apache.cassandra.db.marshal.UTF8Type
WARNING: CQL3 tables are intentionally omitted from 'describe' output.
See https://issues.apache.org/jira/browse/CASSANDRA-4377 for details.

Sorry, no Keyspace nor (non-CQL3) ColumnFamily was found with name: student (if this is a CQL3 table, you should use cqlsh instead)