问题描述
在我们的Cassandra表中,每次更改"collection-type"列的数据类型时,它都会引起问题.例如:
In our Cassandra table, every time we change data-types of "collection-type" columns it start causing issue. For example:
要将数据类型从text
更改为Map<text,float>
,请执行以下操作:
For changing datatype from text
to Map<text,float>
we do this:
- 删除现有列
- 等待卡桑德拉吸收这一变化.
- 添加列(名称相同),但数据类型不同.
这在所有节点上都很好,但是Cassandra日志在压缩期间开始抱怨:
This reflects fine in all nodes, but Cassandra logs start complaining during compaction with:
我发现"system.schema_columnfamilies"
表中的comparator
条目不正确.删除表并重新创建它可以解决问题,但并非总是可能.
I figured out the comparator
entries are not correct in "system.schema_columnfamilies"
table. Dropping table and recreating it fixes the problem but its not possible always.
在上述情况下处理集合类型列时,是否有一些最佳实践?
Are there some best-practices when we are dealing with collection type columns in situations like above ?
推荐答案
我想您偶然发现了Cassandra中的其中一种WAT时刻.将新列命名为以前删除的列是一种不好的做法.有时甚至不起作用.关于架构(或数据)迁移,请查看我们的工具.它可以帮助您在保留数据和填充字段的同时执行架构更新.
I guess you stumbled upon one of those WAT moments in Cassandra. Its a bad practice to name a new column as previously dropped one. Sometimes it even doesn't work.Regarding schema (or data) migrations take a look at our tool. It can help you execute schema updates while keeping data and populating fields.
这篇关于删除/更改集合数据类型的cassandra列的最佳实践是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!