[Commits] Rev 3492: Make ha_cassandra work with filesort(). in file:///data0/psergey/dev2/5.5-cassandra-r01/

Sergey Petrunya psergey at askmonty.org
Tue Aug 21 17:38:28 EEST 2012


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

------------------------------------------------------------
revno: 3492
revision-id: psergey at askmonty.org-20120821143827-1gfv6fmua0cu29sl
parent: psergey at askmonty.org-20120820080829-m5hixakcwpbd42mf
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-cassandra-r01
timestamp: Tue 2012-08-21 18:38:27 +0400
message:
  Make ha_cassandra work with filesort().
=== modified file 'mysql-test/r/cassandra.result'
--- a/mysql-test/r/cassandra.result	2012-08-19 09:21:23 +0000
+++ b/mysql-test/r/cassandra.result	2012-08-21 14:38:27 +0000
@@ -45,4 +45,17 @@
 delete from t1;
 select * from t1;
 rowkey	data1	data2
+#
+# A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ,
+#  also check ::rnd_pos()
+#
+insert into t1 values ('rowkey10', 'data1-value', 123456);
+insert into t1 values ('rowkey11', 'data1-value2', 34543);
+insert into t1 values ('rowkey12', 'data1-value3', 454);
+select * from t1 order by data2;
+rowkey	data1	data2
+rowkey12	data1-value3	454
+rowkey11	data1-value2	34543
+rowkey10	data1-value	123456
+delete from t1;
 drop table t1;

=== modified file 'mysql-test/t/cassandra.test'
--- a/mysql-test/t/cassandra.test	2012-08-19 09:21:23 +0000
+++ b/mysql-test/t/cassandra.test	2012-08-21 14:38:27 +0000
@@ -84,6 +84,16 @@
 delete from t1;
 select * from t1;
 
+--echo #
+--echo # A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ,
+--echo #  also check ::rnd_pos()
+--echo #
+insert into t1 values ('rowkey10', 'data1-value', 123456);
+insert into t1 values ('rowkey11', 'data1-value2', 34543);
+insert into t1 values ('rowkey12', 'data1-value3', 454);
+select * from t1 order by data2;
+
+delete from t1;
 drop table t1;
 
 ############################################################################

=== modified file 'storage/cassandra/ha_cassandra.cc'
--- a/storage/cassandra/ha_cassandra.cc	2012-08-20 08:08:29 +0000
+++ b/storage/cassandra/ha_cassandra.cc	2012-08-21 14:38:27 +0000
@@ -755,7 +755,10 @@
   bool bres;
   DBUG_ENTER("ha_cassandra::rnd_init");
   if (!scan)
-    DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+  {
+    /* Prepare for rnd_pos() calls. We don't need to anything. */
+    DBUG_RETURN(0);
+  }
 
   se->clear_read_columns();
   for (uint i= 1; i < table->s->fields; i++)

=== modified file 'storage/cassandra/ha_cassandra.h'
--- a/storage/cassandra/ha_cassandra.h	2012-08-20 08:08:29 +0000
+++ b/storage/cassandra/ha_cassandra.h	2012-08-21 14:38:27 +0000
@@ -78,11 +78,17 @@
   ulonglong table_flags() const
   {
     /*
-      We are saying that this engine is just statement capable to have
-      an engine that can only handle statement-based logging. This is
-      used in testing.
+      HA_BINLOG_STMT_CAPABLE
+        We are saying that this engine is just statement capable to have
+        an engine that can only handle statement-based logging. This is
+        used in testing.
+      HA_REC_NOT_IN_SEQ 
+        If we don't set it, filesort crashes, because it assumes rowids are 
+        1..8 byte numbers 
     */
-    return HA_BINLOG_STMT_CAPABLE;
+    return HA_BINLOG_STMT_CAPABLE | 
+           HA_REC_NOT_IN_SEQ; 
+
   }
 
   /** @brief



More information about the commits mailing list