Commit f4631d6f authored by Igor Babaev's avatar Igor Babaev

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.
 
parent fb69d642
......@@ -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;
......@@ -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;
......@@ -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;
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment