2001-10-08 03:58:07 +02:00
|
|
|
# This test doesn't work with the embedded version as this code
|
|
|
|
# assumes that one query is running while we are doing queries on
|
|
|
|
# a second connection.
|
|
|
|
# This would work if mysqltest run would be threaded and handle each
|
|
|
|
# connection in a separate thread.
|
|
|
|
#
|
|
|
|
-- source include/not_embedded.inc
|
|
|
|
|
2003-01-06 00:48:59 +01:00
|
|
|
--disable_warnings
|
2003-03-04 11:22:35 +01:00
|
|
|
drop table if exists t1,t2;
|
2003-01-06 00:48:59 +01:00
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
# Test to see if select will get the lock ahead of low priority update
|
2001-10-08 03:58:07 +02:00
|
|
|
|
|
|
|
connect (locker,localhost,root,,);
|
|
|
|
connect (reader,localhost,root,,);
|
|
|
|
connect (writer,localhost,root,,);
|
|
|
|
|
|
|
|
connection locker;
|
|
|
|
create table t1(n int);
|
|
|
|
insert into t1 values (1);
|
|
|
|
lock tables t1 write;
|
|
|
|
connection writer;
|
|
|
|
send update low_priority t1 set n = 4;
|
|
|
|
connection reader;
|
|
|
|
--sleep 2
|
|
|
|
send select n from t1;
|
|
|
|
connection locker;
|
|
|
|
--sleep 2
|
|
|
|
unlock tables;
|
|
|
|
connection writer;
|
|
|
|
reap;
|
|
|
|
connection reader;
|
|
|
|
reap;
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
connection locker;
|
|
|
|
create table t1(n int);
|
|
|
|
insert into t1 values (1);
|
|
|
|
lock tables t1 read;
|
|
|
|
connection writer;
|
|
|
|
send update low_priority t1 set n = 4;
|
|
|
|
connection reader;
|
|
|
|
--sleep 2
|
|
|
|
send select n from t1;
|
|
|
|
connection locker;
|
|
|
|
--sleep 2
|
|
|
|
unlock tables;
|
|
|
|
connection writer;
|
|
|
|
reap;
|
|
|
|
connection reader;
|
|
|
|
reap;
|
|
|
|
drop table t1;
|
2003-03-04 11:22:35 +01:00
|
|
|
|
2004-10-03 01:20:47 +02:00
|
|
|
#
|
|
|
|
# Test problem when using locks with multi-updates
|
|
|
|
# It should not block when multi-update is reading on a read-locked table
|
|
|
|
#
|
|
|
|
|
|
|
|
connection locker;
|
|
|
|
create table t1 (a int, b int);
|
|
|
|
create table t2 (c int, d int);
|
|
|
|
insert into t1 values(1,1);
|
|
|
|
insert into t1 values(2,2);
|
|
|
|
insert into t2 values(1,2);
|
|
|
|
lock table t1 read;
|
|
|
|
connection writer;
|
|
|
|
--sleep 2
|
|
|
|
send update t1,t2 set c=a where b=d;
|
|
|
|
connection reader;
|
|
|
|
--sleep 2
|
|
|
|
select c from t2;
|
|
|
|
connection writer;
|
|
|
|
reap;
|
|
|
|
connection locker;
|
|
|
|
drop table t1;
|
|
|
|
drop table t2;
|
|
|
|
|
2003-03-04 11:22:35 +01:00
|
|
|
#
|
|
|
|
# Test problem when using locks on many tables and droping a table that
|
|
|
|
# is to-be-locked by another thread
|
|
|
|
#
|
|
|
|
|
|
|
|
connection locker;
|
|
|
|
create table t1 (a int);
|
|
|
|
create table t2 (a int);
|
|
|
|
lock table t1 write, t2 write;
|
|
|
|
connection reader;
|
|
|
|
send insert t1 select * from t2;
|
|
|
|
connection locker;
|
|
|
|
drop table t2;
|
|
|
|
connection reader;
|
|
|
|
--error 1146
|
|
|
|
reap;
|
|
|
|
connection locker;
|
|
|
|
drop table t1;
|
2005-06-03 15:29:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# BUG#9998 - MySQL client hangs on USE "database"
|
|
|
|
|
|
|
|
create table t1(a int);
|
|
|
|
lock tables t1 write;
|
|
|
|
connection reader;
|
|
|
|
show columns from t1;
|
|
|
|
connection locker;
|
|
|
|
unlock tables;
|
|
|
|
drop table t1;
|