Adding a field to an UDT which is used as a Set element or as a Map element can corrupt the table.
The problem can be reproduced using the following test case:
There are in fact 2 problems:
- When the sets from the 2 versions are merged the ColumnDefinition being picked up can be the older one. In which case when the tuples are sorted it my lead to an IndexOutOfBoundsException.
- During compaction, the old column definition can be the one being kept for the SSTable metadata. If it is the case the SSTable will not be readable any more and will be marked as corrupted.
If one of the tables using the type has a Materialized View attached to it, the MV updates can also fail with IndexOutOfBoundsException.
This problem can be reproduced using the following test: