From: Georgi Kodinov Date: August 18 2011 8:31am Subject: bzr push into mysql-trunk branch (Georgi.Kodinov:3382 to 3383) Bug#11766001 List-Archive: http://lists.mysql.com/commits/140695 X-Bug: 11766001 Message-Id: <201108180831.p7I8Vv83029287@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3383 Georgi Kodinov 2011-08-18 Bug #11766001: 59026: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS Implemented support for a new command line option : --plugin-load-add= This option takes the same type of arguments that --plugin-load does and complements --plugin-load (that continues to operate as before) by appending its argument to the list specified by --plugin-load. So --plugin-load can be considered a composite option consisting of resetting the plugin load list and then calling --plugin-load-add to process the argument. Note that the order in which you specify --plugin-load and --plugin-load-add is important : "--plugin-load=x --plugin-load-add=y" will be equivalent to "--plugin-load=x,y" whereas "--plugin-load-add=y --plugin-load=x" will be equivalent to "plugin-load=x". Incompatible change : the --help --verbose command will no longer print the --plugin-load variable's values (as it doesn't have one). Otherwise both --plugin-load and --plugin-load-add are mentioned in it. Added few test cases to test different combinations. Added an extension to mysql-test-run.pl to add variables for --plugin-load-add similarly to what it does for --plugin-load. Moved the includes on top of the files. added: mysql-test/r/multi_plugin_load.result mysql-test/r/multi_plugin_load_add.result mysql-test/r/multi_plugin_load_add2.result mysql-test/t/multi_plugin_load-master.opt mysql-test/t/multi_plugin_load.test mysql-test/t/multi_plugin_load_add-master.opt mysql-test/t/multi_plugin_load_add.test mysql-test/t/multi_plugin_load_add2-master.opt mysql-test/t/multi_plugin_load_add2.test modified: mysql-test/mysql-test-run.pl mysql-test/r/mysqld--help-notwin.result mysql-test/r/mysqld--help-win.result sql/mysqld.cc sql/mysqld.h sql/sql_plugin.cc sql/sql_plugin.h 3382 Georgi Kodinov 2011-08-18 Addendum to the fix for bug #11746029: 22615: MYSQL SERVER INCORRECTLY CATOGORIZES THE LOST+FOUND DIRECTORY AS A DATABA 1. Made sure the system variable is null terminated when constructed from the individual options. 2. Fixed the order of the options in the --help output test file on windows. modified: mysql-test/r/mysqld--help-win.result sql/sql_show.cc === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2011-08-16 19:33:03 +0000 +++ b/mysql-test/mysql-test-run.pl 2011-08-18 08:31:08 +0000 @@ -2194,18 +2194,22 @@ sub read_plugin_defs($) if ($plug_names) { my $lib_name= basename($plugin); my $load_var= "--plugin_load="; + my $load_add_var= "--plugin_load_add="; my $semi= ''; foreach my $plug_name (split (',', $plug_names)) { $load_var .= $semi . "$plug_name=$lib_name"; + $load_add_var .= $semi . "$plug_name=$lib_name"; $semi= ';'; } $ENV{$plug_var.'_LOAD'}= $load_var; + $ENV{$plug_var.'_LOAD_ADD'}= $load_add_var; } } else { $ENV{$plug_var}= ""; $ENV{$plug_var.'_DIR'}= ""; $ENV{$plug_var.'_OPT'}= ""; $ENV{$plug_var.'_LOAD'}= "" if $plug_names; + $ENV{$plug_var.'_LOAD_ADD'}= "" if $plug_names; } } close PLUGDEF; === added file 'mysql-test/r/multi_plugin_load.result' --- a/mysql-test/r/multi_plugin_load.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/multi_plugin_load.result 2011-08-18 08:31:08 +0000 @@ -0,0 +1,10 @@ +# +# Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +# +# test multiple consecutive --plugin-load options +# success : only qa_auth_server should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') +ORDER BY 1; +PLUGIN_NAME PLUGIN_STATUS +qa_auth_server ACTIVE === added file 'mysql-test/r/multi_plugin_load_add.result' --- a/mysql-test/r/multi_plugin_load_add.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/multi_plugin_load_add.result 2011-08-18 08:31:08 +0000 @@ -0,0 +1,14 @@ +# +# Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +# +# test multiple consecutive --plugin-load-add options +# success : both test_plugin_server and qa_auth_server +# should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') +ORDER BY 1; +PLUGIN_NAME PLUGIN_STATUS +qa_auth_server ACTIVE +test_plugin_server ACTIVE +SELECT * FROM MYSQL.PLUGIN ORDER BY name; +name dl === added file 'mysql-test/r/multi_plugin_load_add2.result' --- a/mysql-test/r/multi_plugin_load_add2.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/multi_plugin_load_add2.result 2011-08-18 08:31:08 +0000 @@ -0,0 +1,14 @@ +# +# Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +# +# test multiple consecutive --plugin-load-add options +# success : both test_plugin_server and qa_auth_server +# should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') +ORDER BY 1; +PLUGIN_NAME PLUGIN_STATUS +qa_auth_server ACTIVE +test_plugin_server ACTIVE +SELECT * FROM MYSQL.PLUGIN ORDER BY name; +name dl === modified file 'mysql-test/r/mysqld--help-notwin.result' --- a/mysql-test/r/mysqld--help-notwin.result 2011-08-17 14:33:45 +0000 +++ b/mysql-test/r/mysqld--help-notwin.result 2011-08-18 08:31:08 +0000 @@ -509,6 +509,13 @@ The following options may be given as th where each plugin is identified as name=library, where name is the plugin name and library is the plugin library in plugin_dir. + --plugin-load-add=name + Optional semicolon-separated list of plugins to load, + where each plugin is identified as name=library, where + name is the plugin name and library is the plugin library + in plugin_dir. This option adds to the list speficied by + --plugin-load in an incremental way. Multiple + --plugin-load-add are supported. -P, --port=# Port number to use for connection or 0 to default to, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306), whatever comes first @@ -959,7 +966,6 @@ performance-schema-max-thread-instances performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size 100 -plugin-load (No default value) port 3306 port-open-timeout 0 preload-buffer-size 32768 === modified file 'mysql-test/r/mysqld--help-win.result' --- a/mysql-test/r/mysqld--help-win.result 2011-08-18 08:14:24 +0000 +++ b/mysql-test/r/mysqld--help-win.result 2011-08-18 08:31:08 +0000 @@ -509,6 +509,13 @@ The following options may be given as th where each plugin is identified as name=library, where name is the plugin name and library is the plugin library in plugin_dir. + --plugin-load-add=name + Optional semicolon-separated list of plugins to load, + where each plugin is identified as name=library, where + name is the plugin name and library is the plugin library + in plugin_dir. This option adds to the list speficied by + --plugin-load in an incremental way. Multiple + --plugin-load-add are supported. -P, --port=# Port number to use for connection or 0 to default to, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306), whatever comes first @@ -963,7 +970,6 @@ performance-schema-max-thread-instances performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size 100 -plugin-load (No default value) port 3306 port-open-timeout 0 preload-buffer-size 32768 === added file 'mysql-test/t/multi_plugin_load-master.opt' --- a/mysql-test/t/multi_plugin_load-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load-master.opt 2011-08-18 08:31:08 +0000 @@ -0,0 +1,4 @@ +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD +$PLUGIN_AUTH_INTERFACE_LOAD_ADD +$PLUGIN_AUTH_SERVER_LOAD === added file 'mysql-test/t/multi_plugin_load.test' --- a/mysql-test/t/multi_plugin_load.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load.test 2011-08-18 08:31:08 +0000 @@ -0,0 +1,11 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +--echo # + +--echo # test multiple consecutive --plugin-load options +--echo # success : only qa_auth_server should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') + ORDER BY 1; === added file 'mysql-test/t/multi_plugin_load_add-master.opt' --- a/mysql-test/t/multi_plugin_load_add-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load_add-master.opt 2011-08-18 08:31:08 +0000 @@ -0,0 +1,3 @@ +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD_ADD +$PLUGIN_AUTH_SERVER_LOAD_ADD === added file 'mysql-test/t/multi_plugin_load_add.test' --- a/mysql-test/t/multi_plugin_load_add.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load_add.test 2011-08-18 08:31:08 +0000 @@ -0,0 +1,13 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +--echo # + +--echo # test multiple consecutive --plugin-load-add options +--echo # success : both test_plugin_server and qa_auth_server +--echo # should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') + ORDER BY 1; +SELECT * FROM MYSQL.PLUGIN ORDER BY name; === added file 'mysql-test/t/multi_plugin_load_add2-master.opt' --- a/mysql-test/t/multi_plugin_load_add2-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load_add2-master.opt 2011-08-18 08:31:08 +0000 @@ -0,0 +1,5 @@ +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD +$PLUGIN_AUTH_SERVER_LOAD_ADD +$PLUGIN_AUTH_LOAD +$PLUGIN_AUTH_SERVER_LOAD_ADD === added file 'mysql-test/t/multi_plugin_load_add2.test' --- a/mysql-test/t/multi_plugin_load_add2.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/multi_plugin_load_add2.test 2011-08-18 08:31:08 +0000 @@ -0,0 +1,13 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug #11766001: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS +--echo # + +--echo # test multiple consecutive --plugin-load-add options +--echo # success : both test_plugin_server and qa_auth_server +--echo # should be present +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_NAME IN ('test_plugin_server', 'qa_auth_server') + ORDER BY 1; +SELECT * FROM MYSQL.PLUGIN ORDER BY name; === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2011-08-17 14:33:45 +0000 +++ b/sql/mysqld.cc 2011-08-18 08:31:08 +0000 @@ -1531,6 +1531,7 @@ void clean_up(bool print_message) my_free(const_cast(relay_log_basename)); my_free(const_cast(relay_log_index)); #endif + free_list(opt_plugin_load_list_ptr); /* The following lines may never be executed as the main thread may have @@ -6445,11 +6446,19 @@ struct my_option my_long_options[]= &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin-load", 0, + {"plugin-load", OPT_PLUGIN_LOAD, "Optional semicolon-separated list of plugins to load, where each plugin is " "identified as name=library, where name is the plugin name and library " "is the plugin library in plugin_dir.", - &opt_plugin_load, &opt_plugin_load, 0, + 0, 0, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"plugin-load-add", OPT_PLUGIN_LOAD_ADD, + "Optional semicolon-separated list of plugins to load, where each plugin is " + "identified as name=library, where name is the plugin name and library " + "is the plugin library in plugin_dir. This option adds to the list " + "speficied by --plugin-load in an incremental way. " + "Multiple --plugin-load-add are supported.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"table_cache", 0, "Deprecated; use --table-open-cache instead.", &table_cache_size, &table_cache_size, 0, GET_ULONG, @@ -7701,6 +7710,13 @@ mysqld_get_one_option(int optid, } break; + + case OPT_PLUGIN_LOAD: + free_list(opt_plugin_load_list_ptr); + /* fall through */ + case OPT_PLUGIN_LOAD_ADD: + opt_plugin_load_list_ptr->push_back(new i_string(argument)); + break; } return 0; } === modified file 'sql/mysqld.h' --- a/sql/mysqld.h 2011-08-17 14:33:45 +0000 +++ b/sql/mysqld.h 2011-08-18 08:31:08 +0000 @@ -542,7 +542,9 @@ enum options_mysqld OPT_WANT_CORE, OPT_ENGINE_CONDITION_PUSHDOWN, OPT_LOG_ERROR, - OPT_MAX_LONG_DATA_SIZE + OPT_MAX_LONG_DATA_SIZE, + OPT_PLUGIN_LOAD, + OPT_PLUGIN_LOAD_ADD }; === modified file 'sql/sql_plugin.cc' --- a/sql/sql_plugin.cc 2011-08-03 11:23:01 +0000 +++ b/sql/sql_plugin.cc 2011-08-18 08:31:08 +0000 @@ -49,8 +49,8 @@ static TYPELIB global_plugin_typelib= { array_elements(global_plugin_typelib_names)-1, "", global_plugin_typelib_names, NULL }; - -char *opt_plugin_load= NULL; +static I_List opt_plugin_load_list; +I_List *opt_plugin_load_list_ptr= &opt_plugin_load_list; char *opt_plugin_dir_ptr; char opt_plugin_dir[FN_REFLEN]; /* @@ -1335,8 +1335,11 @@ int plugin_init(int *argc, char **argv, /* Register all dynamic plugins */ if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING)) { - if (opt_plugin_load) - plugin_load_list(&tmp_root, argc, argv, opt_plugin_load); + I_List_iterator iter(opt_plugin_load_list); + i_string *item; + while (NULL != (item= iter++)) + plugin_load_list(&tmp_root, argc, argv, item->ptr); + if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE)) plugin_load(&tmp_root, argc, argv); } === modified file 'sql/sql_plugin.h' --- a/sql/sql_plugin.h 2011-07-19 15:11:15 +0000 +++ b/sql/sql_plugin.h 2011-08-18 08:31:08 +0000 @@ -40,6 +40,7 @@ enum enum_plugin_load_option { PLUGIN_OF extern const char *global_plugin_typelib_names[]; #include +#include "sql_list.h" #ifdef DBUG_OFF #define plugin_ref_to_int(A) A @@ -131,7 +132,7 @@ typedef struct st_plugin_int **plugin_re typedef int (*plugin_type_init)(struct st_plugin_int *); -extern char *opt_plugin_load; +extern I_List *opt_plugin_load_list_ptr; extern char *opt_plugin_dir_ptr; extern char opt_plugin_dir[FN_REFLEN]; extern const LEX_STRING plugin_type_names[]; No bundle (reason: useless for push emails).