Details
-
Bug
-
Status: Needs Committer
-
Normal
-
Resolution: Unresolved
-
None
-
Correctness - Unrecoverable Corruption / Loss
-
Normal
-
Low Hanging Fruit
-
Adhoc Test
-
All
-
None
-
Description
After migrating data from 2.1.22 (released 2022-06-17) to 3.0.29 (released 2023-05-05), if user performs a rename operation to rename the primary key to an existing column, it will succeed, and the original column will get lost permanently.
Reproduce
Start up single cassandra node 2.1.22
Start up cassandra-cli
bin/cassandra-cli
Execute the following commands using cassandra-cli interface
create keyspace test with strategy_options = {replication_factor:1} and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'; use test; create column family foos with column_type = 'Standard' and comparator = 'BytesType' and key_validation_class = 'UTF8Type' and column_metadata = [{column_name: '2f', validation_class: 'UTF8Type'}];
Stop the daemon
bin/nodetool -h ::FFFF:127.0.0.1 stopdaemon
Upgrade, start up new version, start up cqlsh with bin/cqlsh
cqlsh> desc test.foos ; CREATE TABLE test.foos ( key text PRIMARY KEY, "2f" text ) 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 = 'NONE'; cqlsh> ALTER TABLE test.foos RENAME key TO "2f"; cqlsh> desc test.foos ; CREATE TABLE test.foos ( "2f" text PRIMARY KEY ) 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 = 'NONE'; cqlsh> SELECT * FROM test.foos ; 2f ---- (0 rows)
Root Cause
The root cause is a missing check for the existing column when the table comparator from the old version is BytesType.
I have uploaded the data dir, use it to start up 3.0.29 and execute the commands will reproduce this bug.
Attachments
Attachments
Issue Links
- is related to
-
CASSANDRA-18108 Data loss after a system restart of 3.11.17/4.1.4
- Open
- links to