[Commits] Rev 3497: MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows in file:///data0/psergey/dev2/5.5-cassandra-r01/

Sergey Petrunya psergey at askmonty.org
Tue Aug 28 11:53:34 EEST 2012


At file:///data0/psergey/dev2/5.5-cassandra-r01/

------------------------------------------------------------
revno: 3497
revision-id: psergey at askmonty.org-20120828085333-b8fk493v8wvczu5b
parent: psergey at askmonty.org-20120827044458-y0x419xfr7n22q1q
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-cassandra-r01
timestamp: Tue 2012-08-28 12:53:33 +0400
message:
  MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
  - Remove HTON_CAN_RECREATE flag, re-create won't delete rows in cassandra.
=== modified file 'mysql-test/r/cassandra.result'
--- a/mysql-test/r/cassandra.result	2012-08-27 04:44:58 +0000
+++ b/mysql-test/r/cassandra.result	2012-08-28 08:53:33 +0000
@@ -156,3 +156,13 @@
 Cassandra_multiget_rows_read	16
 delete from t1;
 drop table t1;
+#
+# MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
+#
+CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
+thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
+INSERT INTO t1 VALUES (0,0),(1,1),(2,2);
+truncate table t1;
+select * from t1;
+rowkey	a
+drop table t1;

=== modified file 'mysql-test/t/cassandra.test'
--- a/mysql-test/t/cassandra.test	2012-08-27 04:44:58 +0000
+++ b/mysql-test/t/cassandra.test	2012-08-28 08:53:33 +0000
@@ -159,9 +159,19 @@
 select * from t1 A, t1 B where B.rowkey=A.a;
 show status like 'cassandra_multi%';
 
-
 delete from t1;
 drop table t1;
+
+--echo #
+--echo # MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
+--echo #
+CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
+  thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
+INSERT INTO t1 VALUES (0,0),(1,1),(2,2);
+truncate table t1;
+select * from t1;
+drop table t1;
+ 
 ############################################################################
 ## Cassandra cleanup
 ############################################################################

=== modified file 'storage/cassandra/ha_cassandra.cc'
--- a/storage/cassandra/ha_cassandra.cc	2012-08-27 04:44:58 +0000
+++ b/storage/cassandra/ha_cassandra.cc	2012-08-28 08:53:33 +0000
@@ -142,7 +142,12 @@
 
   cassandra_hton->state=   SHOW_OPTION_YES;
   cassandra_hton->create=  cassandra_create_handler;
-  cassandra_hton->flags=   HTON_CAN_RECREATE;
+  /* 
+    Don't specify HTON_CAN_RECREATE in flags. re-create is used by TRUNCATE
+    TABLE to create an *empty* table from scratch. Cassandra table won't be
+    emptied if re-created.
+  */
+  cassandra_hton->flags=   0; 
   cassandra_hton->table_options= cassandra_table_option_list;
   //cassandra_hton->field_options= example_field_option_list;
   cassandra_hton->field_options= NULL;



More information about the commits mailing list