[Commits] Rev 3493: # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY in file:///data0/psergey/dev2/5.5-cassandra-r01/

Sergey Petrunya psergey at askmonty.org
Thu Aug 23 15:15:28 EEST 2012


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

------------------------------------------------------------
revno: 3493
revision-id: psergey at askmonty.org-20120823121528-1p4qx0yzc7ktdcc9
parent: psergey at askmonty.org-20120821143827-1gfv6fmua0cu29sl
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-cassandra-r01
timestamp: Thu 2012-08-23 16:15:28 +0400
message:
  # 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.
=== modified file 'mysql-test/r/cassandra.result'
--- a/mysql-test/r/cassandra.result	2012-08-21 14:38:27 +0000
+++ b/mysql-test/r/cassandra.result	2012-08-23 12:15:28 +0000
@@ -59,3 +59,11 @@
 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;

=== modified file 'mysql-test/t/cassandra.test'
--- a/mysql-test/t/cassandra.test	2012-08-21 14:38:27 +0000
+++ b/mysql-test/t/cassandra.test	2012-08-23 12:15:28 +0000
@@ -43,6 +43,8 @@
 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 @@
 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
 ############################################################################

=== modified file 'storage/cassandra/ha_cassandra.cc'
--- a/storage/cassandra/ha_cassandra.cc	2012-08-21 14:38:27 +0000
+++ b/storage/cassandra/ha_cassandra.cc	2012-08-23 12:15:28 +0000
@@ -645,8 +645,14 @@
 
   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 @@
   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;



More information about the commits mailing list