List:Commits« Previous MessageNext Message »
From:antony Date:September 28 2007 4:24am
Subject:bk commit into 6.0 tree (acurtis:1.2602) BUG#31258
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-09-27 19:24:33-07:00, acurtis@stripped +7 -0
  Bug#31258
    "Disabling a plugin with dependencies does not work wth mysql-test-run.pl"
  
    Note: This patch does not implement plugin dependencies.
  
    New command line option: --disable-plugins=NAMES
    where NAMES is a comma seperated list of plugin names which will not be loaded
    automatically during initialization. Names are case-insenstive and SQL LIKE wildcards
    are permitted which enable disabling all plugins which start with a specific name.
    When initializing built-in and installed plugins, check if they have been explicitly
    disabled by the --disable-plugins= option.

  mysql-test/t/information_schema-master.opt@stripped, 2007-09-27 19:24:29-07:00,
acurtis@stripped +1 -0
    New BitKeeper file ``mysql-test/t/information_schema-master.opt''

  mysql-test/t/information_schema-master.opt@stripped, 2007-09-27 19:24:29-07:00,
acurtis@stripped +0 -0

  mysql-test/t/information_schema_db-master.opt@stripped, 2007-09-27 19:24:29-07:00,
acurtis@stripped +1 -0
    New BitKeeper file ``mysql-test/t/information_schema_db-master.opt''

  mysql-test/t/information_schema_db-master.opt@stripped, 2007-09-27 19:24:29-07:00,
acurtis@stripped +0 -0

  mysql-test/t/mysqlshow-master.opt@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +1
-0
    New BitKeeper file ``mysql-test/t/mysqlshow-master.opt''

  mysql-test/t/mysqlshow-master.opt@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +0
-0

  mysql-test/t/variables-master.opt@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +1
-1
    disable all plugins whose name starts with 'falcon'

  sql/mysqld.cc@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +6 -0
    bug31258
      New command line option: --disable-plugins=NAMES
      where NAMES is a comma seperated list of plugin names which will not be loaded
      automatically during initialization. Names are case-insenstive and SQL LIKE
wildcards
      are permitted.

  sql/sql_plugin.cc@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +70 -7
    bug31258
      new global: opt_plugin_disable
      new functions: is_default_plugin_enabled(), is_plugin_mandatory(),
is_plugin_disabled()
      When initializing built-in and installed plugins, check if they have been explicitly
      disabled by the --disable-plugins= option.

  sql/sql_plugin.h@stripped, 2007-09-27 19:24:29-07:00, acurtis@stripped +1 -0
    bug31258
      new global opt_plugin_disable

diff -Nrup a/mysql-test/t/information_schema-master.opt
b/mysql-test/t/information_schema-master.opt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/information_schema-master.opt	2007-09-27 19:24:29 -07:00
@@ -0,0 +1 @@
+--disable-plugins="falcon%"
diff -Nrup a/mysql-test/t/information_schema_db-master.opt
b/mysql-test/t/information_schema_db-master.opt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/information_schema_db-master.opt	2007-09-27 19:24:29 -07:00
@@ -0,0 +1 @@
+--disable-plugins="falcon%"
diff -Nrup a/mysql-test/t/mysqlshow-master.opt b/mysql-test/t/mysqlshow-master.opt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/mysqlshow-master.opt	2007-09-27 19:24:29 -07:00
@@ -0,0 +1 @@
+--disable-plugins="falcon%"
diff -Nrup a/mysql-test/t/variables-master.opt b/mysql-test/t/variables-master.opt
--- a/mysql-test/t/variables-master.opt	2007-09-21 21:59:32 -07:00
+++ b/mysql-test/t/variables-master.opt	2007-09-27 19:24:29 -07:00
@@ -1 +1 @@
---loose-skip-plugin_falcon
+--disable-plugins="falcon%"
diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc	2007-09-11 10:44:02 -07:00
+++ b/sql/mysqld.cc	2007-09-27 19:24:29 -07:00
@@ -5088,6 +5088,7 @@ enum options_mysqld
   OPT_TABLE_LOCK_WAIT_TIMEOUT,
   OPT_PLUGIN_LOAD,
   OPT_PLUGIN_DIR,
+  OPT_PLUGIN_DISABLE,
   OPT_LOG_OUTPUT,
   OPT_PORT_OPEN_TIMEOUT,
   OPT_KEEP_FILES_ON_CREATE,
