0

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.

Nativ
  • 3,092
  • 6
  • 38
  • 69
  • Can you query that column via cqlsh on all of your nodes? – Aaron May 19 '15 at 13:57
  • @BryceAtNetwork23 yes I do, works on every node on every fermutation of data. – Nativ May 19 '15 at 15:43
  • it might have something to do with the cached metadata for the datastax driver. Could you may be try to restart your application server to clear the cache? – kris433 May 20 '15 at 02:39

1 Answers1

0

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.

Nativ
  • 3,092
  • 6
  • 38
  • 69
  • Which version of the driver were you using? It is supposed to refresh its metadata, even if a third-party (like cqlsh) is making the schema changes (see http://docs.datastax.com/en/developer/java-driver/3.1/manual/metadata/#refreshes). I'm having similar problems with the 2.1 driver. – Tom Nov 21 '16 at 21:44