From b846af899d57aed220ac552e0218520a40b9bd46 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Nov 2006 12:05:05 +0100 Subject: [PATCH] bug #24301 Next command hangs in mysql after creating new NDB table via LIKE operation.: Locked mutex LOCK_open during operation --- mysql-test/r/ndb_basic.result | 15 +++++++++++++++ mysql-test/t/ndb_basic.test | 9 +++++++++ sql/sql_table.cc | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index e0255ddb9e7..b7e893faf29 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -758,4 +758,19 @@ c VARCHAR(255) NOT NULL, CONSTRAINT pk_b_c_id PRIMARY KEY (b,c), CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb; drop table t1, t2; +create table t1 (a int not null primary key, b int) engine=ndb; +insert into t1 values(1,1),(2,2),(3,3); +create table t2 like t1; +insert into t2 select * from t1; +select * from t1 order by a; +a b +1 1 +2 2 +3 3 +select * from t2 order by a; +a b +1 1 +2 2 +3 3 +drop table t1, t2; End of 5.1 tests diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index bbe5d263e36..3348a94c044 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -738,4 +738,13 @@ CREATE TABLE t2(a VARCHAR(255) NOT NULL, CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb; drop table t1, t2; +# bug#24301 +create table t1 (a int not null primary key, b int) engine=ndb; +insert into t1 values(1,1),(2,2),(3,3); +create table t2 like t1; +insert into t2 select * from t1; +select * from t1 order by a; +select * from t2 order by a; +drop table t1, t2; + --echo End of 5.1 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 511d9fa6677..b4fdca61222 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4745,8 +4745,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE)); #endif dst_path[dst_path_length - reg_ext_length]= '\0'; // Remove .frm + pthread_mutex_lock(&LOCK_open); err= ha_create_table(thd, dst_path, db, table_name, create_info, 1); - + pthread_mutex_unlock(&LOCK_open); if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { if (err || !open_temporary_table(thd, dst_path, db, table_name, 1))