Fixing a table schema collision

Dynamic schema creation or updates can cause a schema collision that results in errors.

  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.

  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.

     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 is the newest table ID in system_schema.tables using CQL.

    SELECT id, keyspace_name, table_name FROM system_schema.tables 
      WHERE keyspace_name = 'cycling' AND table_name = 'cyclist_name';
 id | keyspace_name | table_name
----+---------------+------------

(0 rows)

 id | keyspace_name | table_name
----+---------------+------------

(0 rows)
  1. Move the data from the older table to the newer table’s directory, and then remove the older directory. Repeat this step as needed.

  2. Run nodetool refresh.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com