Commit 869826d7 authored by Sergey Petrunya's avatar Sergey Petrunya

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.
parent 8eb16159
...@@ -156,3 +156,13 @@ Cassandra_multiget_keys_scanned 16 ...@@ -156,3 +156,13 @@ Cassandra_multiget_keys_scanned 16
Cassandra_multiget_rows_read 16 Cassandra_multiget_rows_read 16
delete from t1; delete from t1;
drop table 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;
...@@ -159,9 +159,19 @@ insert into t1 values(7, 8); ...@@ -159,9 +159,19 @@ insert into t1 values(7, 8);
select * from t1 A, t1 B where B.rowkey=A.a; select * from t1 A, t1 B where B.rowkey=A.a;
show status like 'cassandra_multi%'; show status like 'cassandra_multi%';
delete from t1; delete from t1;
drop table 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 ## Cassandra cleanup
############################################################################ ############################################################################
......
...@@ -142,7 +142,12 @@ static int cassandra_init_func(void *p) ...@@ -142,7 +142,12 @@ static int cassandra_init_func(void *p)
cassandra_hton->state= SHOW_OPTION_YES; cassandra_hton->state= SHOW_OPTION_YES;
cassandra_hton->create= cassandra_create_handler; 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->table_options= cassandra_table_option_list;
//cassandra_hton->field_options= example_field_option_list; //cassandra_hton->field_options= example_field_option_list;
cassandra_hton->field_options= NULL; cassandra_hton->field_options= NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment