List:Commits« Previous MessageNext Message »
From:Satya B Date:August 6 2009 11:31am
Subject:bzr commit into mysql-5.1-bugteam branch (satya.bn:3057) Bug#45816
View as plain text  
#At file:///home/satya/WORK/45816/mysql-5.1-bugteam-45816/ based on revid:dao-gang.qu@stripped

 3057 Satya B	2009-08-06
      Fix for BUG#45816 - assertion failure with index containing double 
                          column on partitioned table
            
            
      An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
      is executed with index containing double column on partitioned table.
      The problem is that assertion expects all the fields which are read,
      to be in the read_set.
            
      In this query only the field 'a' is in the readset as the tables in
      the query are joined by the field 'a' and so the assertion fails 
      expecting other field 'b'.
            
      Since the function cmp() is just comparison of two parameters passed, 
      the assertion is not required.
            
      Fixed by removing the assertion in the double fields comparision
      function and also fixed the index initialization to do ordered
      index scan with RW LOCK which ensures all the fields from a key are in
      the read_set.
       
      
      Note: this bug is not reproducible with other datatypes because the
            assertion doesn't exist in comparision function for other 
            datatypes.
      modified:
        mysql-test/r/partition.result
        mysql-test/t/partition.test
        sql/field.cc
        sql/ha_partition.cc

per-file messages:
  mysql-test/r/partition.result
    Testcase for BUG#45816
  mysql-test/t/partition.test
    Testcase for BUG#45816
  sql/field.cc
    Removed the assertion ASSERT_COLUMN_MARED_FOR_READ in Field_double::cmp()
    function
  sql/ha_partition.cc
    Fixed index_int() method to make it initialize the read_set properly if
    ordered index scan with RW lock is requested.
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2009-07-31 23:39:26 +0000
+++ b/mysql-test/r/partition.result	2009-08-06 11:31:26 +0000
@@ -1985,4 +1985,23 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=M
 PARTITION BY HASH(id) PARTITIONS 2;
 DROP TABLE t1;
 SET SESSION SQL_MODE=DEFAULT;
+#
+# BUG#45816 - assertion failure with index containing double 
+#             column on partitioned table
+#
+CREATE TABLE t1 (
+a INT DEFAULT NULL,
+b DOUBLE DEFAULT NULL,
+c INT DEFAULT NULL,
+KEY idx2(b,a)
+) PARTITION BY HASH(c) PARTITIONS 3;
+INSERT INTO t1 VALUES (6,8,9);
+INSERT INTO t1 VALUES (6,8,10);
+SELECT  1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
+1
+1
+1
+1
+1
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2009-07-31 23:39:26 +0000
+++ b/mysql-test/t/partition.test	2009-08-06 11:31:26 +0000
@@ -1979,4 +1979,23 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=M
 DROP TABLE t1;
 SET SESSION SQL_MODE=DEFAULT;
 
+
+--echo #
+--echo # BUG#45816 - assertion failure with index containing double 
+--echo #             column on partitioned table
+--echo #
+
+CREATE TABLE t1 (
+  a INT DEFAULT NULL,
+  b DOUBLE DEFAULT NULL,
+  c INT DEFAULT NULL,
+  KEY idx2(b,a)
+) PARTITION BY HASH(c) PARTITIONS 3;
+
+INSERT INTO t1 VALUES (6,8,9);
+INSERT INTO t1 VALUES (6,8,10);
+
+SELECT  1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
+
+DROP TABLE t1;
 --echo End of 5.1 tests

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2009-07-31 17:14:52 +0000
+++ b/sql/field.cc	2009-08-06 11:31:26 +0000
@@ -4598,7 +4598,6 @@ bool Field_double::send_binary(Protocol 
 
 int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr)
 {
-  ASSERT_COLUMN_MARKED_FOR_READ;
   double a,b;
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2009-07-31 19:58:40 +0000
+++ b/sql/ha_partition.cc	2009-08-06 11:31:26 +0000
@@ -3730,7 +3730,7 @@ int ha_partition::index_init(uint inx, b
   */
   if (m_lock_type == F_WRLCK)
     bitmap_union(table->read_set, &m_part_info->full_part_field_set);
-  else if (sorted)
+  if (sorted)
   {
     /*
       An ordered scan is requested. We must make sure all fields of the 

Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:3057) Bug#45816Satya B6 Aug
  • Re: bzr commit into mysql-5.1-bugteam branch (satya.bn:3057) Bug#45816Mattias Jonsson6 Aug
    • Re: bzr commit into mysql-5.1-bugteam branch (satya.bn:3057) Bug#45816satya6 Aug