Commit add2913a authored by Konstantin Osipov's avatar Konstantin Osipov

A follow up patch for WL#5000: add a test case

and a comment for the case when a connection
issuing FLUSH TABLES <list> WITH READ LOCK
has an open handler.
parent 8673d2b2
......@@ -279,3 +279,28 @@ drop temporary table v1;
unlock tables;
drop view v2, v3;
drop table t1, v1;
#
# FLUSH TABLES <list> WITH READ LOCK and HANDLER
#
drop table if exists t1;
create table t1 (a int, key a (a));
insert into t1 (a) values (1), (2), (3);
handler t1 open;
handler t1 read a next;
a
1
handler t1 read a next;
a
2
flush tables t1 with read lock;
handler t1 read a next;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
#
# Sic: lost handler position.
#
handler t1 read a next;
a
1
handler t1 close;
drop table t1;
......@@ -407,3 +407,26 @@ drop temporary table v1;
unlock tables;
drop view v2, v3;
drop table t1, v1;
--echo #
--echo # FLUSH TABLES <list> WITH READ LOCK and HANDLER
--echo #
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, key a (a));
insert into t1 (a) values (1), (2), (3);
handler t1 open;
handler t1 read a next;
handler t1 read a next;
flush tables t1 with read lock;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
handler t1 read a next;
unlock tables;
--echo #
--echo # Sic: lost handler position.
--echo #
handler t1 read a next;
handler t1 close;
drop table t1;
......@@ -1750,6 +1750,17 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
If a temporary table with such name exists, it's ignored:
if there is a base table, it's used, otherwise ER_NO_SUCH_TABLE
is returned.
Implicit commit
---------------
This statement causes an implicit commit before and
after it.
HANDLER SQL
-----------
If this connection has HANDLERs open against
some of the tables being FLUSHed, these handlers
are implicitly flushed (lose their position).
*/
static bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
......
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