Fixing a table schema collision
Dynamic schema creation or updates can cause a schema collision that results in errors.
-
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.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
is the newest table ID insystem_schema.tables
using CQL.SELECT id, keyspace_name, table_name FROM system_schema.tables WHERE keyspace_name = 'cycling' AND table_name = 'cyclist_name';
-
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.