List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:October 5 2010 12:11pm
Subject:bzr commit into mysql-trunk-bugfixing branch (mattias.jonsson:3286) Bug#56484
View as plain text  
#At file:///Users/mattiasj/mysql-bzr/b56484-trunk-bf/ based on revid:mattias.jonsson@stripped

 3286 Mattias Jonsson	2010-10-05
      Bug#56484: !table || (!table->read_set ||
                            bitmap_is_set(table->read_set, field_index))
      
      In debug build an ASSERT crashed the server because
      of use of columns which was not marked as used.
      
      Solution was to mark the columns as used.
     @ mysql-test/r/partition_exchange.result
        updated result
     @ mysql-test/t/partition_exchange.test
        Added test
     @ sql/sql_partition_admin.cc
        Marking all columns as used.

    modified:
      mysql-test/r/partition_exchange.result
      mysql-test/t/partition_exchange.test
      sql/sql_partition_admin.cc
=== modified file 'mysql-test/r/partition_exchange.result'
--- a/mysql-test/r/partition_exchange.result	2010-08-25 14:00:02 +0000
+++ b/mysql-test/r/partition_exchange.result	2010-10-05 12:11:47 +0000
@@ -1,10 +1,24 @@
 DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
-CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
-CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+#
+# Bug#56484: !table || (!table->read_set ||
+#                       bitmap_is_set(table->read_set, field_index))
+#
+CREATE TABLE t1 (a INT NOT NULL,b TIME NOT NULL DEFAULT '00:00:00')
+ENGINE=MyISAM
+PARTITION BY HASH (a) PARTITIONS 2;
+CREATE TABLE t2 (a INT) ENGINE=MYISAM;
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
+ERROR HY000: Tables have different definitions
+DROP TABLE t1, t2;
+#
+# Bug#55784: Foreign key integrity broken by alter table
+#
+CREATE TABLE t1 (s1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) ENGINE=InnoDB;
 INSERT INTO t1 VALUES (1),(2),(3);
 INSERT INTO t2 VALUES (1),(2),(3);
 CREATE TABLE t3 (s1 INT PRIMARY KEY)
-engine=innodb
+ENGINE=InnoDB
 PARTITION BY LIST (s1)
 (PARTITION p1 VALUES IN (1,2,3));
 ALTER TABLE t3 EXCHANGE PARTITION p1 WITH TABLE t1;

=== modified file 'mysql-test/t/partition_exchange.test'
--- a/mysql-test/t/partition_exchange.test	2010-08-25 14:00:02 +0000
+++ b/mysql-test/t/partition_exchange.test	2010-10-05 12:11:47 +0000
@@ -5,16 +5,32 @@
 DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
 --enable_warnings
 
-CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
+--echo #
+--echo # Bug#56484: !table || (!table->read_set ||
+--echo #                       bitmap_is_set(table->read_set, field_index))
+--echo #
+CREATE TABLE t1 (a INT NOT NULL,b TIME NOT NULL DEFAULT '00:00:00')
+ENGINE=MyISAM
+PARTITION BY HASH (a) PARTITIONS 2;
 
-CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+CREATE TABLE t2 (a INT) ENGINE=MYISAM;
+--error ER_TABLES_DIFFERENT_METADATA
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#55784: Foreign key integrity broken by alter table
+--echo #
+CREATE TABLE t1 (s1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) ENGINE=InnoDB;
 
 INSERT INTO t1 VALUES (1),(2),(3);
 
 INSERT INTO t2 VALUES (1),(2),(3);
 
 CREATE TABLE t3 (s1 INT PRIMARY KEY)
-  engine=innodb
+  ENGINE=InnoDB
   PARTITION BY LIST (s1)
   (PARTITION p1 VALUES IN (1,2,3));
 

=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc	2010-08-25 14:00:02 +0000
+++ b/sql/sql_partition_admin.cc	2010-10-05 12:11:47 +0000
@@ -187,6 +187,9 @@ static bool compare_table_with_partition
   update_create_info_from_table(&table_create_info, table);
   /* get the current auto_increment value */
   table->file->update_create_info(&table_create_info);
+  /* mark all columns used, since they are used when preparing the new table */
+  part_table->use_all_columns();
+  table->use_all_columns();
   if (mysql_prepare_alter_table(thd, part_table, &part_create_info,
                                 &part_alter_info))
   {


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20101005121147-6z6rjumtujg2n5h3.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (mattias.jonsson:3286) Bug#56484Mattias Jonsson5 Oct