diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2009-12-10 14:15:50 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2009-12-10 14:15:50 +0100 |
commit | 28b0eeff28f9ae8c834719bb852094f64f7157da (patch) | |
tree | 1fe90fdd9ea022952637b476eb501e720bdbc00b | |
parent | 1cfcd2d210b8a069496571d3d35bf3b8bd5ee67e (diff) | |
download | mariadb-git-28b0eeff28f9ae8c834719bb852094f64f7157da.tar.gz |
Backport of revno: 3514
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.
-rw-r--r-- | mysql-test/r/partition.result | 9 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 13 | ||||
-rw-r--r-- | sql/sql_partition.cc | 21 |
3 files changed, 37 insertions, 6 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 543a70f9a2a..e9bbc011f7b 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -65,6 +65,15 @@ show indexes from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 1 NULL NULL YES BTREE 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); diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 8ab91f23522..01e885a527c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -75,6 +75,19 @@ show indexes from t1; 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 diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 718471cc1b6..52657deed83 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4189,7 +4189,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; } table->part_info= part_info; @@ -4482,12 +4484,17 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, /* 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 && @@ -6242,7 +6249,9 @@ static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt) 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); |