List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:June 2 2009 4:06pm
Subject:bzr commit into mysql-6.0-bugteam branch (mattias.jonsson:3340)
Bug#44108
View as plain text  
#At file:///Users/mattiasj/clones/bzrroot/b44108-60-bugteam/ based on revid:satya.bn@stripped

 3340 Mattias Jonsson	2009-06-02
      Bug#44108: Assertion bitmap_is_set in ha_partition::end_bulk_insert
      
      The assumption that start_bulk_insert must be called before end_bulk_insert
      was wrong, which lead to crash on assert.
      
      Solution was to remove the assertion and update the code to handle
      the situation where end_bulk_insert is called without any start call.
     @ mysql-test/r/partition_error.result
        Bug#44108: Assertion bitmap_is_set in ha_partition::end_bulk_insert
        
        Updated result
     @ mysql-test/t/partition_error.test
        Bug#44108: Assertion bitmap_is_set in ha_partition::end_bulk_insert
        
        Added test case
     @ sql/ha_partition.cc
        Bug#44108: Assertion bitmap_is_set in ha_partition::end_bulk_insert
        
        Removed the assert since the assumption of start_bulk_insert always
        was called before end_bulk_insert was wrong.
        
        Adding initailization and handling when start was not called before
        end_bulk_insert

    modified:
      mysql-test/r/partition_error.result
      mysql-test/t/partition_error.test
      sql/ha_partition.cc
=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result	2009-02-20 12:37:37 +0000
+++ b/mysql-test/r/partition_error.result	2009-06-02 16:06:48 +0000
@@ -1,4 +1,9 @@
 drop table if exists t1;
+CREATE TABLE t1 (a int, b int) PARTITION BY HASH (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,2);
+INSERT INTO t1 (a) SELECT * FROM t1;
+ERROR 21S01: Column count doesn't match value count at row 1
+DROP TABLE t1;
 CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
 INSERT INTO t1 VALUES (1),(1);
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'

=== modified file 'mysql-test/t/partition_error.test'
--- a/mysql-test/t/partition_error.test	2009-02-20 12:37:37 +0000
+++ b/mysql-test/t/partition_error.test	2009-06-02 16:06:48 +0000
@@ -9,6 +9,15 @@ drop table if exists t1;
 --enable_warnings
  
 #
+# Bug#44108: Assertion bitmap_is_set in ha_partition::end_bulk_insert
+#
+CREATE TABLE t1 (a int, b int) PARTITION BY HASH (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,2);
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 (a) SELECT * FROM t1;
+DROP TABLE t1;
+
+#
 # Bug#38719: Partitioning returns a different error code for a
 # duplicate key error
 CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2009-04-25 21:24:53 +0000
+++ b/sql/ha_partition.cc	2009-06-02 16:06:48 +0000
@@ -2470,6 +2470,7 @@ int ha_partition::open(const char *name,
   /* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
   if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
     DBUG_RETURN(1);
+  bitmap_clear_all(&m_bulk_insert_started);
   /* Initialize the bitmap we use to determine what partitions are used */
   if (!is_clone)
   {
@@ -3331,6 +3332,9 @@ ha_rows ha_partition::guess_bulk_insert_
   RETURN VALUE
     >0                      Error code
     0                       Success
+
+  Note: end_bulk_insert can be called without start_bulk_insert is called,
+        see bug#44108.
 */
 
 int ha_partition::end_bulk_insert(bool abort)
@@ -3339,7 +3343,9 @@ int ha_partition::end_bulk_insert(bool a
   uint i;
   DBUG_ENTER("ha_partition::end_bulk_insert");
 
-  DBUG_ASSERT(bitmap_is_set(&m_bulk_insert_started, m_tot_parts));
+  if (!bitmap_is_set(&m_bulk_insert_started, m_tot_parts))
+    DBUG_RETURN(error);
+
   for (i= 0; i < m_tot_parts; i++)
   {
     int tmp;


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-6.0-bugteam branch (mattias.jonsson:3340)Bug#44108Mattias Jonsson2 Jun