I tried as you said with cassandra-cli, and still unsuccessfully
[default@unknown] use test1;
Authenticated to keyspace: test1
[default@test1] UPDATE COLUMN FAMILY pns_credentials with
compaction_strategy='LeveledCompactionStrategy';
8ed12919-ef2b-327f-8f57-4c2de26c9d51
Waiting for schema agreement...
... schemas agree across the cluster
And then, when I check the compaction strategy, it is still
SizeTieredCompactionStrategy
[default@test1] describe pns_credentials;
ColumnFamily: pns_credentials
Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Default column value validator:
org.apache.cassandra.db.marshal.UTF8Type
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 0.1
DC Local Read repair chance: 0.0
Replicate on write: true
Caching: KEYS_ONLY
Bloom Filter FP chance: default
Built indexes: []
Column Metadata:
Column Name: isnew
Validation Class: org.apache.cassandra.db.marshal.Int32Type
Column Name: ts
Validation Class: org.apache.cassandra.db.marshal.DateType
Column Name: mergestatus
Validation Class: org.apache.cassandra.db.marshal.Int32Type
Column Name: infranetaccount
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: user_level
Validation Class: org.apache.cassandra.db.marshal.Int32Type
Column Name: msisdn
Validation Class: org.apache.cassandra.db.marshal.LongType
Column Name: mergeusertype
Validation Class: org.apache.cassandra.db.marshal.Int32Type
Compaction Strategy:
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
Compression Options:
sstable_compression:
org.apache.cassandra.io.compress.SnappyCompressor
I tried also to create a new table with LeveledCompactionStrategy (using
cqlsh), and when I check the compaction strategy, the
SizeTieredCompactionStrategy is set for this table.
cqlsh:test1> CREATE TABLE pns_credentials3 (
... ise text PRIMARY KEY,
... isnew int,
... ts timestamp,
... mergestatus int,
... infranetaccount text,
... user_level int,
... msisdn bigint,
... mergeusertype int
... ) WITH
... comment='' AND
... read_repair_chance=0.100000 AND
... gc_grace_seconds=864000 AND
... compaction_strategy_class='LeveledCompactionStrategy' AND
...
compression_parameters:sstable_compression='SnappyCompressor';
cqlsh:test1> describe table pns_credentials3
CREATE TABLE pns_credentials3 (
ise text PRIMARY KEY,
isnew int,
ts timestamp,
mergestatus int,
infranetaccount text,
user_level int,
msisdn bigint,
mergeusertype int
) WITH
comment='' AND
comparator=text AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
default_validation=text AND
min_compaction_threshold=4 AND
max_compaction_threshold=32 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';
Maybe something is wrong in my server.
Any idea ?
Thanks.
Jean-Armel
2012/8/30 feedly team <[email protected]>
> in cassandra-cli, i did something like:
>
> update column family xyz with
> compaction_strategy='LeveledCompactionStrategy'
>
>
> On Thu, Aug 30, 2012 at 5:20 AM, Jean-Armel Luce <[email protected]>wrote:
>
>>
>> Hello,
>>
>> I am using Cassandra 1.1.1 and CQL3.
>> I have a cluster with 1 node (test environment)
>> Could you tell how to set the compaction strategy to Leveled Strategy for
>> an existing table ?
>>
>> I have a table pns_credentials
>>
>> jal@jal-VirtualBox:~/cassandra/apache-cassandra-1.1.1/bin$ ./cqlsh -3
>> Connected to Test Cluster at localhost:9160.
>> [cqlsh 2.2.0 | Cassandra 1.1.1 | CQL spec 3.0.0 | Thrift protocol 19.32.0]
>> Use HELP for help.
>> cqlsh> use test1;
>> cqlsh:test1> describe table pns_credentials;
>>
>> CREATE TABLE pns_credentials (
>> ise text PRIMARY KEY,
>> isnew int,
>> ts timestamp,
>> mergestatus int,
>> infranetaccount text,
>> user_level int,
>> msisdn bigint,
>> mergeusertype int
>> ) WITH
>> comment='' AND
>> comparator=text AND
>> read_repair_chance=0.100000 AND
>> gc_grace_seconds=864000 AND
>> default_validation=text AND
>> min_compaction_threshold=4 AND
>> max_compaction_threshold=32 AND
>> replicate_on_write='true' AND
>> compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> compression_parameters:sstable_compression='SnappyCompressor';
>>
>> I want to set the LeveledCompaction strategy for this table, so I execute
>> the following ALTER TABLE :
>>
>> cqlsh:test1> alter table pns_credentials
>> ... WITH compaction_strategy_class='LeveledCompactionStrategy'
>> ... AND compaction_strategy_options:sstable_size_in_mb=10;
>>
>> In Cassandra logs, I see some informations :
>> INFO 10:23:52,532 Enqueuing flush of
>> Memtable-schema_columnfamilies@965212657(1391/1738 serialized/live
>> bytes, 20 ops)
>> INFO 10:23:52,533 Writing Memtable-schema_columnfamilies@965212657(1391/1738
>> serialized/live bytes, 20 ops)
>> INFO 10:23:52,629 Completed flushing
>> /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-hd-94-Data.db
>> (1442 bytes) for commitlog position ReplayPosition(segmentId=3556583843054,
>> position=1987)
>>
>>
>> However, when I look at the description of the table, the table is still
>> with the SizeTieredCompactionStrategy
>> cqlsh:test1> describe table pns_credentials ;
>>
>> CREATE TABLE pns_credentials (
>> ise text PRIMARY KEY,
>> isnew int,
>> ts timestamp,
>> mergestatus int,
>> infranetaccount text,
>> user_level int,
>> msisdn bigint,
>> mergeusertype int
>> ) WITH
>> comment='' AND
>> comparator=text AND
>> read_repair_chance=0.100000 AND
>> gc_grace_seconds=864000 AND
>> default_validation=text AND
>> min_compaction_threshold=4 AND
>> max_compaction_threshold=32 AND
>> replicate_on_write='true' AND
>> compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> compression_parameters:sstable_compression='SnappyCompressor';
>>
>> In the schema_columnfamilies table (in system keyspace), the table
>> pns_credentials is still using the SizeTieredCompactionStrategy
>> cqlsh:test1> use system;
>> cqlsh:system> select * from schema_columnfamilies ;
>> ...
>> test1 | pns_credentials | null | KEYS_ONLY
>> | [] | |
>> org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
>> | {}
>> |
>> org.apache.cassandra.db.marshal.UTF8Type |
>> {"sstable_compression":"org.apache.cassandra.io.compress.SnappyCompressor"}
>> | org.apache.cassandra.db.marshal.UTF8Type | 864000 |
>> 1029 | ise | org.apache.cassandra.db.marshal.UTF8Type
>> | 0 | 32
>> | 4 | 0.1 | True
>> | null | Standard | null
>> ...
>>
>>
>> I stopped/started the Cassandra node, but the table is still with
>> SizeTieredCompactionStrategy
>>
>> I tried using cassandra-cli, but the alter is still unsuccessfull.
>>
>> Is there anything I am missing ?
>>
>>
>> Thanks.
>>
>> Jean-Armel
>>
>
>