Search code examples
cassandracqlcqlshgocql

Column added with "ALTER TABLE" doesn't appear when I make a request


I had a table containing those columns:

cassandra@cqlsh:test> DESCRIBE Table "ItemSource";

CREATE TABLE connect."ItemSource" (
    "Identifier" text,
    "SourceID" uuid,
    "ItemID" uuid,
    "Priority" int,
    "AdditionalParams" map<text, text>,
    "Binding" map<text, text>,
    "CountryRestriction" list<text>,
    "ItemSourceID" uuid,
    "Marker" text,
    "Scraped" int,
    "SearchField" text,
    PRIMARY KEY (("Identifier", "SourceID"), "ItemID", "Priority")
) WITH CLUSTERING ORDER BY ("ItemID" ASC, "Priority" ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

I launched the following column to add a column named Limit of type int:

ALTER TABLE "ItemSource" ADD "Limit" int;

The table already contained elements, I updated them all so they have a Limit of 0, if I do the following command using cqlsh, the "Limit" column appears and the values are also present.

But if I do the exact same request using gocql, a Go driver for cassandra, I do not receive the Limit column, but I receive the others, here is the request made:

SELECT * FROM "ItemSource" WHERE "Identifier" = ? AND "ItemID" = ? AND "SourceID" = ? AND "Priority" = ? LIMIT ? ALLOW FILTERING 

I have no idea of what's going on, I tried copying the data to a csv file, then truncating the table and then reimporting the data, still get the same result...

Could it be a caching problem? If yes, how can I empty it. Else, what can it be?


Solution

  • I found a question which was relatively the same than mine and where an answer explained that it was a bug soon to be fixed. Actually, it has been fixed and we just have to wait for the next update (2.1.3).

    https://stackoverflow.com/a/28035521/1405208

    And here is the link to the cassandra issue: CASSANDRA-7910

    Edit: I edit this message because Cassandra 2.1.3 has been released now for a couple of months (actually, it was released the very day I posted this answer, amazing! :)) and the fix works.

    There you go!