diff options
author | Mats Kindahl <mats.kindahl@oracle.com> | 2011-08-15 20:12:11 +0200 |
---|---|---|
committer | Mats Kindahl <mats.kindahl@oracle.com> | 2011-08-15 20:12:11 +0200 |
commit | cf5e5f837a06d29e6806eea3c47192dc6dd483da (patch) | |
tree | a54b38fc92199ba1d0a8467adb980856f5effafe | |
parent | cfb4a7c2ff93a3a653f84d85e5f4b3df16e4f09a (diff) | |
download | mariadb-git-cf5e5f837a06d29e6806eea3c47192dc6dd483da.tar.gz |
Merging into mysql-5.5.16-release.
31 files changed, 141 insertions, 37 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 1254a4530f5..3e6ab2410a5 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -71,7 +71,7 @@ typedef struct st_mysql_xid MYSQL_XID; Plugin API. Common for all plugin types. */ -#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102 +#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103 /* The allowable types of plugins @@ -120,7 +120,7 @@ __MYSQL_DECLARE_PLUGIN(NAME, \ builtin_ ## NAME ## _sizeof_struct_st_plugin, \ builtin_ ## NAME ## _plugin) -#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}} +#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} /* declarations for SHOW STATUS support in plugins @@ -144,6 +144,14 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *) /* + Constants for plugin flags. + */ + +#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */ +#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */ + + +/* declarations for server variables and command line options */ @@ -415,6 +423,7 @@ struct st_mysql_plugin struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; /* reserved for dependency checking */ + unsigned long flags; /* flags for plugin */ }; /************************************************************************* diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 16aaeab21c3..5d90b3efc37 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -101,6 +101,7 @@ struct st_mysql_plugin struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; + unsigned long flags; }; #include "plugin_ftparser.h" #include "plugin.h" diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index e65278c518e..3807556fd1b 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -101,6 +101,7 @@ struct st_mysql_plugin struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; + unsigned long flags; }; #include "plugin_ftparser.h" #include "plugin.h" diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index c29eac45b19..1a9fa0c759c 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -43,7 +43,7 @@ typedef enum _thd_wait_type_e { THD_WAIT_BINLOG= 8, THD_WAIT_GROUP_COMMIT= 9, THD_WAIT_SYNC= 10, - THD_WAIT_LAST= 11 + THD_WAIT_LAST= 11 } thd_wait_type; extern struct thd_wait_service_st { void (*thd_wait_begin_func)(void*, int); @@ -101,6 +101,7 @@ struct st_mysql_plugin struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; + unsigned long flags; }; #include "plugin_ftparser.h" struct st_mysql_daemon diff --git a/plugin/audit_null/audit_null.c b/plugin/audit_null/audit_null.c index 3fe5fa993f0..469e5ae494c 100644 --- a/plugin/audit_null/audit_null.c +++ b/plugin/audit_null/audit_null.c @@ -154,7 +154,8 @@ mysql_declare_plugin(audit_null) 0x0002, /* version */ simple_status, /* status variables */ NULL, /* system variables */ - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/auth/auth_socket.c b/plugin/auth/auth_socket.c index 9d26a791b06..7990552ce8f 100644 --- a/plugin/auth/auth_socket.c +++ b/plugin/auth/auth_socket.c @@ -88,7 +88,8 @@ mysql_declare_plugin(socket_auth) 0x0100, NULL, NULL, - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/auth/dialog.c b/plugin/auth/dialog.c index 41312f95674..490de346a1e 100644 --- a/plugin/auth/dialog.c +++ b/plugin/auth/dialog.c @@ -153,7 +153,8 @@ mysql_declare_plugin(dialog) 0x0100, NULL, NULL, - NULL + NULL, + 0, }, { MYSQL_AUTHENTICATION_PLUGIN, @@ -167,7 +168,8 @@ mysql_declare_plugin(dialog) 0x0100, NULL, NULL, - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/auth/qa_auth_interface.c b/plugin/auth/qa_auth_interface.c index 0aa6c9ce20c..61e29fe9619 100644 --- a/plugin/auth/qa_auth_interface.c +++ b/plugin/auth/qa_auth_interface.c @@ -162,7 +162,8 @@ mysql_declare_plugin(test_plugin) 0x0100, NULL, NULL, - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/auth/qa_auth_server.c b/plugin/auth/qa_auth_server.c index 17171610200..4f1294e159f 100644 --- a/plugin/auth/qa_auth_server.c +++ b/plugin/auth/qa_auth_server.c @@ -82,6 +82,7 @@ mysql_declare_plugin(test_plugin) 0x0100, NULL, NULL, - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/auth/test_plugin.c b/plugin/auth/test_plugin.c index 912b6320579..efb32e8537d 100644 --- a/plugin/auth/test_plugin.c +++ b/plugin/auth/test_plugin.c @@ -125,7 +125,8 @@ mysql_declare_plugin(test_plugin) 0x0100, NULL, NULL, - NULL + NULL, + 0, }, { MYSQL_AUTHENTICATION_PLUGIN, @@ -139,7 +140,8 @@ mysql_declare_plugin(test_plugin) 0x0100, NULL, NULL, - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc index b53772648b4..fbfc0fb5f97 100644 --- a/plugin/daemon_example/daemon_example.cc +++ b/plugin/daemon_example/daemon_example.cc @@ -201,6 +201,7 @@ mysql_declare_plugin(daemon_example) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c index a15c8e21b32..d5f6d869ea1 100644 --- a/plugin/fulltext/plugin_example.c +++ b/plugin/fulltext/plugin_example.c @@ -267,7 +267,8 @@ mysql_declare_plugin(ftexample) 0x0001, /* version */ simple_status, /* status variables */ simple_system_variables, /* system variables */ - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index ea87adf98c4..9a325018242 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -429,6 +429,7 @@ mysql_declare_plugin(semi_sync_master) 0x0100 /* 1.0 */, semi_sync_master_status_vars, /* status variables */ semi_sync_master_system_vars, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc index cfb04bdd276..d5472b9cc83 100644 --- a/plugin/semisync/semisync_slave_plugin.cc +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -225,6 +225,7 @@ mysql_declare_plugin(semi_sync_slave) 0x0100 /* 1.0 */, semi_sync_slave_status_vars, /* status variables */ semi_sync_slave_system_vars, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index ac47c8dbc0e..610425ab735 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -11023,7 +11023,8 @@ mysql_declare_plugin(ndbcluster) 0x0100 /* 1.0 */, ndb_status_variables_export,/* status variables */ system_variables, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 9e22553ef0e..82bd39220a9 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7183,7 +7183,8 @@ mysql_declare_plugin(partition) 0x0100, /* 1.0 */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/log.cc b/sql/log.cc index 9080dcd7fa2..c6b41447d6a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6604,6 +6604,7 @@ mysql_declare_plugin(binlog) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index b8f46f090ab..6f4edac285d 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6415,3 +6415,8 @@ ER_ERROR_IN_TRIGGER_BODY ER_ERROR_IN_UNKNOWN_TRIGGER_BODY eng "Unknown trigger has an error in its body: '%-.256s'" +ER_PLUGIN_NO_UNINSTALL + eng "Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it." + +ER_PLUGIN_NO_INSTALL + eng "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it." diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 06a67edda36..87beb71cca5 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -9651,7 +9651,8 @@ mysql_declare_plugin(mysql_password) 0x0100, /* Version (1.0) */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ }, { MYSQL_AUTHENTICATION_PLUGIN, /* type constant */ @@ -9665,7 +9666,8 @@ mysql_declare_plugin(mysql_password) 0x0100, /* Version (1.0) */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 015cbe31a15..5f5e73091ff 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -539,6 +539,11 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) #endif } + /* + What's the purpose of this loop? If the goal is to catch a + missing 0 record at the end of a list, it will fail miserably + since the compiler is likely to optimize this away. /Matz + */ for (i= 0; ((struct st_mysql_plugin *)(ptr+i*sizeof_st_plugin))->info; i++) @@ -567,6 +572,23 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) } plugin_dl.plugins= (struct st_mysql_plugin *)sym; + /* + If report is REPORT_TO_USER, we were called from + mysql_install_plugin. Otherwise, we are called directly or + indirectly from plugin_init. + */ + if (report == REPORT_TO_USER) + { + st_mysql_plugin *plugin= plugin_dl.plugins; + for ( ; plugin->info ; ++plugin) + if (plugin->flags & PLUGIN_OPT_NO_INSTALL) + { + report_error(report, ER_PLUGIN_NO_INSTALL, plugin->name); + free_plugin_mem(&plugin_dl); + DBUG_RETURN(0); + } + } + /* Duplicate and convert dll name */ plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0)))) @@ -1884,6 +1906,16 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name) my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str); goto err; } + /* + Error message for ER_PLUGIN_IS_PERMANENT is not suitable for + plugins marked as not dynamically uninstallable, so we have a + separate one instead of changing the old one. + */ + if (plugin->plugin->flags & PLUGIN_OPT_NO_UNINSTALL) + { + my_error(ER_PLUGIN_NO_UNINSTALL, MYF(0), plugin->plugin->name); + goto err; + } plugin->state= PLUGIN_IS_DELETED; if (plugin->ref_count) diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index aec13a5fe6c..345c1b6835f 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1766,7 +1766,8 @@ mysql_declare_plugin(archive) 0x0300 /* 3.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 3905f4f18c3..c01bd7d27f5 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -448,6 +448,7 @@ mysql_declare_plugin(blackhole) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 1cca9c4e686..ba468c53716 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1766,7 +1766,8 @@ mysql_declare_plugin(csv) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index f7c9187aad0..44165ee6190 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1008,6 +1008,7 @@ mysql_declare_plugin(example) 0x0001 /* 0.1 */, func_status, /* status variables */ example_system_variables, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 858895b1add..06bf180283d 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -3481,6 +3481,7 @@ mysql_declare_plugin(federated) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 218aa35700f..a53b588ab69 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -825,6 +825,7 @@ mysql_declare_plugin(heap) 0x0100, /* 1.0 */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 24407c7b053..4648b4300b8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -11402,7 +11402,8 @@ mysql_declare_plugin(innobase) INNODB_VERSION_SHORT, innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ - NULL /* reserved */ + NULL, /* reserved */ + 0, /* flags */ }, i_s_innodb_trx, i_s_innodb_locks, diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index de5cc682078..e9905930699 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -638,7 +638,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -904,7 +908,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1087,7 +1095,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; /*******************************************************************//** @@ -1420,7 +1432,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = @@ -1470,7 +1486,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -1711,7 +1731,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = @@ -1761,7 +1785,11 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = /* reserved for dependency checking */ /* void* */ - STRUCT_FLD(__reserved1, NULL) + STRUCT_FLD(__reserved1, NULL), + + /* Plugin flags */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL), }; /*******************************************************************//** diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 8f7400308ba..b2b64054cf9 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -2086,7 +2086,8 @@ mysql_declare_plugin(myisam) 0x0100, /* 1.0 */ NULL, /* status variables */ myisam_sysvars, /* system variables */ - NULL + NULL, + 0, } mysql_declare_plugin_end; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index c76e9ee0bfe..b7e043c99f1 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1687,6 +1687,7 @@ mysql_declare_plugin(myisammrg) 0x0100, /* 1.0 */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 8e3486a4fa3..5cc10b0f35a 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -166,7 +166,8 @@ mysql_declare_plugin(perfschema) 0x0001 /* 0.1 */, pfs_status_vars, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; |