Fixing a table schema collision
How to fix schema collision problems.
Dynamic schema creation or updates can cause a schema collision that results in errors.
Procedure
-
Run a rolling restart on all nodes to ensure the schema matches. Run
nodetool describecluster
on all nodes. Ensure that there is only one schema version. -
On each node, examine the
data
directory for the table to fix. The default location for thedata
directory is/var/lib/cassandra/data
. If there is only one directory for the table, go to the next node and repeat this step. If there are two or more directories for the table, continue to the next step.Note: If there are two directories, the older directory contains the old table data before the update. The newer directory contains the new data after the update. -
Identify which
id
(column family ID) is the newest table ID insystem_schema.tables
.cqlsh -e "SELECT * FROM system_schema.tables" | grep <tablename>
- Move the data from the older table to the newer table's directory, and then remove the older directory. Repeat this step as needed.
- Run nodetool refresh.