]> git.pld-linux.org Git - packages/percona-server.git/blame - bug-92387.patch
- rebuild with libevent 2.1.11
[packages/percona-server.git] / bug-92387.patch
CommitLineData
349cd2e8
AM
1commit 95e3a1a52dbe8fc21eb0410540853db531254a24
2Author: Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>
3Date: Wed Oct 9 07:03:55 2019 +0530
4
5 BUG#29836204: P_S TABLE ACCESS HANGS WHILE IN LOCK TABLES MODE
6
7 Analysis
8 ========
9
10 Querying the performance_schema tables like "session variables"
11 under LOCK TABLE MODE while there is a meta data change for the
12 table locked caused the performance_schema query to hang in
13 "opening_tables" state.
14
15 While opening the performance_schema internal temporary table
16 in "open_table", the table share version was compared with the
17 share version of the opened tables(i.e in this case the table
18 which was altered using ALTER TABLE under lock table mode)/
19 Since the share version was different, the retry logic for
20 opening tables was triggered. This continued in a loop since
21 the table share version was always different.
22
23 Fix
24 ===
25 While opening performance_schema tables, the flag
26 'MYSQL_OPEN_IGNORE_FLUSH' is set since FLUSH TABLES/share
27 version comparison does not apply for performance_schema tables.
28 Querying the P_S tables should be allowed in lock table mode.
29
30 Change-Id: I4ac73dbfb9e67076a6297fcaa184c3d2606ffd40
31
32diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
33index b9d5b025f0e..0712289c8e6 100644
34--- a/mysql-test/r/lock.result
35+++ b/mysql-test/r/lock.result
36@@ -471,3 +471,28 @@ DROP TABLE m1, t1;
37 #
38 # End of 6.0 tests.
39 #
40+#
41+# Bug#29836204: P_S TABLE ACCESS HANGS WHILE IN LOCK TABLES MODE
42+#
43+SET @saved_show_compatibility_56= @@global.show_compatibility_56;
44+# Ensures that the P_S is used for the SHOW command.
45+SET GLOBAL show_compatibility_56= OFF;
46+CREATE TABLE t1(fld1 int) ENGINE=MYISAM;
47+LOCK TABLE t1 WRITE;
48+ALTER TABLE t1 DISABLE KEYS;
49+# Without patch, the SHOW command hangs.
50+SHOW SESSION VARIABLES LIKE 'FOREIGN_KEY_CHECKS';
51+Variable_name Value
52+foreign_key_checks ON
53+# Wihout patch, the SELECT from P_S hangs.
54+SELECT * FROM performance_schema.global_variables WHERE variable_name="read_only";
55+VARIABLE_NAME VARIABLE_VALUE
56+read_only OFF
57+# Test added for coverage (Querying from I_S)
58+SET GLOBAL show_compatibility_56= @saved_show_compatibility_56;
59+SHOW SESSION VARIABLES LIKE 'FOREIGN_KEY_CHECKS';
60+Variable_name Value
61+foreign_key_checks ON
62+# Clean up.
63+UNLOCK TABLES;
64+DROP TABLE t1;
65diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
66index 2fd69a23fac..4a8ecf141e2 100644
67--- a/mysql-test/t/lock.test
68+++ b/mysql-test/t/lock.test
69@@ -583,6 +583,33 @@ DROP TABLE m1, t1;
70 --echo # End of 6.0 tests.
71 --echo #
72
73+
74+--echo #
75+--echo # Bug#29836204: P_S TABLE ACCESS HANGS WHILE IN LOCK TABLES MODE
76+--echo #
77+
78+SET @saved_show_compatibility_56= @@global.show_compatibility_56;
79+--echo # Ensures that the P_S is used for the SHOW command.
80+SET GLOBAL show_compatibility_56= OFF;
81+CREATE TABLE t1(fld1 int) ENGINE=MYISAM;
82+LOCK TABLE t1 WRITE;
83+ALTER TABLE t1 DISABLE KEYS;
84+
85+--echo # Without patch, the SHOW command hangs.
86+SHOW SESSION VARIABLES LIKE 'FOREIGN_KEY_CHECKS';
87+
88+--echo # Wihout patch, the SELECT from P_S hangs.
89+SELECT * FROM performance_schema.global_variables WHERE variable_name="read_only";
90+
91+--echo # Test added for coverage (Querying from I_S)
92+SET GLOBAL show_compatibility_56= @saved_show_compatibility_56;
93+SHOW SESSION VARIABLES LIKE 'FOREIGN_KEY_CHECKS';
94+
95+--echo # Clean up.
96+UNLOCK TABLES;
97+DROP TABLE t1;
98+
99+
100 # Check that all connections opened by test cases in this file are really
101 # gone so execution of other tests won't be affected by their presence.
102 --source include/wait_until_count_sessions.inc
103diff --git a/sql/sql_base.cc b/sql/sql_base.cc
104index 567920cfb61..d23772910d2 100644
105--- a/sql/sql_base.cc
106+++ b/sql/sql_base.cc
107@@ -3051,6 +3051,14 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
108 DBUG_RETURN(true);
109 }
110
111+ /*
112+ P_S table access should be allowed while in LTM, the ignore flush flag is
113+ set to avoid the infinite reopening of the table due to version number
114+ mismatch.
115+ */
116+ if (BELONGS_TO_P_S_UNDER_LTM(thd, table_list))
117+ flags|= MYSQL_OPEN_IGNORE_FLUSH;
118+
119 key_length= get_table_def_key(table_list, &key);
120
121 /*
This page took 0.038322 seconds and 4 git commands to generate.