Skip to content

Commit ba1bbc4

Browse files
Christopher Powersbjornmu
authored andcommitted
Bug#21935106 SHOW SESSION VARIABLES RECENTLY HAVING LOCK ISSUES
The function alloc_and_copy_thd_dynamic_variables() synchronizes session variables with global variables. As of Bug#21840950, it uses the mutex THD::LOCK_thd_sysvar to block remote threads from accessing session vars during updates. With SHOW_COMPATIBILITY_56=OFF, SHOW VARIABLES can cause LOCK_thd_sysvar to be taken twice, first in System_variable::init() and later in alloc_and_copy_thd_dynamic_variables(). System_variables::init() now only acquires LOCK_thd_sysvar if the target thread is not the current thread. perfschema.show_plugin.test is now two tests so that alloc_and_copy_thd_dynamic_variables() can be tested separately with SHOW_COMPATIBILITY_56 = ON and OFF. (cherry picked from commit 8d91476c0b2bc510729a786ab3ba98ef6d28c2aa)
1 parent 6165889 commit ba1bbc4

File tree

9 files changed

+1348
-583
lines changed

9 files changed

+1348
-583
lines changed

mysql-test/suite/perfschema/include/show_plugin_verifier.inc

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
--disable_warnings
22

3-
--echo #
4-
--echo # SET COMPATIBILITY MODE = ON
5-
--echo #
6-
SET @@global.show_compatibility_56 = ON;
7-
8-
--echo
9-
SHOW GLOBAL STATUS LIKE "example_%";
10-
--echo
11-
SHOW GLOBAL VARIABLES LIKE "example_%";
12-
--echo
13-
SHOW SESSION VARIABLES LIKE "example_%";
14-
--echo
15-
SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
16-
--echo
17-
SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
18-
--echo
19-
SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
20-
--echo
21-
SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
22-
23-
--echo #
24-
--echo # SET COMPATIBILITY MODE = OFF
25-
--echo #
26-
SET @@global.show_compatibility_56 = OFF;
27-
283
--echo
294
SHOW GLOBAL STATUS LIKE "example_%";
305
--echo
@@ -41,6 +16,7 @@ SELECT variable_name, variable_value FROM performance_schema.session_status WHER
4116
SELECT variable_name, variable_value FROM performance_schema.global_variables WHERE variable_name LIKE "example_%";
4217
--echo
4318
SELECT variable_name, variable_value FROM performance_schema.session_variables WHERE variable_name LIKE "example_%";
19+
4420
#
4521
# Force sync of local and global system variables.
4622
#
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--disable_warnings
2+
3+
--echo
4+
SHOW GLOBAL STATUS LIKE "example_%";
5+
--echo
6+
SHOW SESSION STATUS LIKE "example_%";
7+
--echo
8+
SHOW GLOBAL VARIABLES LIKE "example_%";
9+
--echo
10+
SHOW SESSION VARIABLES LIKE "example_%";
11+
--echo
12+
SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
13+
--echo
14+
SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
15+
--echo
16+
SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
17+
--echo
18+
SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
19+
20+
#
21+
# Force sync of local and global system variables.
22+
#
23+
--disable_result_log
24+
--disable_query_log
25+
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread WHERE variable_name LIKE "example_%";
26+
--enable_query_log
27+
--enable_result_log
28+
29+
--enable_warnings

0 commit comments

Comments
 (0)