You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Laxmikant Upadhyay (JIRA)" <ji...@apache.org> on 2018/07/10 10:57:00 UTC
[jira] [Updated] (CASSANDRA-14564) issue while adding a column in a
table with compact storage
[ https://issues.apache.org/jira/browse/CASSANDRA-14564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Laxmikant Upadhyay updated CASSANDRA-14564:
-------------------------------------------
Description:
I have upgraded my system from cassandra 2.1.16 to 3.11.2. We had some tables with COMPACT STORAGE enabled. We see some weird behaviour of cassandra while adding a column into it.
Cassandra does not give any error while altering however the added column is invisible.
Same behaviour when we create a new table with compact storage and try to alter it. Below is the commands ran in sequence:
{code:java}
x@cqlsh:xuser> CREATE TABLE xuser.employee(emp_id int PRIMARY KEY,emp_name text, emp_city text, emp_sal varint, emp_phone varint ) WITH COMPACT STORAGE;
x@cqlsh:xuser> desc table xuser.employee ;
CREATE TABLE xuser.employee (
emp_id int PRIMARY KEY,
emp_city text,
emp_name text,
emp_phone varint,
emp_sal varint
) WITH COMPACT STORAGE
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
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 = '99PERCENTILE';{code}
Now altering the table by adding a new column:
{code:java}
x@cqlsh:xuser> alter table employee add profile text;
x@cqlsh:xuser> desc table xuser.employee ;
CREATE TABLE xuser.employee (
emp_id int PRIMARY KEY,
emp_city text,
emp_name text,
emp_phone varint,
emp_sal varint
) WITH COMPACT STORAGE
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
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 = '99PERCENTILE';
{code}
notice that above desc table result does not have newly added column profile. However when i try to add it again it gives column already exist;
{code:java}
x@cqlsh:xuser> alter table employee add profile text;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid column name profile because it conflicts with an existing column"
x@cqlsh:xuser> select emp_name,profile from employee;
emp_name | profile
----------+---------
(0 rows)
x@cqlsh:xuser>
{code}
Inserting also behaves strange:
{code:java}
x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Some clustering keys are missing: column1"
x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile,column1) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE',null);
x@cqlsh:xuser> select * from employee;
emp_id | emp_city | emp_name | emp_phone | emp_sal
--------+----------+----------+-----------+---------
(0 rows)
{code}
was:
I have upgraded my system from cassandra 2.1.16 to 3.11.2. We had some tables with COMPACT STORAGE enabled. We see some weird behaviour of cassandra while adding a column into it.
The cassandra does not gives any error while altering however the added column is invisible.
This same behaviour when we create a new table with compact storage and try to alter it. Below is the commands ran in sequence:
{code:java}
x@cqlsh:xuser> CREATE TABLE xuser.employee(emp_id int PRIMARY KEY,emp_name text, emp_city text, emp_sal varint, emp_phone varint ) WITH COMPACT STORAGE;
x@cqlsh:xuser> desc table xuser.employee ;
CREATE TABLE xuser.employee (
emp_id int PRIMARY KEY,
emp_city text,
emp_name text,
emp_phone varint,
emp_sal varint
) WITH COMPACT STORAGE
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
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 = '99PERCENTILE';{code}
Now altering the table by adding a new column:
{code:java}
x@cqlsh:xuser> alter table employee add profile text;
x@cqlsh:xuser> desc table xuser.employee ;
CREATE TABLE xuser.employee (
emp_id int PRIMARY KEY,
emp_city text,
emp_name text,
emp_phone varint,
emp_sal varint
) WITH COMPACT STORAGE
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
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 = '99PERCENTILE';
{code}
notice that above desc table result does not have newly added column profile. However when i try to add it again it gives column already exist;
{code:java}
x@cqlsh:xuser> alter table employee add profile text;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid column name profile because it conflicts with an existing column"
x@cqlsh:xuser> select emp_name,profile from employee;
emp_name | profile
----------+---------
(0 rows)
x@cqlsh:xuser>
{code}
Inserting also behaves strange:
{code:java}
x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Some clustering keys are missing: column1"
x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile,column1) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE',null);
x@cqlsh:xuser> select * from employee;
emp_id | emp_city | emp_name | emp_phone | emp_sal
--------+----------+----------+-----------+---------
(0 rows)
{code}
> issue while adding a column in a table with compact storage
> --------------------------------------------------------------
>
> Key: CASSANDRA-14564
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14564
> Project: Cassandra
> Issue Type: Bug
> Components: Core, CQL
> Reporter: Laxmikant Upadhyay
> Priority: Major
>
> I have upgraded my system from cassandra 2.1.16 to 3.11.2. We had some tables with COMPACT STORAGE enabled. We see some weird behaviour of cassandra while adding a column into it.
> Cassandra does not give any error while altering however the added column is invisible.
> Same behaviour when we create a new table with compact storage and try to alter it. Below is the commands ran in sequence:
>
> {code:java}
> x@cqlsh:xuser> CREATE TABLE xuser.employee(emp_id int PRIMARY KEY,emp_name text, emp_city text, emp_sal varint, emp_phone varint ) WITH COMPACT STORAGE;
> x@cqlsh:xuser> desc table xuser.employee ;
> CREATE TABLE xuser.employee (
> emp_id int PRIMARY KEY,
> emp_city text,
> emp_name text,
> emp_phone varint,
> emp_sal varint
> ) WITH COMPACT STORAGE
> AND bloom_filter_fp_chance = 0.01
> AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
> AND comment = ''
> AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
> AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
> AND crc_check_chance = 1.0
> 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 = '99PERCENTILE';{code}
> Now altering the table by adding a new column:
>
> {code:java}
> x@cqlsh:xuser> alter table employee add profile text;
> x@cqlsh:xuser> desc table xuser.employee ;
> CREATE TABLE xuser.employee (
> emp_id int PRIMARY KEY,
> emp_city text,
> emp_name text,
> emp_phone varint,
> emp_sal varint
> ) WITH COMPACT STORAGE
> AND bloom_filter_fp_chance = 0.01
> AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
> AND comment = ''
> AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
> AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
> AND crc_check_chance = 1.0
> 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 = '99PERCENTILE';
> {code}
> notice that above desc table result does not have newly added column profile. However when i try to add it again it gives column already exist;
> {code:java}
> x@cqlsh:xuser> alter table employee add profile text;
> InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid column name profile because it conflicts with an existing column"
> x@cqlsh:xuser> select emp_name,profile from employee;
> emp_name | profile
> ----------+---------
> (0 rows)
> x@cqlsh:xuser>
> {code}
> Inserting also behaves strange:
> {code:java}
> x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE');
> InvalidRequest: Error from server: code=2200 [Invalid query] message="Some clustering keys are missing: column1"
> x@cqlsh:xuser> INSERT INTO employee (emp_id , emp_city , emp_name , emp_phone , emp_sal ,profile,column1) VALUES ( 1, 'ggn', 'john', 123456, 50000, 'SE',null);
> x@cqlsh:xuser> select * from employee;
> emp_id | emp_city | emp_name | emp_phone | emp_sal
> --------+----------+----------+-----------+---------
> (0 rows)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org