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

perfschema compilation, test and misc fixes

This commit is contained in:
Sergei Golubchik
2020-02-15 18:25:57 +01:00
parent 81cffda2e6
commit 7af733a5a2
403 changed files with 20147 additions and 63173 deletions

View File

@ -23,6 +23,7 @@
--source include/not_embedded.inc
--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--enable_connect_log
@ -34,18 +35,11 @@
--echo # Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo
--echo # Save current SHOW_COMPATIBILITY_56 setting
SELECT @@global.show_compatibility_56 INTO @show_compatibility_56_save;
--echo #
--echo # SET COMPATIBILITY MODE = OFF
--echo #
SET @@global.show_compatibility_56 = OFF;
--echo
--echo # Verify EXAMPLE plugin is not loaded
SELECT COUNT(*) = 0 AS "Expect 1" FROM information_schema.plugins WHERE plugin_name = "EXAMPLE";
--echo
--echo # Create one session to force local and global system variables;
connect(con0, localhost, root,,);
--echo # Create one session to force local and global system variables
--connect(con0, localhost, root,,)
--connection default
--echo
--echo ================================================================================
@ -60,8 +54,7 @@ connect(con0, localhost, root,,);
--echo ================================================================================
--echo 2.1 - INSTALL PLUGIN
--echo ================================================================================
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
INSTALL PLUGIN example SONAME 'ha_example';
--echo
--echo ================================================================================
@ -106,8 +99,7 @@ UNINSTALL PLUGIN example;
--echo 2.6 - REINSTALL PLUGIN
--echo ================================================================================
--echo # Reinstall EXAMPLE plugin
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
INSTALL PLUGIN example SONAME 'ha_example';
--echo
--echo ================================================================================
@ -147,8 +139,7 @@ UNINSTALL PLUGIN example;
--echo ================================================================================
--echo 3.1 - INSTALL PLUGIN
--echo ================================================================================
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
INSTALL PLUGIN example SONAME 'ha_example';
--echo
--echo ================================================================================
@ -165,13 +156,13 @@ SET SESSION example_double_thdvar = 300.0000;
--echo ================================================================================
--echo 3.3 - CONNECT 3 CLIENTS, SET LOCAL PLUGIN VARS
--echo ================================================================================
connect(con1, localhost, root,,);
--connect(con1, localhost, root,,)
SET SESSION example_double_thdvar = 300.1111;
--echo
connect(con2, localhost, root,,);
--connect(con2, localhost, root,,)
SET SESSION example_double_thdvar = 300.2222;
--echo
connect(con3, localhost, root,,);
--connect(con3, localhost, root,,)
SET SESSION example_double_thdvar = 300.3333;
--echo
--connection default
@ -218,13 +209,13 @@ WHERE variable_name LIKE "example_%" ORDER BY variable_value;
--echo ================================================================================
--echo 3.7 - RECONNECT 3 CLIENTS, SET SESSION VARS FOR EACH
--echo ================================================================================
connect(con1, localhost, root,,);
--connect(con1, localhost, root,,)
SET SESSION example_double_thdvar = 311.1111;
--echo
connect(con2, localhost, root,,);
--connect(con2, localhost, root,,)
SET SESSION example_double_thdvar = 322.2222;
--echo
connect(con3, localhost, root,,);
--connect(con3, localhost, root,,)
SET SESSION example_double_thdvar = 333.3333;
--echo
--connection default
@ -288,140 +279,6 @@ WHERE variable_name LIKE "example_%" ORDER BY variable_value;
--echo TEST 4 - BUG#18008907: DEADLOCK WITH CHANGE_USER, SHOW VARIABLES, INSTALL PLUGIN
--echo ================================================================================
--echo
--disable_result_log
DELIMITER |;
CREATE PROCEDURE install_no_such_plugin()
BEGIN
INSTALL PLUGIN no_such_plugin SONAME 'no_such_object';
END|
--echo
CREATE PROCEDURE show_vars()
BEGIN
-- select on information_schema.global_variables
-- will fail, still need to cover execution of the code
-- to verify potential dead locks.
declare continue handler for sqlexception
begin
end;
SELECT COUNT(*) FROM information_schema.global_variables;
SELECT COUNT(*) FROM performance_schema.global_variables;
END|
DELIMITER ;|
--enable_result_log
--echo
--echo ================================================================================
--echo 4.1 - DEADLOCK SCENARIO 1:
--echo con1 - has LOCK_system_variables_hash and waits on LOCK_plugin AND
--echo default - has LOCK_plugin and waits on LOCK_system_variables_hash
--echo ================================================================================
connect(con1, localhost, root,,);
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR cont_show_vars';
--send call show_vars();
--connection default
SET DEBUG_SYNC='now WAIT_FOR install_plugin';
SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL cont_show_vars';
--send call install_no_such_plugin();
--connection con1
--echo
--echo # Without fix, reap will hang.
--disable_warnings
--replace_column 1 #
--reap;
--enable_warnings
SET DEBUG_SYNC='RESET';
--connection default
--replace_regex /(Can\'t open shared library).*$/\1/
--error ER_CANT_OPEN_LIBRARY
--reap;
--echo
SET DEBUG_SYNC='RESET';
--echo
--echo ================================================================================
--echo 4.2 - DEADLOCK SCENARIO 2:
--echo default - has LOCK_system_variables_hash, waits on LOCK_global_system_variables
--echo con1 - has LOCK_plugin, waits on LOCK_system_variables_hash AND
--echo con2 - has LOCK_global_system_variables, waits on LOCK_plugin
--echo ================================================================================
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR nothing TIMEOUT 10';
--send call show_vars();
--connection con1
SET DEBUG_SYNC='now WAIT_FOR install_plugin';
SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL create_connection WAIT_FOR nothing TIMEOUT 10';
--send call install_no_such_plugin();
connect(con2, localhost, root,,);
SET DEBUG_SYNC='now WAIT_FOR create_connection';
--echo
--echo # Without fix, deadlock situation will occur on timeout of debug_syncs in
--echo # default and con1. Because of this, change_user operation hangs.
--echo change_user
change_user;
--connection con1
--replace_regex /(Can\'t open shared library).*$/\1/
--error ER_CANT_OPEN_LIBRARY
--reap;
--echo
--connection default
--replace_column 1 #
--disable_warnings
--reap;
--enable_warnings
--echo
--disconnect con2
--echo
--echo ================================================================================
--echo 4.3 - DEADLOCK SCENARIO 3: CONCURRENT SHOW VARIABLES AND UNINSTALL PLUGIN
--echo ================================================================================
--echo #
--echo # INSTALL PLUGIN
--echo #
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
--connection con1
--echo
--echo # Acquiring LOCK_system_variables_hash and LOCK_plugin_delete
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL uninstall_plugin WAIT_FOR go';
--send call show_vars();
connect(con2, localhost, root,,);
--echo #
--echo # UNINSTALL PLUGIN
--echo #
SET DEBUG_SYNC='now WAIT_FOR uninstall_plugin';
--send UNINSTALL PLUGIN example;
--connection default
--echo
--echo # Uninstall will wait until SHOW VARIABLES releases LOCK_plugin_delete.
let $wait_condition= SELECT count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO='UNINSTALL PLUGIN example' and
STATE='System lock';
--source include/wait_condition.inc
SET DEBUG_SYNC='now SIGNAL go';
--echo # Connect con1 - reap
--connection con1
--replace_column 1 #
--disable_warnings
--reap
--enable_warnings
--echo # Connect con2 - reap
--connection con2
--disable_warnings
--reap
--enable_warnings
--echo
--echo ================================================================================
--echo TEST 5 - BUG#22225549 MYSQL_CHANGE_USER/MYSQL_RESET_CONNECTION + SET INNODB...
@ -429,10 +286,6 @@ SET DEBUG_SYNC='now SIGNAL go';
--echo variables and deadlocks on THD::LOCK_thd_sysvar.
--echo ================================================================================
#
# THD:LOCK_thd_sysvar is only used when SHOW_COMPATIBILITY_56 = OFF
#
SELECT @@global.show_compatibility_56;
#
# The deadlock occurs when plugin-defined session variables are resynced with the global
# variables. To force a resync, change the user and update a session variable from a
# plugin, in this case InnoDB.
@ -459,19 +312,10 @@ select @@session.innodb_strict_mode;
--echo ================================================================================
--connection default
--echo
DROP PROCEDURE show_vars;
DROP PROCEDURE install_no_such_plugin;
SET DEBUG_SYNC='RESET';
--echo
--disconnect con1
--disconnect con2
--disable_connect_log
--echo
--echo # Restore SHOW_COMPATIBILITY_56 setting
SET @@global.show_compatibility_56 = @show_compatibility_56_save;
--echo
--echo # Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc