#At file:///home/mikael/mysql_clones/mysql-6.0-bugteam-bug44108/
3477 Mikael Ronstrom 2009-07-23
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-07-23 15:41:27 +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-07-23 15:41:27 +0000
@@ -7,7 +7,17 @@
--disable_warnings
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
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2009-07-08 12:46:36 +0000
+++ b/sql/ha_partition.cc 2009-07-23 15:41:27 +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)
{
@@ -3336,6 +3337,10 @@ 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
+ being called, see bug¤44108.
+
*/
int ha_partition::end_bulk_insert(bool abort)
@@ -3344,7 +3349,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;
Thread |
---|
• bzr commit into mysql-5.4 branch (mikael:3477) Bug#44108 | Mikael Ronstrom | 23 Jul |