You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sergey Leschenko <se...@gmail.com> on 2013/07/26 17:48:53 UTC
AssertionError during ALTER TYPE in 1.2.5
Hi,
I have following column family from pre-CQL times, now using 1.2.5 and
want to investigate ability to use CQL instead of Thrift API.
ColumnFamily: RRD
Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 0.1
DC Local Read repair chance: 0.0
Populate IO Cache on flush: false
Replicate on write: true
Caching: KEYS_ONLY
Bloom Filter FP chance: default
Built indexes: []
Compaction Strategy:
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
Compression Options:
sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor
In cqlsh it looks like
CREATE TABLE "RRD" (
key text,
column1 blob,
value blob,
PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};
I have already successfully changed type of key from blob to text.
column1 is actually a text string, as I would like to change it type
from blob to text too.
But when I run query ALTER TABLE "RRD" ALTER column1 TYPE text,
cqlsh hangs, and I observe following error in Cassandra log:
ERROR 18:28:56,103 Exception in thread Thread[Thrift:16,5,main]
java.lang.AssertionError
at org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:147)
at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:73)
at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:143)
at org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1707)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
>From source code I see that it failed assertion:
case COLUMN_ALIAS:
assert cfDef.isComposite;
So it have to be composite, but there is already exists PRIMARY KEY
(key, column1). Did I miss something?
How can I change type of this column1 ?
Thanks.
--
Sergey
Re: AssertionError during ALTER TYPE in 1.2.5
Posted by Sergey Leschenko <se...@gmail.com>.
Hi,
On Mon, Jul 29, 2013 at 11:23 AM, aaron morton <aa...@thelastpickle.com> wrote:
> The error is because the underlying CF is not defined using a composite type
> for the comparator.
>
> CREATE TABLE "RRD" (
> key text,
> column1 blob,
> value blob,
> PRIMARY KEY (key, column1)
> ) WITH COMPACT STORAGE AND
>
> Looks like this PRIMARY KEY (key, column1) is incorrect.
Sorry for not mentioned before - I do not create this table via CQL.
This Column Family was created long time ago using configuration file
in 0.6.x Cassandra
These are results of "describe table RRD" command in cqlsh, and
"describe RRD;" in cassandra-cli
So now I'm trying to modify existing Column Family with data - to make
it easy to use with CQL.
--
Sergey
RE: AssertionError during ALTER TYPE in 1.2.5
Posted by Adriano Paggi <ad...@pert.com.ar>.
Maybe it's because of the "COMPACT STORAGE". Without that, the cells of a CQL3 table definition will be mapped to a composite taking the clustering part of the key and the column name.
So, i.e. in your case the "value" column should be mapped to a cell with name column1:value if your def not includes the "COMPACT STORAGE" part. I think that the assert tries to ensure that the "alter" applies to a CQL3 table (which column names are composite ones), and not the old "compact".
http://www.datastax.com/dev/blog/thrift-to-cql3
Am I wrong?
Adriano.
________________________________
From: aaron morton [mailto:aaron@thelastpickle.com]
Sent: Lunes, 29 de Julio de 2013 05:23 a.m.
To: user@cassandra.apache.org
Subject: Re: AssertionError during ALTER TYPE in 1.2.5
The error is because the underlying CF is not defined using a composite type for the comparator.
CREATE TABLE "RRD" (
key text,
column1 blob,
value blob,
PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
Looks like this PRIMARY KEY (key, column1) is incorrect.
That says "The Primary Key is made up of a Partition Key and one Clustering Column. The Partition Key (storage engine row key) is the 'key' column. The Clustering Column is 'column1'. The Clustering Column should be used as the first column in a composite type in the storage engine row for each non Primary Key column name"
But your CLI def does not use a composite type for the column validator.
Try
CREATE TABLE "RRD" (
key text,
column1 blob,
value blob,
PRIMARY KEY (key)
) WITH COMPACT STORAGE AND
Hope that helps.
-----------------
Aaron Morton
Cassandra Consultant
New Zealand
@aaronmorton
http://www.thelastpickle.com
On 27/07/2013, at 3:48 AM, Sergey Leschenko <se...@gmail.com>> wrote:
Hi,
I have following column family from pre-CQL times, now using 1.2.5 and
want to investigate ability to use CQL instead of Thrift API.
ColumnFamily: RRD
Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 0.1
DC Local Read repair chance: 0.0
Populate IO Cache on flush: false
Replicate on write: true
Caching: KEYS_ONLY
Bloom Filter FP chance: default
Built indexes: []
Compaction Strategy:
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
Compression Options:
sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor
In cqlsh it looks like
CREATE TABLE "RRD" (
key text,
column1 blob,
value blob,
PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'SnappyCompressor'};
I have already successfully changed type of key from blob to text.
column1 is actually a text string, as I would like to change it type
from blob to text too.
But when I run query ALTER TABLE "RRD" ALTER column1 TYPE text,
cqlsh hangs, and I observe following error in Cassandra log:
ERROR 18:28:56,103 Exception in thread Thread[Thrift:16,5,main]
java.lang.AssertionError
at org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:147)
at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:73)
at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:143)
at org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1707)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
>From source code I see that it failed assertion:
case COLUMN_ALIAS:
assert cfDef.isComposite;
So it have to be composite, but there is already exists PRIMARY KEY
(key, column1). Did I miss something?
How can I change type of this column1 ?
Thanks.
--
Sergey
Re: AssertionError during ALTER TYPE in 1.2.5
Posted by aaron morton <aa...@thelastpickle.com>.
The error is because the underlying CF is not defined using a composite type for the comparator.
> CREATE TABLE "RRD" (
> key text,
> column1 blob,
> value blob,
> PRIMARY KEY (key, column1)
> ) WITH COMPACT STORAGE AND
Looks like this PRIMARY KEY (key, column1) is incorrect.
That says "The Primary Key is made up of a Partition Key and one Clustering Column. The Partition Key (storage engine row key) is the 'key' column. The Clustering Column is 'column1'. The Clustering Column should be used as the first column in a composite type in the storage engine row for each non Primary Key column name"
But your CLI def does not use a composite type for the column validator.
Try
CREATE TABLE "RRD" (
key text,
column1 blob,
value blob,
PRIMARY KEY (key)
) WITH COMPACT STORAGE AND
Hope that helps.
-----------------
Aaron Morton
Cassandra Consultant
New Zealand
@aaronmorton
http://www.thelastpickle.com
On 27/07/2013, at 3:48 AM, Sergey Leschenko <se...@gmail.com> wrote:
> Hi,
> I have following column family from pre-CQL times, now using 1.2.5 and
> want to investigate ability to use CQL instead of Thrift API.
>
> ColumnFamily: RRD
> Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Default column value validator: org.apache.cassandra.db.marshal.BytesType
> Columns sorted by: org.apache.cassandra.db.marshal.BytesType
> GC grace seconds: 864000
> Compaction min/max thresholds: 4/32
> Read repair chance: 0.1
> DC Local Read repair chance: 0.0
> Populate IO Cache on flush: false
> Replicate on write: true
> Caching: KEYS_ONLY
> Bloom Filter FP chance: default
> Built indexes: []
> Compaction Strategy:
> org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
> Compression Options:
> sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor
>
> In cqlsh it looks like
>
> CREATE TABLE "RRD" (
> key text,
> column1 blob,
> value blob,
> PRIMARY KEY (key, column1)
> ) WITH COMPACT STORAGE AND
> bloom_filter_fp_chance=0.010000 AND
> caching='KEYS_ONLY' AND
> comment='' AND
> dclocal_read_repair_chance=0.000000 AND
> gc_grace_seconds=864000 AND
> read_repair_chance=0.100000 AND
> replicate_on_write='true' AND
> populate_io_cache_on_flush='false' AND
> compaction={'class': 'SizeTieredCompactionStrategy'} AND
> compression={'sstable_compression': 'SnappyCompressor'};
>
> I have already successfully changed type of key from blob to text.
> column1 is actually a text string, as I would like to change it type
> from blob to text too.
>
> But when I run query ALTER TABLE "RRD" ALTER column1 TYPE text,
> cqlsh hangs, and I observe following error in Cassandra log:
>
> ERROR 18:28:56,103 Exception in thread Thread[Thrift:16,5,main]
> java.lang.AssertionError
> at org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:147)
> at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:73)
> at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
> at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:143)
> at org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1707)
> at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
> at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
> at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
> at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
> at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:724)
>
> From source code I see that it failed assertion:
> case COLUMN_ALIAS:
> assert cfDef.isComposite;
>
> So it have to be composite, but there is already exists PRIMARY KEY
> (key, column1). Did I miss something?
> How can I change type of this column1 ?
>
> Thanks.
>
> --
> Sergey