summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysql_plugin.test
diff options
context:
space:
mode:
authorunknown <chuck.bell@oracle.com>2012-01-24 11:08:57 -0500
committerunknown <chuck.bell@oracle.com>2012-01-24 11:08:57 -0500
commit461e039a07062f05082175edb1156725ac43b4c6 (patch)
tree719cef0507edf504892d259cd31a7010dc8377a7 /mysql-test/t/mysql_plugin.test
parent7615cb0890da8e33636af88511404b1822254d3f (diff)
downloadmariadb-git-461e039a07062f05082175edb1156725ac43b4c6.tar.gz
BUG#12969301 : mysql_plugin: enable is ignored if plugin exists
This patch changes the mechanism by which the client enables a plugin. Instead of using INSERT IGNORE to reload a plugin library, it now uses REPLACE INTO. This allows users to load a library multiple times replacing the existing values in the mysql.plugin table. This allows users to replace the symbol reference to a different dl name in the table. Thus permitting enabling of multiple versions of the same library without first disabling the old version. A regression test was added to ensure this feature works.
Diffstat (limited to 'mysql-test/t/mysql_plugin.test')
-rw-r--r--mysql-test/t/mysql_plugin.test77
1 files changed, 75 insertions, 2 deletions
diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test
index c5968df85f8..71617b86330 100644
--- a/mysql-test/t/mysql_plugin.test
+++ b/mysql-test/t/mysql_plugin.test
@@ -155,6 +155,74 @@ eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE');
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+--write_file $expect_file
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+#
+# Disable the plugin - to remove winky, wonky entries
+#
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example
+
+#
+# Enable the plugin again
+#
+--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example
+
+#
+# Restart the server
+#
+--append_file $expect_file
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo #
+--echo # Ensure the plugin is loaded.
+--echo #
+--replace_regex /\.dll/.so/
+SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
+
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+--write_file $expect_file
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+# To test the case where the same plugin is reloaded with a different soname,
+# we must copy the example daemon to a new location renaming it.
+
+let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
+--copy_file $PLUGIN_DIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
+--copy_file include/libdaemon_example.ini $PLUGIN_DIR/libdaemon_example.ini
+
+# Now reload it and see that it is a different name.
+--exec $MYSQL_PLUGIN_CMD ENABLE libdaemon_example
+
+#
+# Restart the server
+#
+--append_file $expect_file
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo #
+--echo # Ensure the plugin is replaced.
+--echo #
+--replace_regex /\.dll/.so/
+SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
+
--echo #
--echo # Disable the plugin...
--echo #
@@ -170,7 +238,12 @@ EOF
#
# Disable the plugin
#
---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example
+--exec $MYSQL_PLUGIN_CMD DISABLE libdaemon_example
+
+# Remove files for last test case.
+
+--remove_file $PLUGIN_DIR/$DAEMON_RELOAD
+--remove_file $DAEMONEXAMPLE_DIR/libdaemon_example.ini
#
# Restart the server
@@ -184,7 +257,7 @@ EOF
--echo #
--echo # Ensure the plugin isn't loaded.
--echo #
-SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
+SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
#
# Stop the server for error conditions