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

  1. 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.
    Tip: In OpsCenter, perform a rolling restart.
  2. On each node, examine the data directory for the table to fix. The default location for the data 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.
  3. Identify which id (column family ID) is the newest table ID in system_schema.tables.
    cqlsh -e "SELECT * FROM system_schema.tables" | grep <tablename>
  4. Move the data from the older table to the newer table's directory, and then remove the older directory. Repeat this step as needed.
  5. Run nodetool refresh.