问题
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