summaryrefslogtreecommitdiff
path: root/mysql-test/t/flush.test
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-06-17 09:56:33 +0500
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-06-17 09:56:33 +0500
commitfbfa18daf0266131f64edbf088493bca933780c1 (patch)
tree9b7ba0d8f6adc066e61a7d8f37402b69711ec0af /mysql-test/t/flush.test
parentad18354c8ea62cf49afcbdcb3e82ac377975800a (diff)
downloadmariadb-git-fbfa18daf0266131f64edbf088493bca933780c1.tar.gz
Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
The log tables are by nature PERFORMANCE_SCHEMA tables, which should not be affected by SET GLOBAL READ_ONLY or FLUSH TABLES WITH READ LOCK. The implementation of FLUSH TABLES WITH READ LOCK already ignored log tables. Now with this patch, the implementation of LOCK TABLE also ignore a global read lock for log tables, which was the missing symmetry. mysql-test/r/flush.result: Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock - test result. mysql-test/t/flush.test: Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock - test case. sql/lock.cc: Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock - logger.is_privileged_thread() used. sql/log.h: Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock - LOGGER::is_privileged_thread() introduced that returns TRUE if a given thread is either a general_log or a slow_log or a privileged thread. sql/sql_base.cc: Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock - pass MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK to the mysql_lock_tables() in case of call from a logger in order not to honor the GLOBAL READ LOCK and to avoid possible deadlocks.
Diffstat (limited to 'mysql-test/t/flush.test')
-rw-r--r--mysql-test/t/flush.test26
1 files changed, 25 insertions, 1 deletions
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 3a4f2f2f5f2..d58d038c3ea 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -133,4 +133,28 @@ disconnect con3;
connection default;
drop table t1, t2;
-# End of 5.0 tests
+--echo End of 5.0 tests
+
+#
+# Bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
+#
+set @old_general_log= @@general_log;
+set @old_read_only= @@read_only;
+set global general_log= on;
+
+flush tables with read lock;
+flush logs;
+unlock tables;
+
+set global read_only=1;
+flush logs;
+unlock tables;
+
+flush tables with read lock;
+flush logs;
+unlock tables;
+
+set global general_log= @old_general_log;
+set global read_only= @old_read_only;
+
+--echo End of 5.1 tests