@@ -5252,6 +5253,11 @@ struct my_option my_long_options[] =
    (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #endif /* HAVE_OPENSSL */
+  {"disable-plugins", OPT_PLUGIN_DISABLE,
+   "Comma seperated list indicating plugins not be loaded at startup. There "
+   "are no errors or warnings for unknown plugins. Wildcards are permitted.",
+   (uchar**) &opt_plugin_disable, (uchar**) &opt_plugin_disable,
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_REPLICATION
   {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
    "Option used by mysql-test for debugging and testing of replication.",
diff -Nrup a/sql/sql_plugin.cc b/sql/sql_plugin.cc
--- a/sql/sql_plugin.cc	2007-08-25 01:43:14 -07:00
+++ b/sql/sql_plugin.cc	2007-09-27 19:24:29 -07:00
@@ -29,6 +29,7 @@
 
 extern struct st_mysql_plugin *mysqld_builtins[];
 
+char *opt_plugin_disable= NULL;
 char *opt_plugin_load= NULL;
 char *opt_plugin_dir_ptr;
 char opt_plugin_dir[FN_REFLEN];
@@ -1080,6 +1081,65 @@ uchar *get_bookmark_hash_key(const uchar
 }
 
 
+static bool is_default_plugin_enabled(const char *name)
+{
+  /* by default, only ndbcluster is disabled */
+  return my_strcasecmp(&my_charset_latin1, name, "NDBCLUSTER") != 0;
+}
+
+
+static bool is_plugin_mandatory(const char *name)
+{
+ return !my_strcasecmp(&my_charset_latin1, name, "MyISAM") ||
+        !my_strcasecmp(&my_charset_latin1, name, "MEMORY");
+}
+
+
+static bool is_plugin_disabled(const char *name)
+{
+  const char * const sep= ",";
+  CHARSET_INFO * const ci= &my_charset_latin1;
+  char *wild, *brkp, *lname, *disable;
+  int pos, namelen, disablelen;
+  bool result= false;
+
+  if (!opt_plugin_disable || !opt_plugin_disable[0] ||
+      is_plugin_mandatory(name))
+    return false;
+  
+  disablelen= strlen(opt_plugin_disable);
+  namelen= strlen(name);
+  lname= (char*) my_alloca(namelen + disablelen + 2);
+  disable= lname + namelen + 1;
+  
+  /* convert the plugin name to all lowercase characters */
+  
+  for (pos= 0; pos < namelen; pos++)
+    lname[pos]= my_tolower(ci, name[pos]);
+
+  lname[namelen]= 0;
+  
+  /* convert the disable list to all lowercase characters */
+  
+  for (pos= 0; pos < disablelen; pos++)
+    disable[pos]= my_tolower(ci, opt_plugin_disable[pos]);
+
+  disable[disablelen]= 0;
+  
+  /* check if the named plugin has been disabled */
+  
+  for (wild= strtok_r(disable, sep, &brkp);
+       !result && wild; wild= strtok_r(NULL, sep, &brkp))
+  {
+    if (!wild_compare(lname, wild, 0))
+      result= true;
+  }
+
+  my_afree((void*) lname);
+  return result;
+}
+
+
 /*
   The logic is that we first load and initialize all compiled in plugins.
   From there we load up the dynamic types (assuming we have not been told to
@@ -1134,16 +1194,15 @@ int plugin_init(int *argc, char **argv, 
   {
     for (plugin= *builtins; plugin->info; plugin++)
     {
-      /* by default, only ndbcluster is disabled */
-      def_enabled=
-        my_strcasecmp(&my_charset_latin1, plugin->name, "NDBCLUSTER") != 0;
+      def_enabled= is_default_plugin_enabled(plugin->name);
       bzero(&tmp, sizeof(tmp));
       tmp.plugin= plugin;
       tmp.name.str= (char *)plugin->name;
       tmp.name.length= strlen(plugin->name);
 
       free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE));
-      if (test_plugin_options(&tmp_root, &tmp, argc, argv, def_enabled))
+      if (is_plugin_disabled(plugin->name) ||
+          test_plugin_options(&tmp_root, &tmp, argc, argv, def_enabled))
         continue;
 
       if (register_builtin(plugin, &tmp, &plugin_ptr))
@@ -1376,6 +1435,12 @@ static void plugin_load(MEM_ROOT *tmp_ro
     LEX_STRING name= {(char *)str_name.ptr(), str_name.length()};
     LEX_STRING dl= {(char *)str_dl.ptr(), str_dl.length()};
 
+    if (is_plugin_disabled(name.str))
+    {
+      free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
+      continue;
+    }
+
     if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
       sql_print_warning("Couldn't load plugin named '%s' with soname '%s'.",
                         str_name.c_ptr(), str_dl.c_ptr());
@@ -3066,9 +3131,7 @@ static int test_plugin_options(MEM_ROOT 
   for (opt= tmp->plugin->system_vars; opt && *opt; opt++)
     count+= 2; /* --{plugin}-{optname} and --plugin-{plugin}-{optname} */
 
-  can_disable=
-      my_strcasecmp(&my_charset_latin1, tmp->name.str, "MyISAM") &&
-      my_strcasecmp(&my_charset_latin1, tmp->name.str, "MEMORY");
+  can_disable= !is_plugin_mandatory(tmp->name.str);
 
   if (count > EXTRA_OPTIONS || (*argc > 1))
   {
diff -Nrup a/sql/sql_plugin.h b/sql/sql_plugin.h
--- a/sql/sql_plugin.h	2007-06-12 08:41:54 -07:00
+++ b/sql/sql_plugin.h	2007-09-27 19:24:29 -07:00
@@ -107,6 +107,7 @@ typedef int (*plugin_type_init)(struct s
 
 extern char *opt_plugin_load;
 extern char *opt_plugin_dir_ptr;
+extern char *opt_plugin_disable;
 extern char opt_plugin_dir[FN_REFLEN];
 extern const LEX_STRING plugin_type_names[];
 
Thread
bk commit into 6.0 tree (acurtis:1.2602) BUG#31258antony28 Sep