List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 8 2011 2:50pm
Subject:bzr commit into mysql-trunk branch (Georgi.Kodinov:3165) Bug#11766001
View as plain text  
#At file:///Users/kgeorge/mysql/work/B11766001-trunk/ based on revid:alexander.nozdrin@stripped

 3165 Georgi Kodinov	2011-06-08
      Bug #11766001: 59026: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS
      
      Implemented support for a new command line option :
      --plugin-load-add=<comma-separated-name-equals-value-list>
      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.

    added:
      mysql-test/r/multi_plugin_load.result
      mysql-test/r/multi_plugin_load_add.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
    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
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-05-30 14:00:14 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-06-08 14:49:58 +0000
@@ -2174,18 +2174,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-06-08 14:49:58 +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-06-08 14:49:58 +0000
@@ -0,0 +1,12 @@
+#
+# 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

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2011-05-26 05:50:01 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2011-06-08 14:49:58 +0000
@@ -478,6 +478,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
@@ -919,7 +926,6 @@ performance-schema-max-thread-classes 50
 performance-schema-max-thread-instances 1000
 performance-schema-setup-actors-size 100
 performance-schema-setup-objects-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-05-26 05:50:01 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2011-06-08 14:49:58 +0000
@@ -478,6 +478,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
@@ -923,7 +930,6 @@ performance-schema-max-thread-classes 50
 performance-schema-max-thread-instances 1000
 performance-schema-setup-actors-size 100
 performance-schema-setup-objects-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-06-08 14:49:58 +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-06-08 14:49:58 +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-06-08 14:49:58 +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-06-08 14:49:58 +0000
@@ -0,0 +1,12 @@
+--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;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-06-06 10:29:45 +0000
+++ b/sql/mysqld.cc	2011-06-08 14:49:58 +0000
@@ -1528,6 +1528,7 @@ void clean_up(bool print_message)
   my_free(const_cast<char*>(relay_log_basename));
   my_free(const_cast<char*>(relay_log_index));
 #endif
+  free_list(opt_plugin_load_list_ptr);
 
   /*
     The following lines may never be executed as the main thread may have
@@ -6402,11 +6403,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,
@@ -7637,6 +7646,13 @@ mysqld_get_one_option(int optid,
     if (argument == NULL) /* no argument */
       log_error_file_ptr= const_cast<char*>("");
     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-05-19 09:11:38 +0000
+++ b/sql/mysqld.h	2011-06-08 14:49:58 +0000
@@ -533,7 +533,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-05-26 15:20:09 +0000
+++ b/sql/sql_plugin.cc	2011-06-08 14:49:58 +0000
@@ -48,8 +48,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<i_string> opt_plugin_load_list;
+I_List<i_string> *opt_plugin_load_list_ptr= &opt_plugin_load_list;
 char *opt_plugin_dir_ptr;
 char opt_plugin_dir[FN_REFLEN];
 /*
@@ -1330,8 +1330,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<i_string> 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-02-18 11:39:05 +0000
+++ b/sql/sql_plugin.h	2011-06-08 14:49:58 +0000
@@ -130,7 +130,8 @@ typedef struct st_plugin_int **plugin_re
 
 typedef int (*plugin_type_init)(struct st_plugin_int *);
 
-extern char *opt_plugin_load;
+#include "sql_list.h"
+extern I_List<i_string> *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[];


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20110608144958-4tw4s604ihumzrgu.bundle
Thread
bzr commit into mysql-trunk branch (Georgi.Kodinov:3165) Bug#11766001Georgi Kodinov9 Jun