[ https://issues.apache.org/jira/browse/CASSANDRA-13776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benjamin Lerer updated CASSANDRA-13776: --------------------------------------- Summary: Adding a field to an UDT can corrupte the tables using it (was: Adding a field to an UDT can corrupte table) > Adding a field to an UDT can corrupte the tables using it > --------------------------------------------------------- > > Key: CASSANDRA-13776 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13776 > Project: Cassandra > Issue Type: Bug > Reporter: Benjamin Lerer > Assignee: Benjamin Lerer > Priority: Critical > > 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: > {code} > @Test > public void testReadAfterAlteringUserTypeNestedWithinSet() throws > Throwable > { > String ut1 = createType("CREATE TYPE %s (a int)"); > String columnType = KEYSPACE + "." + ut1; > try > { > createTable("CREATE TABLE %s (x int PRIMARY KEY, y set<frozen<" + > columnType + ">>)"); > disableCompaction(); > execute("INSERT INTO %s (x, y) VALUES(1, ?)", set(userType(1), > userType(2))); > assertRows(execute("SELECT * FROM %s"), row(1, set(userType(1), > userType(2)))); > flush(); > assertRows(execute("SELECT * FROM %s WHERE x = 1"), > row(1, set(userType(1), userType(2)))); > execute("ALTER TYPE " + KEYSPACE + "." + ut1 + " ADD b int"); > execute("UPDATE %s SET y = y + ? WHERE x = 1", > set(userType(1, 1), userType(1, 2), userType(2, 1))); > flush(); > assertRows(execute("SELECT * FROM %s WHERE x = 1"), > row(1, set(userType(1), > userType(1, 1), > userType(1, 2), > userType(2), > userType(2, 1)))); > compact(); > assertRows(execute("SELECT * FROM %s WHERE x = 1"), > row(1, set(userType(1), > userType(1, 1), > userType(1, 2), > userType(2), > userType(2, 1)))); > } > finally > { > enableCompaction(); > } > } > {code} > There is 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 {{IndexOutOfBoundException}}. > # 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}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org