diff options
author | Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com> | 2014-06-27 17:04:08 +0530 |
---|---|---|
committer | Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com> | 2014-06-27 17:04:08 +0530 |
commit | 14aa44bb8f3deb4268dfb7c8d235422b133d4403 (patch) | |
tree | 2ded6d278b449fb8c9b4b5f40cd6cd075df9895a /mysql-test | |
parent | 854da5e9a342b5ac5e75bedf9b8e5fcf2484dfb5 (diff) | |
download | mariadb-git-14aa44bb8f3deb4268dfb7c8d235422b133d4403.tar.gz |
Bug#18903155: BACKPORT BUG-18008907 TO 5.5+ VERSIONS.
Backporting patch committed for bug 18008907 to 5.5
and 5.6.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/plugin.result | 70 | ||||
-rw-r--r-- | mysql-test/t/plugin.test | 117 |
2 files changed, 187 insertions, 0 deletions
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 2b96dc4f3ac..03a1ab70278 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -143,3 +143,73 @@ SELECT @@SESSION.example_double_thdvar; @@SESSION.example_double_thdvar 1000.500000 UNINSTALL PLUGIN example; +# +# BUG#18008907 - DEADLOCK BETWEEN MYSQL_CHANGE_USER(), SHOW VARIABLES AND INSTALL PLUGIN +# +CREATE PROCEDURE p_install() +BEGIN +INSTALL PLUGIN no_such_plugin SONAME 'no_such_object'; +END +| +CREATE PROCEDURE p_show_vars() +BEGIN +SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES; +END| +connect con1, localhost, root,,; +# Case 18008907_1: Deadlock situation cause by +# con1: has LOCK_system_variables_hash and waits on LOCK_plugin AND +# default: has LOCK_plugin and waits on LOCK_system_variables_hash. +# +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR cont_show_vars'; +call p_show_vars();; +connection default; +SET DEBUG_SYNC='now WAIT_FOR install_plugin'; +SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL cont_show_vars'; +call p_install();; +connection con1; +COUNT(*) +# +SET DEBUG_SYNC='RESET'; +connection default; +ERROR HY000: Can't open shared library +SET DEBUG_SYNC='RESET'; +# Case 18008907_2: Deadlock situation caused by +# default: has LOCK_system_variables_hash and waits on LOCK_global_system_variables, +# con1: has LOCK_plugin and waits on LOCK_system_variables_hash AND +# con2: has LOCK_global_system_variables and waits on LOCK_plugin. +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR nothing TIMEOUT 10'; +call p_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'; +call p_install();; +connect con2, localhost, root,,; +SET DEBUG_SYNC='now WAIT_FOR create_connection'; +connection con1; +ERROR HY000: Can't open shared library +connection default; +COUNT(*) +# +Warnings: +# 1639 debug sync point wait timed out +disconnect con2; +# Case 18008907_3: Testing Concurrent "Show Variables" and "Plugin Uninstall" operations. +INSTALL PLUGIN example SONAME 'ha_example.so'; +connection con1; +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL uninstall_plugin WAIT_FOR go'; +call p_show_vars();; +connect con2, localhost, root,,; +SET DEBUG_SYNC='now WAIT_FOR uninstall_plugin'; +UNINSTALL PLUGIN example;; +connection default; +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +COUNT(*) +# +connection con2; +connection default; +DROP PROCEDURE p_show_vars; +DROP PROCEDURE p_install; +SET DEBUG_SYNC='RESET'; +disconnect con1; +disconnect con2; diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index f3a3b0cc068..c9220651fa8 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -1,5 +1,7 @@ +# --source include/not_windows_embedded.inc --source include/have_example_plugin.inc +--source include/have_debug_sync.inc CREATE TABLE t1(a int) ENGINE=EXAMPLE; DROP TABLE t1; @@ -137,3 +139,118 @@ SET SESSION example_double_thdvar = 1000.51; SELECT @@SESSION.example_double_thdvar; UNINSTALL PLUGIN example; + +--echo # +--echo # BUG#18008907 - DEADLOCK BETWEEN MYSQL_CHANGE_USER(), SHOW VARIABLES AND INSTALL PLUGIN +--echo # + +--enable_connect_log + +delimiter |; + +CREATE PROCEDURE p_install() +BEGIN + INSTALL PLUGIN no_such_plugin SONAME 'no_such_object'; +END +| + +CREATE PROCEDURE p_show_vars() +BEGIN + SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES; +END| + +delimiter ;| + +connect(con1, localhost, root,,); + +--echo # Case 18008907_1: Deadlock situation cause by +--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 # +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR cont_show_vars'; +--send call p_show_vars(); + +connection default; +SET DEBUG_SYNC='now WAIT_FOR install_plugin'; +SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL cont_show_vars'; +--send call p_install(); + +connection con1; +# Without fix, reap will hang. +--replace_column 1 # +--reap; +SET DEBUG_SYNC='RESET'; + +connection default; +--replace_regex /(Can\'t open shared library).*$/\1/ +--error ER_CANT_OPEN_LIBRARY +--reap; +SET DEBUG_SYNC='RESET'; + +--echo # Case 18008907_2: Deadlock situation caused by +--echo # default: has LOCK_system_variables_hash and waits on LOCK_global_system_variables, +--echo # con1: has LOCK_plugin and waits on LOCK_system_variables_hash AND +--echo # con2: has LOCK_global_system_variables and waits on LOCK_plugin. + +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR nothing TIMEOUT 10'; +--send call p_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 p_install(); + +connect(con2, localhost, root,,); +SET DEBUG_SYNC='now WAIT_FOR create_connection'; +# Without fix, deadlock situation will occur on timeout of debug_syncs in +# default and con1. Because of this, change_user operation hangs. +change_user; + +connection con1; +--replace_regex /(Can\'t open shared library).*$/\1/ +--error ER_CANT_OPEN_LIBRARY +--reap; + +connection default; +--replace_column 1 # +--reap; +disconnect con2; + +--echo # Case 18008907_3: Testing Concurrent "Show Variables" and "Plugin Uninstall" operations. + +#Installing plugin +--replace_regex /\.dll/.so/ +eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN'; + +connection con1; +#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 p_show_vars(); + +connect(con2, localhost, root,,); +SET DEBUG_SYNC='now WAIT_FOR uninstall_plugin'; +--send UNINSTALL PLUGIN example; + +connection default; +#Plugin Uninstall operation will wait until show variables operations releases LOCK_plugin_delete. +let $wait_condition= SELECT count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE INFO LIKE 'UNINSTALL PLUGIN example' and + STATE LIKE 'Waiting on cond'; +--source include/wait_condition.inc +SET DEBUG_SYNC='now SIGNAL go'; + +connection con1; +--replace_column 1 # +--reap + +connection con2; +--reap + +connection default; +DROP PROCEDURE p_show_vars; +DROP PROCEDURE p_install; +SET DEBUG_SYNC='RESET'; +disconnect con1; +disconnect con2; + +--disable_connect_log |