Search code examples
cassandracassandra-2.0datastaxdatastax-java-drivercassandra-cli

Altering a column family in cassandra in a multiple node topology


I'm having the following issue when trying to alter cassandra: I'm altering the table straight forward:

ALTER TABLE posts ADD is_black BOOLEAN;

on a single-node environment, both under EC2 server and on localhost everything work perfect - select, delete and so on.

When I'm altering on a cluster with 3 nodes - stuff are getting massy. When I perform

select().all().from(tableName).where..

I'm getting the following exception:

java.lang.IllegalArgumentException: is_black is not a column defined in this metadata

    at com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)

    at com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)

    at com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:69)

    at com.datastax.driver.core.AbstractGettableData.getString(AbstractGettableData.java:137)

Apparently I'm not the only one who's having this behaviour: reference

p.s - drop creating the keyspace is not a possibility for me since I cannot delete the data contained in the table.


Solution

  • The bug was resolved :-)

    I issue was that DataStax maintains in memory cache that contains the configuration of each node, this cache wasn't update when I alter the table since I used cqlsh instead of their SDK.

    After restarting all the node, the in memory cache was dropped and the bug was resolved.