删除/更改集合数据类型的cassandra列的最佳实践是什么? [英] What are best practices for deleting/altering cassandra columns of collection data-type?

查看:306
本文介绍了删除/更改集合数据类型的cassandra列的最佳实践是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的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:

RuntimeException:6d6 ... 73未定义为集合

RuntimeException: 6d6...73 is not defined as a collection

我发现"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 ?

数据库版本:DataStax-Enterprise:4.7.1 Cassandra 2.1.8.621
cqlsh 5.0.1

database-version: DataStax-Enterprise: 4.7.1 Cassandra 2.1.8.621
cqlsh 5.0.1

推荐答案

我想您偶然发现了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列的最佳实践是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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