[
https://issues.apache.org/jira/browse/CASSANDRA-21761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mohammad Suhel updated CASSANDRA-21761:
---------------------------------------
Test and Documentation Plan:
Testing:
- Added unit tests in AlterTest.java: testDropAndReAddFrozenUDT,
testDropAndReAddNestedFrozenUDT, testDropFrozenUDTAndAddNonFrozenUDT and
testDropFrozenUDTAndAddIncompatibleUDT.
- Updated LegacySSTableTest#testVerifyOldDroppedTupleSSTables, which expected
the re-add of val3 to be rejected.
- AlterTest, LegacySSTableTest, UserTypesTest and checkstyle pass locally.
- Verified on a local node, before and after the fix.
- No documentation change needed.
Status: Patch Available (was: Open)
> Re-adding a dropped column with the same frozen user type is rejected as
> incompatible
> -------------------------------------------------------------------------------------
>
> Key: CASSANDRA-21761
> URL: https://issues.apache.org/jira/browse/CASSANDRA-21761
> Project: Apache Cassandra
> Issue Type: Bug
> Components: Legacy/Local Write-Read Paths
> Reporter: Nadav Har'El
> Assignee: Mohammad Suhel
> Priority: Normal
> Fix For: 5.0.x, 6.x, 7.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> After dropping a column of a frozen user type, re-adding a column with the
> same name and the *same* type fails:
> {code:sql}
> CREATE TYPE ks.udt (a int, b text);
> CREATE TABLE ks.t (p int PRIMARY KEY, x frozen<udt>);
> ALTER TABLE ks.t DROP x;
> ALTER TABLE ks.t ADD x frozen<udt>;
> {code}
> The last statement fails with:
> {noformat}
> InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot
> add a column 'x' of type frozen<udt>, incompatible with previously dropped
> column 'x' of type frozen<tuple<int, text>>"
> {noformat}
> Reproduced on Cassandra 5.0.9 and 6.0-alpha2.
> The cause: a dropped column's type is recorded with its user types expanded
> into tuples ({{TableMetadata}}, {{column.type.expandUserTypes()}}), but
> {{AlterTableStatement}} compares the new, unexpanded type with it using
> {{isSerializationCompatibleWith()}}, and a {{UserType}} is not
> value-compatible with a {{TupleType}}. Expanding the new type the same way
> before the comparison would fix it.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]