List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:April 27 2011 3:51pm
Subject:bzr commit into mysql-5.1 branch (mattias.jonsson:3675) Bug#59316
Bug#11766249
View as plain text  
#At file:///C:/ade/mysql-bzr/topush-5.1/ based on revid:nirbhay.choubey@stripped

 3675 Mattias Jonsson	2011-04-27
      Post push fix for bug#11766249 bug#59316
      
      Partitions can have different ref_length (position data length).
      Removed DBUG_ASSERT which crashed debug builds when using
      MAX_ROWS on some partitions.

    renamed:
      mysql-test/r/partition_not_embedded.result => mysql-test/r/partition_myisam.result
      mysql-test/t/partition_not_embedded.test => mysql-test/t/partition_myisam.test
    modified:
      sql/ha_partition.cc
      mysql-test/r/partition_myisam.result
      mysql-test/t/partition_myisam.test
=== renamed file 'mysql-test/r/partition_not_embedded.result' => 'mysql-test/r/partition_myisam.result'
--- a/mysql-test/r/partition_not_embedded.result	2009-07-27 11:20:43 +0000
+++ b/mysql-test/r/partition_myisam.result	2011-04-27 15:51:06 +0000
@@ -79,3 +79,12 @@ a
 DROP TABLE t1;
 # Should not be any files left here
 # End of bug#30102 test.
+# Test of post-push fix for bug#11766249/59316
+CREATE TABLE t1 (a INT, b VARCHAR(255), PRIMARY KEY (a))
+ENGINE = MyISAM
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (0) MAX_ROWS=100,
+PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100,
+PARTITION pMax VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (1, "Partition p1, first row");
+DROP TABLE t1;

=== renamed file 'mysql-test/t/partition_not_embedded.test' => 'mysql-test/t/partition_myisam.test'
--- a/mysql-test/t/partition_not_embedded.test	2009-07-27 11:20:43 +0000
+++ b/mysql-test/t/partition_myisam.test	2011-04-27 15:51:06 +0000
@@ -1,5 +1,4 @@
 -- source include/have_partition.inc
--- source include/not_embedded.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1, t2;
 --enable_warnings
@@ -51,3 +50,13 @@ DROP TABLE t1;
 --list_files $MYSQLD_DATADIR/test t1*
 --list_files $MYSQLD_DATADIR/test t2*
 --echo # End of bug#30102 test.
+
+--echo # Test of post-push fix for bug#11766249/59316
+CREATE TABLE t1 (a INT, b VARCHAR(255), PRIMARY KEY (a))
+ENGINE = MyISAM
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (0) MAX_ROWS=100,
+ PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100,
+ PARTITION pMax VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (1, "Partition p1, first row");
+DROP TABLE t1;

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-04-26 08:21:09 +0000
+++ b/sql/ha_partition.cc	2011-04-27 15:51:06 +0000
@@ -2697,7 +2697,7 @@ int ha_partition::open(const char *name,
                       (PARTITION_ENABLED_TABLE_FLAGS));
   while (*(++file))
   {
-    DBUG_ASSERT(ref_length >= (*file)->ref_length);
+    /* MyISAM can have smaller ref_length for partitions with MAX_ROWS set */
     set_if_bigger(ref_length, ((*file)->ref_length));
     /*
       Verify that all partitions have the same set of table flags.
@@ -3957,12 +3957,15 @@ end_dont_reset_start_part:
 void ha_partition::position(const uchar *record)
 {
   handler *file= m_file[m_last_part];
+  uint pad_length;
   DBUG_ENTER("ha_partition::position");
 
   file->position(record);
   int2store(ref, m_last_part);
-  memcpy((ref + PARTITION_BYTES_IN_POS), file->ref,
-	 (ref_length - PARTITION_BYTES_IN_POS));
+  memcpy((ref + PARTITION_BYTES_IN_POS), file->ref, file->ref_length);
+  pad_length= m_ref_length - PARTITION_BYTES_IN_POS - file->ref_length;
+  if (pad_length)
+    memset((ref + PARTITION_BYTES_IN_POS + file->ref_length), 0, pad_length);
 
 #ifdef SUPPORTING_PARTITION_OVER_DIFFERENT_ENGINES
 #ifdef HAVE_purify


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20110427155106-k46lpxwmcx56w4ww.bundle
Thread
bzr commit into mysql-5.1 branch (mattias.jonsson:3675) Bug#59316Bug#11766249Mattias Jonsson27 Apr