summaryrefslogtreecommitdiff
path: root/client/mysql_plugin.c
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 /client/mysql_plugin.c
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 'client/mysql_plugin.c')
-rw-r--r--client/mysql_plugin.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index fb2a031bb8e..15f67e2b3e7 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -1018,7 +1018,7 @@ static int find_plugin(char *tp_path)
Build the boostrap file.
Create a new file and populate it with SQL commands to ENABLE or DISABLE
- the plugin via INSERT and DELETE operations on the mysql.plugin table.
+ the plugin via REPLACE and DELETE operations on the mysql.plugin table.
param[in] operation The type of operation (ENABLE or DISABLE)
param[out] bootstrap A FILE* pointer
@@ -1035,12 +1035,16 @@ static int build_bootstrap_file(char *operation, char *bootstrap)
Perform plugin operation : ENABLE or DISABLE
The following creates a temporary bootstrap file and populates it with
- the appropriate SQL commands for the operation. For ENABLE, INSERT
+ the appropriate SQL commands for the operation. For ENABLE, REPLACE
statements are created. For DISABLE, DELETE statements are created. The
values for these statements are derived from the plugin_data read from the
<plugin_name>.ini configuration file. Once the file is built, a call to
mysqld is made in read only, bootstrap modes to read the SQL statements
and execute them.
+
+ Note: Replace was used so that if a user loads a newer version of a
+ library with a different library name, the new library name is
+ used for symbols that match.
*/
if ((error= make_tempfile(bootstrap, "sql")))
{
@@ -1057,7 +1061,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap)
if (strcasecmp(operation, "enable") == 0)
{
int i= 0;
- fprintf(file, "INSERT IGNORE INTO mysql.plugin VALUES ");
+ fprintf(file, "REPLACE INTO mysql.plugin VALUES ");
for (i= 0; i < (int)array_elements(plugin_data.components); i++)
{
/* stop when we read the end of the symbol list - marked with NULL */