Hi, Oleksandr! On Nov 03, Oleksandr Byelkin wrote:
Here is first implementation for review
/* Macros for beginning and ending plugin declarations. Between mysql_declare_plugin and mysql_declare_plugin_end there should @@ -398,7 +411,9 @@ const char *name; /* plugin name */ const char *author; /* plugin author (for SHOW PLUGINS) */ const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ + const char *sversion; /* the plugin version string */ int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ + int maturity; /* the plugin maturity (PLUGIN_MATURITY_XXX) */ int (*init)(void *); /* the function to invoke when plugin is loaded */ int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ unsigned int version; /* plugin version (for SHOW PLUGINS) */
=== modified file 'storage/federatedx/ha_federatedx.cc' --- storage/federatedx/ha_federatedx.cc 2009-10-30 18:50:56 +0000 +++ storage/federatedx/ha_federatedx.cc 2009-11-02 23:40:07 +0000 @@ -3476,7 +3476,13 @@ "FEDERATED", "Patrick Galbraith", "FederatedX pluggable storage engine", +#ifdef MARIADB + "1.0 beta", +#endif PLUGIN_LICENSE_GPL, +#ifdef MARIADB + PLUGIN_MATURITY_BETA, +#endif federatedx_db_init, /* Plugin Init */ federatedx_done, /* Plugin Deinit */ 0x0100 /* 1.0 */,
Whoa, that kind of kills the whole idea. One can load MySQL plugin into MariaDB and it'll crash. One can load MariaDB plugin into MySQL and it'll crash. One can load old MariaDB plugin into new MariaDB and it'll crash. The other way around will crash too. Using plugins becomes a walking-on-a-minefield experience. Versioning protection is there for a reason. And checks for API changes (a.k.a. check_abi rule in a Makefile) too. So, at first - you've modified the ABI, in an incompatible way. The very least you should do is to change the MYSQL_PLUGIN_INTERFACE_VERSION to be 0x0200. It would be also nice to have support for old 0x0100 plugins in sql_plugin.cc, but it's optional. Still, it will be possible to load MySQL and MariaDB plugins interchangeably which will only cause crashes. Now you need to decide what you want and what MariaDB is. If it's *extended* but compatible (at least plugin-wise) version, than all plugins should load interchangeably and *not* crash, at least. If MariaDB have chosen to diverge - plugins should not load interchangeably. Make you choice. To keep plugins compatible - you add another set of symbols, say, _mariadb_plugin_interface_version_ and _mariadb_plugin_declarations_[]. This way you one can add extensions to the plugin API and keep it compatible. And remove ifdefs from the plugin sources too. To make MariaDB plugins incompatible you *rename* all _mysql_* symbols to _mariadb_* symbols. Either way the automatic protection will work on load and the user won't need to track manually what he can load where. Regards / Mit vielen Grüßen, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@sun.com> / /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect /_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028 <___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel Vorsitzender des Aufsichtsrates: Martin Häring