What are best practices for deleting/altering cassandra columns of collection data-type?

£可爱£侵袭症+ 提交于 2019-12-08 09:45:58

问题


In our Cassandra table, every time we change data-types of "collection-type" columns it start causing issue. For example:

For changing datatype from text to Map<text,float> we do this:

  • drop existing column
  • wait for cassandra to assimilate this change.
  • add column (same name) but different data-type.

This reflects fine in all nodes, but Cassandra logs start complaining during compaction with:

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

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 ?

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


回答1:


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.



来源:https://stackoverflow.com/questions/36906671/what-are-best-practices-for-deleting-altering-cassandra-columns-of-collection-da

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!