Browse Source

Fixed bug mdev-473.

With the new code of mysql-5.5 for metadata locking the function
unlock_tables_n_open_system_tables_for_write should not explicitly
unlock tables for which external locks have been set and should not
explicitly reset thd->lock to 0.
pull/57/head
Igor Babaev 13 years ago
parent
commit
f4631d6f71
  1. 11
      mysql-test/r/stat_tables.result
  2. 11
      mysql-test/r/stat_tables_innodb.result
  3. 15
      mysql-test/t/stat_tables.test
  4. 4
      sql/sql_base.cc

11
mysql-test/r/stat_tables.result

@ -342,4 +342,15 @@ o_orderkey p_partkey
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
#
# Bug mdev-473: ANALYZE table locked for write
#
set use_stat_tables='complementary';
create table t1 (i int);
lock table t1 write;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
alter table t1 add column a varchar(8);
drop table t1;
set use_stat_tables=@save_use_stat_tables;

11
mysql-test/r/stat_tables_innodb.result

@ -369,6 +369,17 @@ o_orderkey p_partkey
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
#
# Bug mdev-473: ANALYZE table locked for write
#
set use_stat_tables='complementary';
create table t1 (i int);
lock table t1 write;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
alter table t1 add column a varchar(8);
drop table t1;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;

15
mysql-test/t/stat_tables.test

@ -152,4 +152,19 @@ DROP DATABASE dbt3_s001;
use test;
--echo #
--echo # Bug mdev-473: ANALYZE table locked for write
--echo #
set use_stat_tables='complementary';
create table t1 (i int);
lock table t1 write;
analyze table t1;
alter table t1 add column a varchar(8);
drop table t1;
set use_stat_tables=@save_use_stat_tables;

4
sql/sql_base.cc

@ -9669,10 +9669,6 @@ unlock_tables_n_open_system_tables_for_write(THD *thd,
DBUG_ENTER("unlock_tables_n_open_system_tables_for_write");
if (thd->lock)
mysql_unlock_tables(thd, thd->lock);
thd->lock= 0;
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
thd->reset_n_backup_open_tables_state(backup);

Loading…
Cancel
Save