We're updating the issue view to help you get more done. 

Cassandra: TRUNCATE TABLE on a Cassandra table does not remove rows

Description

Test case:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 # Make sure your cassandra is running, # and thrift is on LD_LIBRARY_PATH, # and cqlsh is on the system PATH --source include/have_cassandra.inc --remove_files_wildcard $MYSQLTEST_VARDIR test.cql --write_file $MYSQLTEST_VARDIR/test.cql DROP KEYSPACE bug_ks; EOF --error 0,1,2 --system cqlsh -3 -f $MYSQLTEST_VARDIR/test.cql --remove_file $MYSQLTEST_VARDIR/test.cql --write_file $MYSQLTEST_VARDIR/test.cql CREATE KEYSPACE bug_ks WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor='1'; USE bug_ks; CREATE COLUMNFAMILY cf1 ( pk bigint primary key, a bigint ); EOF --system cqlsh -3 -f $MYSQLTEST_VARDIR/test.cql DROP TABLE IF EXISTS t1; CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='bug_ks' column_family = 'cf1'; INSERT INTO t1 VALUES (1,1),(2,2); SELECT * FROM t1; TRUNCATE TABLE t1; SELECT * FROM t1; # Cleanup DROP TABLE t1;

Current result:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 DROP TABLE IF EXISTS t1; Warnings: Note 1051 Unknown table 't1' CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA thrift_host='localhost' keyspace='bug_ks' column_family = 'cf1'; INSERT INTO t1 VALUES (1,1),(2,2); SELECT * FROM t1; rowkey a 1 1 2 2 TRUNCATE TABLE t1; SELECT * FROM t1; rowkey a 1 1 2 2 DROP TABLE t1;

bzr version-info:

1 2 3 4 revision-id: psergey@askmonty.org-20120823121528-1p4qx0yzc7ktdcc9 date: 2012-08-23 16:15:28 +0400 build-date: 2012-08-24 00:05:46 +0400 revno: 3493

Environment

None

Status

Assignee

Sergei Petrunia

Reporter

Elena Stepanova

Fix versions

Priority

Minor