1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-136 Non-blocking "set read_only".

Handle the 'set read_only=1' in lighter way, than the FLUSH TABLES READ LOCK;
    For the transactional engines we don't wait for operations on that tables to finish.

per-file comments:
 mysql-test/r/read_only_innodb.result
MDEV-136 Non-blocking "set read_only".
       test result updated.
 mysql-test/t/read_only_innodb.test
MDEV-136 Non-blocking "set read_only".
       test case added.
  sql/mysql_priv.h
MDEV-136 Non-blocking "set read_only".
        The close_cached_tables_set_readonly() declared.
  sql/set_var.cc
MDEV-136 Non-blocking "set read_only".
         Call close_cached_tables_set_readonly() for the read_only::set_var.
   sql/sql_base.cc
 MDEV-136 Non-blocking "set read_only".
         Parameters added to the close_cached_tables implementation,
         close_cached_tables_set_readonly declared.
         Prevent blocking on the transactional tables if the
         set_readonly_mode is on.
This commit is contained in:
Alexey Botchkov
2012-05-21 19:37:46 +05:00
parent 7f6f53a8df
commit b87ccfdfbc
5 changed files with 85 additions and 5 deletions

View File

@ -43,6 +43,28 @@ a
1
COMMIT;
UNLOCK TABLES;
FLUSH STATUS;
# Expected 0 at the beginning of the test
show status like 'Opened_tables';
Variable_name Value
Opened_tables 0
connection con1;
lock table t1 write;
connection default;
set global read_only=1;
# Expected 1 as the slow_log was reopened
show status like 'Opened_tables';
Variable_name Value
Opened_tables 1
connection con1;
unlock tables;
connection default;
SET GLOBAL read_only=0;
# Expected 2 as the slow_log was reopened
show status like 'Opened_tables';
Variable_name Value
Opened_tables 2
UNLOCK TABLES;
DROP TABLE t1;
DROP USER test@localhost;
echo End of 5.1 tests

View File

@ -75,7 +75,36 @@ BEGIN;
SELECT * FROM t1;
COMMIT;
#
# Tests that LOCK TABLE doesn't block the SET READ_ONLY=1 for the InnoDB tables
#
connection default;
UNLOCK TABLES;
FLUSH STATUS;
--echo # Expected 0 at the beginning of the test
show status like 'Opened_tables';
--echo connection con1;
connection con1;
lock table t1 write;
--echo connection default;
connection default;
set global read_only=1;
--echo # Expected 1 as the slow_log was reopened
show status like 'Opened_tables';
--echo connection con1;
connection con1;
unlock tables;
--echo connection default;
connection default;
SET GLOBAL read_only=0;
--echo # Expected 2 as the slow_log was reopened
show status like 'Opened_tables';
UNLOCK TABLES;
DROP TABLE t1;
DROP USER test@localhost;