MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:July 28 2010 9:02pm
Subject:bzr commit into mysql-trunk-bugfixing branch (gshchepa:3158) Bug#55472
View as plain text  
#At file:///mnt/sda7/work/mysql-trunk-bugfixing/ based on revid:davi.arnaut@stripped

 3158 Gleb Shchepa	2010-07-29
      Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c on
                  DELETE statement
      
      Single-table delete ordered by a field that has a hash-type index
      may cause an assertion failure or a crash.
      
      An optimization added by the fix for the bug 36569 forced the
      optimizer to use ORDER BY-compatible indices when applicable.
      
      However, the existence of unsorted indices (HASH index algorithm
      for some engines such as MEMORY/HEAP, NDB) was ignored.
      
      The test_if_order_by_key function has been modified to skip
      unsorted indices.
     @ mysql-test/r/heap_hash.result
        Test case for bug #55472.
     @ mysql-test/t/heap_hash.test
        Test case for bug #55472.
     @ sql/sql_select.cc
        Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c on
                    DELETE statement
        
        The test_if_order_by_key function has been modified to skip
        unsorted indices.

    modified:
      mysql-test/r/heap_hash.result
      mysql-test/t/heap_hash.test
      sql/sql_select.cc
=== modified file 'mysql-test/r/heap_hash.result'
--- a/mysql-test/r/heap_hash.result	2010-02-20 10:07:32 +0000
+++ b/mysql-test/r/heap_hash.result	2010-07-28 21:02:43 +0000
@@ -382,3 +382,14 @@ INSERT INTO t1 VALUES('A ', 'A ');
 ERROR 23000: Duplicate entry 'A -A ' for key 'key1'
 DROP TABLE t1;
 End of 5.0 tests
+#
+# Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c
+#             on DELETE statement
+#
+CREATE TABLE t1 (col_int_nokey INT,
+col_int_key INT,
+INDEX(col_int_key) USING HASH) ENGINE = HEAP;
+INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1);
+DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
+DROP TABLE t1;
+End of 5.5 tests

=== modified file 'mysql-test/t/heap_hash.test'
--- a/mysql-test/t/heap_hash.test	2007-06-06 17:57:07 +0000
+++ b/mysql-test/t/heap_hash.test	2010-07-28 21:02:43 +0000
@@ -284,3 +284,20 @@ INSERT INTO t1 VALUES('A ', 'A ');
 DROP TABLE t1;
 
 --echo End of 5.0 tests
+
+--echo #
+--echo # Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c
+--echo #             on DELETE statement
+--echo #
+
+CREATE TABLE t1 (col_int_nokey INT,
+                 col_int_key INT,
+		 INDEX(col_int_key) USING HASH) ENGINE = HEAP;
+INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1);
+
+DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
+
+DROP TABLE t1;
+
+--echo End of 5.5 tests
+

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-07-23 20:09:27 +0000
+++ b/sql/sql_select.cc	2010-07-28 21:02:43 +0000
@@ -13244,7 +13244,7 @@ static int test_if_order_by_key(ORDER *o
         DBUG_RETURN(0);
     }
 
-    if (key_part->field != field)
+    if (key_part->field != field || !field->part_of_sortkey.is_set(idx))
       DBUG_RETURN(0);
 
     /* set flag to 1 if we can use read-next on key, else to -1 */


Attachment: [text/bzr-bundle] bzr/gshchepa@mysql.com-20100728210243-xtk36six53dyl3ln.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (gshchepa:3158) Bug#55472Gleb Shchepa29 Jul