diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-06-04 17:39:28 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-06-04 17:39:28 +0200 |
commit | 4361c8645b45bca3f48b248241de0225bafbcc09 (patch) | |
tree | 6a39e037f30eb9be62c1fe463339a971a176807a /mysql-test/r/read_only.result | |
parent | 3e3606d21deec2a7508d47740ab7a7a7f5b9b698 (diff) | |
download | mariadb-git-4361c8645b45bca3f48b248241de0225bafbcc09.tar.gz |
MDEV-136 Non-blocking "set read_only"
backport dmitry.shulga@oracle.com-20120209125742-w7hdxv0103ymb8ko from mysql-trunk:
Patch for bug#11764747 (formerly known as 57612): SET GLOBAL READ_ONLY=1 cannot
progress when a table is locked with LOCK TABLES.
The reason for the bug was that mysql server makes a flush of all open tables
during handling of statement 'SET GLOBAL READ_ONLY=1'. Therefore if some of
these tables were locked by "LOCK TABLE ... READ" from a different connection,
then execution of statement 'SET GLOBAL READ_ONLY=1' would be waiting for
the lock for such table even if the table was locked in a compatible read mode.
Flushing of all open tables before setting of read_only system variable
is inherited from 5.1 implementation since this was the only possible approach
to ensure that there isn't any pending write operations on open tables.
Start from version 5.5 and above such behaviour is guaranteed by the fact
that we acquire global_read_lock before setting read_only flag. Since
acquiring of global_read_lock is successful only when there isn't any
active write operation then we can remove flushing of open tables from
processing of SET GLOBAL READ_ONLY=1.
This modification changes the server behavior so that read locks held
by other connections (LOCK TABLE ... READ) no longer will block attempts
to enable read_only.
Diffstat (limited to 'mysql-test/r/read_only.result')
-rw-r--r-- | mysql-test/r/read_only.result | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index fead8c2b82b..1ffe2b86f70 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -75,18 +75,16 @@ connection default; set global read_only=1; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables ; -send set global read_only=1; set global read_only=1; -connection con1; select @@global.read_only; @@global.read_only -0 -unlock tables ; +1 +connection con1; select @@global.read_only; @@global.read_only 1 +unlock tables ; connection default; -reap; connection default; set global read_only=0; BEGIN; |