summaryrefslogtreecommitdiff
path: root/mysql-test/t/read_only_innodb.test
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2012-05-21 19:37:46 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2012-05-21 19:37:46 +0500
commitb87ccfdfbc0a08c7cb93c41f4e36c07c6ff40b00 (patch)
treecb302bf4683ad540eded5f46ec69556992da352b /mysql-test/t/read_only_innodb.test
parent7f6f53a8df10c76f93848c8d06bc5af71051c525 (diff)
downloadmariadb-git-b87ccfdfbc0a08c7cb93c41f4e36c07c6ff40b00.tar.gz
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.
Diffstat (limited to 'mysql-test/t/read_only_innodb.test')
-rw-r--r--mysql-test/t/read_only_innodb.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/read_only_innodb.test b/mysql-test/t/read_only_innodb.test
index f8c25fdee1d..ec016c54f63 100644
--- a/mysql-test/t/read_only_innodb.test
+++ b/mysql-test/t/read_only_innodb.test
@@ -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;