Commit 38d4e025 authored by Sergey Petrunya's avatar Sergey Petrunya

# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY

- Fix typo in ha_cassandra::rnd_pos().
- in ::index_read_map(), do not assume that pk column is part of table->read_set.
parent 06ea60d2
......@@ -59,3 +59,11 @@ rowkey11 data1-value2 34543
rowkey10 data1-value 123456
delete from t1;
drop table t1;
#
# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
#
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
......@@ -43,6 +43,8 @@ CREATE KEYSPACE mariadbtest2
USE mariadbtest2;
create columnfamily cf1 ( pk varchar primary key, data1 varchar, data2 bigint);
create columnfamily cf2 (rowkey bigint primary key, a bigint);
--enable_parsing
############################################################################
## Cassandra initialization ends
......@@ -96,6 +98,17 @@ select * from t1 order by data2;
delete from t1;
drop table t1;
--echo #
--echo # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
--echo #
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
############################################################################
## Cassandra cleanup
############################################################################
......
......@@ -645,8 +645,14 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key,
char *cass_key;
int cass_key_len;
my_bitmap_map *old_map;
old_map= dbug_tmp_use_all_columns(table, table->read_set);
rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len);
dbug_tmp_restore_column_map(table->read_set, old_map);
bool found;
if (se->get_slice(cass_key, cass_key_len, &found))
{
......@@ -879,6 +885,7 @@ int ha_cassandra::rnd_pos(uchar *buf, uchar *pos)
DBUG_ENTER("ha_cassandra::rnd_pos");
int save_active_index= active_index;
active_index= 0; /* The primary key */
rc= index_read_map(buf, pos, key_part_map(1), HA_READ_KEY_EXACT);
active_index= save_active_index;
......
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