mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
69b9761f29
Backport of: ------------------------------------------------------------ revno: 2630.4.1 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Fri 2008-05-23 17:54:03 +0400 message: WL#3726 "DDL locking for all metadata objects". After review fixes in progress. ------------------------------------------------------------ This is the first patch in series. It transforms the metadata locking subsystem to use a dedicated module (mdl.h,cc). No significant changes in the locking protocol. The import passes the test suite with the exception of deprecated/removed 6.0 features, and MERGE tables. The latter are subject to a fix by WL#4144. Unfortunately, the original changeset comments got lost in a merge, thus this import has its own (largely insufficient) comments. This patch fixes Bug#25144 "replication / binlog with view breaks". Warning: this patch introduces an incompatible change: Under LOCK TABLES, it's no longer possible to FLUSH a table that was not locked for WRITE. Under LOCK TABLES, it's no longer possible to DROP a table or VIEW that was not locked for WRITE. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.2 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 14:03:45 +0400 message: WL#3726 "DDL locking for all metadata objects". After review fixes in progress. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.3 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 14:08:51 +0400 message: WL#3726 "DDL locking for all metadata objects" Fixed failing Windows builds by adding mdl.cc to the lists of files needed to build server/libmysqld on Windows. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.4 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 21:57:58 +0400 message: WL#3726 "DDL locking for all metadata objects". Fix for assert failures in kill.test which occured when one tried to kill ALTER TABLE statement on merge table while it was waiting in wait_while_table_is_used() for other connections to close this table. These assert failures stemmed from the fact that cleanup code in this case assumed that temporary table representing new version of table was open with adding to THD::temporary_tables list while code which were opening this temporary table wasn't always fulfilling this. This patch changes code that opens new version of table to always do this linking in. It also streamlines cleanup process for cases when error occurs while we have new version of table open. ****** WL#3726 "DDL locking for all metadata objects" Add libmysqld/mdl.cc to .bzrignore. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.6 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sun 2008-05-25 00:33:22 +0400 message: WL#3726 "DDL locking for all metadata objects". Addition to the fix of assert failures in kill.test caused by changes for this worklog. Make sure we close the new table only once.
130 lines
2.3 KiB
Text
130 lines
2.3 KiB
Text
drop table if exists t1,t2;
|
|
create table t1 (a int not null auto_increment primary key);
|
|
insert into t1 values(0);
|
|
lock table t1 read;
|
|
flush table t1;
|
|
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
|
|
unlock tables;
|
|
lock table t1 write;
|
|
flush table t1;
|
|
check table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
unlock tables;
|
|
lock table t1 write;
|
|
lock table t1 read;
|
|
flush table t1;
|
|
select * from t1;
|
|
a
|
|
1
|
|
unlock tables;
|
|
unlock tables;
|
|
lock table t1 write;
|
|
lock table t1 write;
|
|
flush table t1;
|
|
select * from t1;
|
|
a
|
|
1
|
|
unlock tables;
|
|
unlock tables;
|
|
select * from t1;
|
|
a
|
|
1
|
|
drop table t1;
|
|
create table t1(table_id char(20) primary key);
|
|
create table t2(table_id char(20) primary key);
|
|
insert into t1 values ('test.t1');
|
|
insert into t1 values ('');
|
|
insert into t2 values ('test.t2');
|
|
insert into t2 values ('');
|
|
handler t1 open as a1;
|
|
handler t1 open as a2;
|
|
handler t2 open;
|
|
handler a1 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler a2 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler t2 read first limit 9;
|
|
table_id
|
|
test.t2
|
|
|
|
flush tables;
|
|
handler a1 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler a2 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler t2 read first limit 9;
|
|
table_id
|
|
test.t2
|
|
|
|
handler t1 open as a1;
|
|
ERROR 42000: Not unique table/alias: 'a1'
|
|
handler t1 open as a2;
|
|
ERROR 42000: Not unique table/alias: 'a2'
|
|
handler t2 open;
|
|
ERROR 42000: Not unique table/alias: 't2'
|
|
handler a1 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler a2 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler t2 read first limit 9;
|
|
table_id
|
|
test.t2
|
|
|
|
flush table t1;
|
|
handler a1 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler a2 read first limit 9;
|
|
table_id
|
|
test.t1
|
|
|
|
handler t2 read first limit 9;
|
|
table_id
|
|
test.t2
|
|
|
|
flush table t2;
|
|
handler t2 close;
|
|
drop table t1;
|
|
drop table t2;
|
|
create table t1(table_id char(20) primary key);
|
|
insert into t1 values ('Record-01');
|
|
insert into t1 values ('Record-02');
|
|
insert into t1 values ('Record-03');
|
|
insert into t1 values ('Record-04');
|
|
insert into t1 values ('Record-05');
|
|
handler t1 open;
|
|
handler t1 read first limit 1;
|
|
table_id
|
|
Record-01
|
|
handler t1 read next limit 1;
|
|
table_id
|
|
Record-02
|
|
handler t1 read next limit 1;
|
|
table_id
|
|
Record-03
|
|
flush table t1;
|
|
handler t1 read next limit 1;
|
|
table_id
|
|
Record-01
|
|
handler t1 read next limit 1;
|
|
table_id
|
|
Record-02
|
|
handler t1 close;
|
|
drop table t1;
|
|
FLUSH TABLES WITH READ LOCK ;
|
|
FLUSH TABLES WITH READ LOCK ;
|
|
UNLOCK TABLES;
|