#At file:///home/mikael/mysql_clones/mysql-6.0-bugteam-consolidated_push/
3514 Mikael Ronstrom 2009-08-05
Bug#40181 Made use of tdc_remove_table instead of just setting share->version to 0 to make sure all unused table instances go away as part of CREATE/ALTER TABLE
modified:
mysql-test/r/partition.result
mysql-test/t/partition.test
sql/sql_partition.cc
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2009-08-05 13:00:56 +0000
+++ b/mysql-test/r/partition.result 2009-08-05 13:08:40 +0000
@@ -6,6 +6,15 @@ subpartition by key (b)
(partition p0 values in (1),
partition p1 values in (2));
drop table t1;
+create table t1 (a int)
+partition by hash (a);
+create index i on t1 (a);
+insert into t1 values (1);
+insert into t1 select * from t1;
+create index i on t1 (a);
+ERROR 42000: Duplicate key name 'i'
+create index i2 on t1 (a);
+drop table t1;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
PARTITION BY HASH (a);
=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test 2009-08-05 13:00:56 +0000
+++ b/mysql-test/t/partition.test 2009-08-05 13:08:40 +0000
@@ -25,6 +25,19 @@ subpartition by key (b)
partition p1 values in (2));
drop table t1;
#
+# Bug#40181: hang if create index
+#
+create table t1 (a int)
+partition by hash (a);
+create index i on t1 (a);
+insert into t1 values (1);
+insert into t1 select * from t1;
+--error ER_DUP_KEYNAME
+create index i on t1 (a);
+create index i2 on t1 (a);
+drop table t1;
+
+#
# Bug#36001: Partitions: spelling and using some error messages
#
--error ER_FOREIGN_KEY_ON_PARTITIONED
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2009-08-05 13:00:56 +0000
+++ b/sql/sql_partition.cc 2009-08-05 13:08:40 +0000
@@ -3899,7 +3899,9 @@ bool mysql_unpack_partition(THD *thd,
*/
thd->free_items();
part_info= thd->work_part_info;
- table->s->version= 0UL;
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->s->db.str,
+ table->s->table_name.str);
*work_part_info_used= true;
}
}
@@ -4192,12 +4194,17 @@ uint prep_alter_part_table(THD *thd, TAB
/*
We are going to manipulate the partition info on the table object
- so we need to ensure that the data structure of the table object
- is freed by setting version to 0. table->s->version= 0 forces a
- flush of the table object in close_thread_tables().
+ so we need to ensure that the table instances cached and all other
+ instances are properly closed.
*/
if (table->part_info)
- table->s->version= 0L;
+ {
+ pthread_mutex_lock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->s->db.str,
+ table->s->table_name.str);
+ pthread_mutex_unlock(&LOCK_open);
+ }
thd->work_part_info= thd->lex->part_info;
if (thd->work_part_info &&
@@ -5863,7 +5870,9 @@ static int alter_close_tables(ALTER_PART
alter_partition_lock_handling() and the table is closed
by close_thread_tables() instead.
*/
- table->s->version= 0;
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->s->db.str,
+ table->s->table_name.str);
}
}
pthread_mutex_unlock(&LOCK_open);
Thread |
---|
• bzr commit into mysql-pe branch (mikael:3514) Bug#40181 | Mikael Ronstrom | 5 Aug |