List:Commits« Previous MessageNext Message »
From:mattiasj Date:November 23 2007 11:24am
Subject:bk commit into 6.0 tree (mattiasj:1.2671) BUG#30480
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of mattiasj. When mattiasj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-23 12:24:06+01:00, mattiasj@witty. +3 -0
  Bug#30480: Falcon: searches fail if LIKE and key partition
  (also fixes the bugs: 29320, 29493 and 30536)
  
  Problem: Partitioning did not handle unordered scans correctly
  for engines with unordered read order.
  
  Solution: do not stop scanning if a record is out of range, since
  there can be more records within the range afterwards.

  mysql-test/r/partition_falcon.result@stripped, 2007-11-23 12:24:03+01:00, mattiasj@witty. +18 -0
    Bug#30480: Falcon: searches fail if LIKE and key partition
    test result for falcon related partitioning

  mysql-test/r/partition_falcon.result@stripped, 2007-11-23 12:24:03+01:00, mattiasj@witty. +0 -0

  mysql-test/t/partition_falcon.test@stripped, 2007-11-23 12:24:03+01:00, mattiasj@witty. +25 -0
    Bug#30480: Falcon: searches fail if LIKE and key partition
    test case for falcon related partitioning

  mysql-test/t/partition_falcon.test@stripped, 2007-11-23 12:24:03+01:00, mattiasj@witty. +0 -0

  sql/ha_partition.cc@stripped, 2007-11-23 12:24:03+01:00, mattiasj@witty. +4 -2
    Bug#30480: Falcon: searches fail if LIKE and key partition
    
    Problem was that partitioning did not handle unordered scans correctly
    for engines with unordered read order.
    
    Solution: do not stop if a record is out of range, since it can come
    more record withing the range afterwards

diff -Nrup a/mysql-test/r/partition_falcon.result b/mysql-test/r/partition_falcon.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/r/partition_falcon.result	2007-11-23 12:24:03 +01:00
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS t1;
+SET storage_engine = Falcon;
+# Bug #30480
+CREATE TABLE t1 (c1 VARCHAR(3))
+ENGINE=Falcon
+PARTITION BY KEY(c1)
+PARTITIONS 1;
+CREATE INDEX i1 ON t1 (c1);
+INSERT INTO t1 VALUES ('B'), ('A');
+# No result if bug exists
+SELECT * FROM t1 WHERE c1 LIKE 'A%';
+c1
+A
+# But this was not found (if bug exists)
+SELECT * FROM t1 WHERE c1 = 'A';
+c1
+A
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/partition_falcon.test b/mysql-test/t/partition_falcon.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/partition_falcon.test	2007-11-23 12:24:03 +01:00
@@ -0,0 +1,25 @@
+--source include/have_falcon.inc
+--source include/have_partition.inc
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+SET storage_engine = Falcon;
+
+#
+# Bug #30480: Falcon: searches fail if LIKE and key partition
+# (mattiasj 2007-11-23: verified all testcases on the following bugs:
+# 29320, 29493, 30536, 30480, this simple test substitutes them all)
+--echo # Bug #30480
+# simple test on Bug#30480
+CREATE TABLE t1 (c1 VARCHAR(3))
+ENGINE=Falcon
+PARTITION BY KEY(c1)
+PARTITIONS 1;
+# must have index to show the bug
+CREATE INDEX i1 ON t1 (c1);
+INSERT INTO t1 VALUES ('B'), ('A');
+-- echo # No result if bug exists
+SELECT * FROM t1 WHERE c1 LIKE 'A%';
+-- echo # But this was not found (if bug exists)
+SELECT * FROM t1 WHERE c1 = 'A';
+DROP TABLE t1;
diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc
--- a/sql/ha_partition.cc	2007-11-14 14:53:12 +01:00
+++ b/sql/ha_partition.cc	2007-11-23 12:24:03 +01:00
@@ -3986,7 +3986,8 @@ int ha_partition::handle_unordered_next(
   }
   else if (!(error= file->index_next(buf)))
   {
-    if (compare_key(end_range) <= 0)
+    if (!(file->table_flags() & HA_READ_ORDER) ||
+        compare_key(end_range) <= 0)
     {
       m_last_part= m_part_spec.start_part;
       DBUG_RETURN(0);                           // Row was in range
@@ -4063,7 +4064,8 @@ int ha_partition::handle_unordered_scan_
     }
     if (!error)
     {
-      if (compare_key(end_range) <= 0)
+      if (!(file->table_flags() & HA_READ_ORDER) ||
+          compare_key(end_range) <= 0)
       {
         m_last_part= i;
         DBUG_RETURN(0);
Thread
bk commit into 6.0 tree (mattiasj:1.2671) BUG#30480mattiasj23 Nov