1

I'm trying to migrate some data from one Cassandra cluster to another using CQLSH's COPY, but I've run into a strange issue with one of the column families. The schema of foo.quux, as described by cqslsh, looks like this:

CREATE TABLE foo.quux (
    key blob,
    column1 blob,
    value blob,
    PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE
    AND CLUSTERING ORDER BY (column1 ASC)
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.SnappyCompressor'}
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 0
    AND gc_grace_seconds = 86400
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.1
    AND speculative_retry = '99.0PERCENTILE';

However, when querying this table/column it responds with:

[cqlsh 5.0.1 | Cassandra 2.1.15 | CQL spec 3.2.1 | Native protocol v3]
Use HELP for help.
cqlsh> select * from foo.quux limit 3;

 key                                                                  | column1                  | column2 | value
----------------------------------------------------------------------+--------------------------+---------+------------------------
 0x443635316337656439326336373436363661623363373833616131626364623762 | 0x31e2988335373035393739 |    0x61 |             0x54727565
 0x443635316337656439326336373436363661623363373833616131626364623762 | 0x31e2988335373035393739 |    0x63 | 0x31343739393832343931
 0x443635316337656439326336373436363661623363373833616131626364623762 | 0x31e2988335373035393739 |  0x6c72 |             0x4e6f6e65

(3 rows)

Note that this output has a column2 that is not reperesented in the schema! I am wondering if this has anything to do with foo.quux being a supercolumn, according to cassandra-cli (this, too, is not represented in the QCLSH schema output as far as I understand):

create column family quux
  with column_type = 'Super'
  and comparator = 'BytesType'
  and subcomparator = 'BytesType'
  and default_validation_class = 'BytesType'
  and key_validation_class = 'BytesType'
  and read_repair_chance = 0.1
  and dclocal_read_repair_chance = 0.0
  and gc_grace = 86400
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and cells_per_row_to_cache = '0'
  and default_time_to_live = 0
  and speculative_retry = '99.0PERCENTILE'
  and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};

So, I suspect that the problem is that cqslsh is showing the wrong schema, for some reason, and that column2 is somehow missing from the schema. Any help figuring out how to recover from this would be extremely welcome.

It may help to know that this cluster originally (well, in the nearly 2 years I've been here) ran version 1.2, but was upgraded to 2.0 and then 2.1 a few months ago. We haven't noticed any bad effects of this upgrade.

Also, I have very little experience with Cassandra so if you're thinking "this sounds like X, but they must have thought of that already" then suggest it anyway—because I most likely haven't thought of that.

Stig Brautaset
  • 2,602
  • 1
  • 22
  • 39

1 Answers1

1

Mystery solved? I tried connecting to the cluster with a different cqlsh program (directly from my Mac), but the cluster now reported that CQLVersion of 3.3.1 was not supported, and I had to use 3.2.1 instead. Now I get a different result from DESCRIBE:

cqlsh --cqlversion 3.2.1 52.206.209.178 -e 'DESCRIBE foo.quux;'

/*
Warning: Table foo.quux omitted because it has constructs not compatible with CQL (was created via legacy API).

Approximate structure, for reference:
(this should not be used to reproduce this schema)

CREATE TABLE foo.quux (
    key blob,
    column1 blob,
    value blob,
    column2 blob,
    PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE
    AND CLUSTERING ORDER BY (column1 ASC)
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 0
    AND gc_grace_seconds = 86400
    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 = 'NONE';
*/

It looks like the schema was created via Thrift, and cannot be represented properly using CQL.

Stig Brautaset
  • 2,602
  • 1
  • 22
  • 39